%global base_name antunit Name: ant-%{base_name} Version: 1.4.1 Release: 1 Summary: Provide antunit ant task License: Apache-2.0 URL: http://ant.apache.org/antlibs/antunit/ Source0: https://archive.apache.org/dist/ant/antlibs/%{base_name}/source/apache-%{name}-%{version}-src.tar.bz2 BuildArch: noarch BuildRequires: maven-local ant ant-junit ant-testutil %description The task drives the tests much like does for JUnit tests. When called on a build file, the task will start a new Ant project for that build file and scan for targets with names that start with "test". For each such target it then will: 1. Execute the target named setUp, if there is one. 2. Execute the target itself - if this target depends on other targets the normal Ant rules apply and the dependent targets are executed first. 3. Execute the target names tearDown, if there is one. %package javadoc Summary: Javadoc for %{name} %description javadoc This package contains the API documentation for %{name}. %prep %setup -q -n apache-%{name}-%{version} mv CONTRIBUTORS CONTRIBUTORS.orig iconv -f ISO-8859-1 -t UTF-8 CONTRIBUTORS.orig > CONTRIBUTORS touch -r CONTRIBUTORS.orig CONTRIBUTORS mv %{name}-%{version}.pom pom.xml %pom_xpath_inject pom:project/pom:build ' ${project.basedir}/src/main **/antlib.xml ' # EatYourOwnDogFoodTest sed -i 's|build/test-classes|target/test-classes|g' src/etc/testcases/antunit/java-io.xml # AssertTest sed -i 's|build/classes|target/classes|g' src/etc/testcases/assert.xml src/tests/junit/org/apache/ant/antunit/AssertTest.java %build %mvn_build -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8 %check # enable tests %pom_xpath_set pom:maven.test.skip false # compile tests xmvn test-compile -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8 # run tests java -cp target/classes:target/test-classes:$(build-classpath junit hamcrest ant/ant-testutil ant ant/ant-launcher) \ org.junit.runner.JUnitCore \ $(find src/tests/junit/ -name '*.java' -printf '%%P\n' | cut -f 1 -d '.' | tr / .) %install %mvn_file ":ant-antunit" ant/ant-antunit %mvn_install mkdir -p %{buildroot}%{_sysconfdir}/ant.d echo "ant/%{name}" > %{buildroot}%{_sysconfdir}/ant.d/%{base_name} %files -f .mfiles %license NOTICE %doc CONTRIBUTORS README README.html WHATSNEW %config(noreplace) %{_sysconfdir}/ant.d/%{base_name} %files javadoc -f .mfiles-javadoc %license NOTICE %changelog * Wed May 18 2022 Ge Wang - 1.4.1-1 - Upgrade to version 1.4.1 * Mon Sep 14 2020 chengzihan - 1.3-2 - Replace invalid url of Source0 * Fri Jul 24 2020 chengzihan - 1.3-1 - Package init