objectweb-asm/objectweb-asm.spec
2022-05-31 09:22:03 +08:00

124 lines
5.4 KiB
RPMSpec

%bcond_without junit5
%bcond_without osgi
Name: objectweb-asm
Version: 8.0.1
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
Patch0: 0001-Revert-upstream-change-2a58bc9.patch
Patch1: 0002-Catch-CompileException-in-test.patch
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
%description
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.
%package javadoc
Summary: API documentation for %{name}
%description javadoc
This package provides %{summary}.
%prep
%autosetup -n %{name}-%{version} -p1
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}
%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
%endif
%if %{with osgi}
if [ "$pom" != "asm-test" ] ; then
# Make into OSGi bundles
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
%endif
done
sed -i -e '/testToByteArray_computeMaxs_largeSubroutines/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm/src/test/java/org/objectweb/asm/ClassWriterTest.java
sed -i -e '/testAnalyze_mergeWithJsrReachableFromTwoDifferentPaths/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm-analysis/src/test/java/org/objectweb/asm/tree/analysis/AnalyzerWithBasicInterpreterTest.java
sed -i -e '/testAllMethods_issue317586()/i@org.junit.jupiter.api.Disabled("missing class file")' \
asm-commons/src/test/java/org/objectweb/asm/commons/LocalVariablesSorterTest.java
# Remove failing test SerialVersionUidAdderTest due to missing class files
rm asm-commons/src/test/java/org/objectweb/asm/commons/SerialVersionUidAdderTest.java
mkdir -p asm-all
sed 's/@VERSION@/%{version}/g' %{SOURCE8} > asm-all/pom.xml
%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
%if %{with junit5}
%mvn_build -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%else
%mvn_build -f -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%endif
%install
%mvn_install
%jpackage_script org.objectweb.asm.xml.Processor "" "" %{name}/asm:%{name}/asm-attrs:%{name}/asm-util %{name}-processor true
%files -f .mfiles
%license LICENSE.txt
%{_bindir}/%{name}-processor
%files javadoc -f .mfiles-javadoc
%license LICENSE.txt
%changelog
* Tue May 31 2022 yaoxin <yaoxin30@h-partners.com> - 8.0.1-1
- Update to 8.0.1
* Mon Aug 17 2020 wangyue <wangyue92@huawei.com> - 7.0-1
- upgrade the version to 7.0
* Tue Feb 25 2020 zhouyihang <zhouyihang1@huawei.com> - 6.2.1-3
- Package init