Re-add support for junit5

This commit is contained in:
Mikolaj Izdebski 2019-04-10 16:05:46 +02:00
parent 7524df7a04
commit b7dcde0b3e

View File

@ -28,9 +28,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# Disabled for now, asi it doesn't work (tests fail) and nobody needs it
%global ant_home %{_datadir}/ant %global ant_home %{_datadir}/ant
Name: ant Name: ant
@ -72,6 +69,7 @@ BuildRequires: mvn(xml-resolver:xml-resolver)
BuildRequires: mvn(org.hamcrest:hamcrest-core) BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.hamcrest:hamcrest-library) BuildRequires: mvn(org.hamcrest:hamcrest-library)
BuildRequires: junit5
# Theoretically Ant might be usable with just JRE, but typical Ant # Theoretically Ant might be usable with just JRE, but typical Ant
# workflow requires full JDK, so we recommend it here. # workflow requires full JDK, so we recommend it here.
@ -273,6 +271,15 @@ Optional junit tasks for %{name}.
%description junit -l fr %description junit -l fr
Taches junit optionelles pour %{name}. Taches junit optionelles pour %{name}.
%package junit5
Summary: Optional junit5 tasks for %{name}
Requires: %{name} = %{version}-%{release}
%description junit5
Optional junit5 tasks for %{name}.
%description junit5 -l fr
Taches junit5 optionelles pour %{name}.
%package testutil %package testutil
Summary: Test utility classes for %{name} Summary: Test utility classes for %{name}
@ -328,7 +335,7 @@ rm src/tests/junit/org/apache/tools/ant/types/selectors/SignedSelectorTest.java
src/tests/junit/org/apache/tools/mail/MailMessageTest.java src/tests/junit/org/apache/tools/mail/MailMessageTest.java
#install jars #install jars
build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit log4j-1 oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java build-jar-repository -s -p lib/optional antlr bcel javamail/mailapi jdepend junit log4j-1 oro regexp bsf commons-logging commons-net jsch xalan-j2 xml-commons-resolver xalan-j2-serializer hamcrest/core hamcrest/library xz-java junit5 opentest4j
# fix hardcoded paths in ant script and conf # fix hardcoded paths in ant script and conf
cp -p %{SOURCE2} %{name}.conf cp -p %{SOURCE2} %{name}.conf
@ -351,8 +358,6 @@ mv LICENSE.utf8 LICENSE
# We want a hard dep on antlr # We want a hard dep on antlr
%pom_xpath_remove pom:optional src/etc/poms/ant-antlr/pom.xml %pom_xpath_remove pom:optional src/etc/poms/ant-antlr/pom.xml
%pom_xpath_inject 'target[@name="javadocs"]/javadoc/packageset' '<exclude name="**/junitlauncher"/>' build.xml
%build %build
%{ant} jars test-jar %{ant} jars test-jar
@ -365,7 +370,6 @@ xmlto man man/%{name}.xml -o man
#remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests. #remove empty jai and netrexx jars. Due to missing dependencies they contain only manifests.
rm -fr build/lib/ant-jai.jar build/lib/ant-netrexx.jar rm -fr build/lib/ant-jai.jar build/lib/ant-netrexx.jar
rm -f build/lib/ant-junitlauncher.jar
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
%install %install
@ -445,10 +449,10 @@ echo "jdepend ant/ant-jdepend" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jdepend
echo "jsch ant/ant-jsch" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jsch echo "jsch ant/ant-jsch" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/jsch
echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit echo "junit hamcrest/core ant/ant-junit" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit
echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4 echo "junit hamcrest/core ant/ant-junit4" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junit4
echo "junit5 hamcrest/core junit opentest4j ant/ant-junitlauncher" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/junitlauncher
echo "testutil ant/ant-testutil" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/testutil echo "testutil ant/ant-testutil" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/testutil
echo "xz-java ant/ant-xz" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/xz echo "xz-java ant/ant-xz" > $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.d/xz
# javadoc # javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name} mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} cp -pr build/javadocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
@ -566,6 +570,9 @@ LC_ALL=en_US.utf8 %{ant} test
%{ant_home}/etc/junit-frames-saxon.xsl %{ant_home}/etc/junit-frames-saxon.xsl
%{ant_home}/etc/junit-noframes-saxon.xsl %{ant_home}/etc/junit-noframes-saxon.xsl
%files junit5 -f .mfiles-junitlauncher
%{ant_home}/lib/%{name}-junitlauncher.jar
%config(noreplace) %{_sysconfdir}/%{name}.d/junitlauncher
%files testutil -f .mfiles-testutil %files testutil -f .mfiles-testutil
%{ant_home}/lib/%{name}-testutil.jar %{ant_home}/lib/%{name}-testutil.jar