objectweb-asm/objectweb-asm.spec

117 lines
5.0 KiB
RPMSpec
Raw Normal View History

2020-08-17 17:18:51 +08:00
%bcond_without junit5
%bcond_without osgi
Name: objectweb-asm
Version: 7.0
Release: 1
Summary: Java bytecode manipulation and analysis framework
License: BSD
URL: http://asm.ow2.org/
BuildArch: noarch
Source0: objectweb-asm-%{version}.tar.gz
Source1: parent.pom
Source2: http://repo1.maven.org/maven2/org/ow2/asm/asm/%{version}/asm-%{version}.pom
Source3: http://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/%{version}/asm-analysis-%{version}.pom
Source4: http://repo1.maven.org/maven2/org/ow2/asm/asm-commons/%{version}/asm-commons-%{version}.pom
Source5: http://repo1.maven.org/maven2/org/ow2/asm/asm-test/%{version}/asm-test-%{version}.pom
Source6: http://repo1.maven.org/maven2/org/ow2/asm/asm-tree/%{version}/asm-tree-%{version}.pom
Source7: http://repo1.maven.org/maven2/org/ow2/asm/asm-util/%{version}/asm-util-%{version}.pom
Source8: asm-all.pom
Source9: generate-tarball.sh
BuildRequires: maven-local mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin) mvn(org.ow2:ow2:pom:)
%if %{with junit5}
BuildRequires: mvn(org.codehaus.janino:janino) mvn(org.junit.jupiter:junit-jupiter-api)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-engine)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-params)
BuildRequires: mvn(org.apache.maven.surefire:surefire-junit-platform)
%endif
%if %{with osgi}
BuildRequires: objectweb-asm >= 6
%endif
Requires: javapackages-tools
2020-02-25 12:59:48 +08:00
%description
2020-08-17 17:18:51 +08:00
ASM is an all purpose Java bytecode manipulation and analysis
framework. It can be used to modify existing classes or dynamically
generate classes, directly in binary form. Provided common
transformations and analysis algorithms allow to easily assemble
custom complex transformations and code analysis tools.
2020-02-25 12:59:48 +08:00
2020-08-17 17:18:51 +08:00
%package javadoc
Summary: API documentation for %{name}
%description javadoc
This package provides %{summary}.
2020-02-25 12:59:48 +08:00
%prep
2020-08-17 17:18:51 +08:00
%setup -q
cp -p %{SOURCE1} pom.xml
%if %{without junit5}
%pom_disable_module asm-test
%endif
for pom in asm asm-analysis asm-commons asm-test asm-tree asm-util; do
cp -p $RPM_SOURCE_DIR/${pom}-%{version}.pom $pom/pom.xml
# Fix junit5 configuration
%if %{with junit5}
2020-02-25 12:59:48 +08:00
%pom_add_dep org.junit.jupiter:junit-jupiter-engine:5.1.0:test $pom
%pom_add_plugin org.apache.maven.plugins:maven-surefire-plugin:2.22.0 $pom
2020-08-17 17:18:51 +08:00
%endif
%if %{with osgi}
2020-02-25 12:59:48 +08:00
if [ "$pom" != "asm-test" ] ; then
2020-08-17 17:18:51 +08:00
# Make into OSGi bundles
2020-02-25 12:59:48 +08:00
bsn="org.objectweb.${pom//-/.}"
%pom_xpath_inject pom:project "<packaging>bundle</packaging>" $pom
%pom_add_plugin org.apache.felix:maven-bundle-plugin:3.5.0 $pom \
" <extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>$bsn</Bundle-SymbolicName>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.8</Bundle-RequiredExecutionEnvironment>
<_removeheaders>Bnd-LastModified,Build-By,Created-By,Include-Resource,Require-Capability,Tool</_removeheaders>
<_pluginpath>$(pwd)/tools/bnd-module-plugin/bnd-module-plugin.jar, $(find-jar objectweb-asm/asm-all)</_pluginpath>
<_plugin>org.objectweb.asm.tools.ModuleInfoBndPlugin;</_plugin>
</instructions>
</configuration>"
fi
2020-08-17 17:18:51 +08:00
%endif
2020-02-25 12:59:48 +08:00
done
sed -i -e '/testReadAndWriteWithComputeMaxsAndLargeSubroutines/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm/src/test/java/org/objectweb/asm/ClassWriterTest.java
sed -i -e '/testMergeWithJsrReachableFromTwoDifferentPaths/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm-analysis/src/test/java/org/objectweb/asm/tree/analysis/BasicInterpreterTest.java
sed -i -e '/testSortLocalVariablesAndInstantiate()/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm-commons/src/test/java/org/objectweb/asm/commons/LocalVariablesSorterTest.java
2020-08-17 17:18:51 +08:00
mkdir -p asm-all
sed 's/@VERSION@/%{version}/g' %{SOURCE8} > asm-all/pom.xml
2020-02-25 12:59:48 +08:00
%pom_remove_dep org.ow2.asm:asm-test asm-test
%mvn_alias :asm-all org.ow2.asm:asm-debug-all
%mvn_package :asm-aggregator __noinstall
%mvn_package :asm-test __noinstall
%build
pushd tools/bnd-module-plugin
javac -sourcepath ../../asm/src/main/java/ -cp $(build-classpath aqute-bnd) $(find -name *.java)
jar cf bnd-module-plugin.jar -C src/main/java org
popd
2020-08-17 17:18:51 +08:00
%if %{with junit5}
2020-02-25 12:59:48 +08:00
%mvn_build -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
2020-08-17 17:18:51 +08:00
%else
%mvn_build -f -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%endif
2020-02-25 12:59:48 +08:00
%install
%mvn_install
2020-08-17 17:18:51 +08:00
%jpackage_script org.objectweb.asm.xml.Processor "" "" %{name}/asm:%{name}/asm-attrs:%{name}/asm-util %{name}-processor true
2020-02-25 12:59:48 +08:00
%files -f .mfiles
%license LICENSE.txt
%{_bindir}/%{name}-processor
2020-08-17 17:18:51 +08:00
%files javadoc -f .mfiles-javadoc
%license LICENSE.txt
2020-02-25 12:59:48 +08:00
%changelog
2020-08-17 17:18:51 +08:00
* Mon Aug 17 2020 wangyue <wangyue92@huawei.com> - 7.0-1
- upgrade the version to 7.0
2020-02-25 12:59:48 +08:00
* Tue Feb 25 2020 zhouyihang <zhouyihang1@huawei.com> - 6.2.1-3
- Package init