0f9283
# Component versions, taken from gradle.properties
0f9283
%global platform_version 1.%(v=%{version}; echo ${v:2})
0f9283
%global jupiter_version %{version}
0f9283
%global vintage_version %{version}
0f9283
0f9283
# Build with or without the console modules
0f9283
# Disabled by default due to missing dep: info.picocli:picocli
0f9283
%bcond_with console
0f9283
0f9283
Name:           junit5
0f9283
Version:        5.4.0
0f9283
Release:        1%{?dist}
0f9283
Summary:        Java regression testing framework
0f9283
License:        EPL-2.0
0f9283
URL:            http://junit.org/junit5/
0f9283
BuildArch:      noarch
0f9283
0f9283
Source0:        https://github.com/junit-team/junit5/archive/r%{version}/junit5-%{version}.tar.gz
0f9283
0f9283
# Aggregator POM (used for packaging only)
0f9283
Source100:      aggregator.pom
0f9283
# Platform POMs
0f9283
Source200:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/%{platform_version}/junit-platform-commons-%{platform_version}.pom
0f9283
Source201:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console/%{platform_version}/junit-platform-console-%{platform_version}.pom
0f9283
Source202:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/%{platform_version}/junit-platform-console-standalone-%{platform_version}.pom
0f9283
Source203:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/%{platform_version}/junit-platform-engine-%{platform_version}.pom
0f9283
Source205:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-launcher/%{platform_version}/junit-platform-launcher-%{platform_version}.pom
0f9283
Source206:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-runner/%{platform_version}/junit-platform-runner-%{platform_version}.pom
0f9283
Source207:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-suite-api/%{platform_version}/junit-platform-suite-api-%{platform_version}.pom
0f9283
Source208:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-reporting/%{platform_version}/junit-platform-reporting-%{platform_version}.pom
0f9283
# Jupiter POMs
0f9283
Source301:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/%{jupiter_version}/junit-jupiter-api-%{jupiter_version}.pom
0f9283
Source302:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/%{jupiter_version}/junit-jupiter-engine-%{jupiter_version}.pom
0f9283
Source303:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-migrationsupport/%{jupiter_version}/junit-jupiter-migrationsupport-%{jupiter_version}.pom
0f9283
Source304:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/%{jupiter_version}/junit-jupiter-params-%{jupiter_version}.pom
0f9283
# Vintage POM
0f9283
Source400:      https://repo1.maven.org/maven2/org/junit/vintage/junit-vintage-engine/%{vintage_version}/junit-vintage-engine-%{vintage_version}.pom
0f9283
0f9283
BuildRequires:  maven-local
0f9283
BuildRequires:  mvn(com.univocity:univocity-parsers)
0f9283
BuildRequires:  mvn(junit:junit)
0f9283
BuildRequires:  mvn(org.apache.felix:maven-bundle-plugin)
0f9283
BuildRequires:  mvn(org.apiguardian:apiguardian-api)
0f9283
BuildRequires:  mvn(org.opentest4j:opentest4j)
0f9283
0f9283
%if %{with console}
0f9283
BuildRequires:  mvn(info.picocli:picocli)
0f9283
%endif
0f9283
0f9283
BuildRequires:  asciidoc
0f9283
0f9283
%if %{with console}
0f9283
# Explicit requires for javapackages-tools since junit5 script
0f9283
# uses /usr/share/java-utils/java-functions
0f9283
Requires:       javapackages-tools
0f9283
%endif
0f9283
0f9283
%description
0f9283
JUnit is a popular regression testing framework for Java platform.
0f9283
0f9283
%package javadoc
0f9283
Summary:        Javadoc for %{name}
0f9283
0f9283
%description javadoc
0f9283
Junit5 API documentation.
0f9283
0f9283
%package guide
0f9283
Summary:        Documentation for %{name}
0f9283
Requires:       %{name}-javadoc = %{version}-%{release}
0f9283
0f9283
%description guide
0f9283
JUnit 5 User Guide.
0f9283
0f9283
%prep
0f9283
%setup -q -n %{name}-r%{version}
0f9283
find -name \*.jar -delete
0f9283
0f9283
cp -p %{SOURCE100} pom.xml
0f9283
cp -p %{SOURCE200} junit-platform-commons/pom.xml
0f9283
cp -p %{SOURCE201} junit-platform-console/pom.xml
0f9283
cp -p %{SOURCE202} junit-platform-console-standalone/pom.xml
0f9283
cp -p %{SOURCE203} junit-platform-engine/pom.xml
0f9283
cp -p %{SOURCE205} junit-platform-launcher/pom.xml
0f9283
cp -p %{SOURCE206} junit-platform-runner/pom.xml
0f9283
cp -p %{SOURCE207} junit-platform-suite-api/pom.xml
0f9283
cp -p %{SOURCE208} junit-platform-reporting/pom.xml
0f9283
cp -p %{SOURCE301} junit-jupiter-api/pom.xml
0f9283
cp -p %{SOURCE302} junit-jupiter-engine/pom.xml
0f9283
cp -p %{SOURCE303} junit-jupiter-migrationsupport/pom.xml
0f9283
cp -p %{SOURCE304} junit-jupiter-params/pom.xml
0f9283
cp -p %{SOURCE400} junit-vintage-engine/pom.xml
0f9283
0f9283
for pom in $(find -mindepth 2 -name pom.xml); do
0f9283
    # Set parent to aggregator
0f9283
    %pom_xpath_inject pom:project "<parent><groupId>org.fedoraproject.xmvn.junit5</groupId><artifactId>aggregator</artifactId><version>1.0.0</version></parent>" $pom
0f9283
    # OSGi BSN
0f9283
    bsn=$(sed 's|/pom.xml$||;s|.*/|org.|;s|-|.|g' <<<"$pom")
0f9283
    %pom_xpath_inject pom:project "<properties><osgi.bsn>${bsn}</osgi.bsn></properties>" $pom
0f9283
    # Incorrect scope - API guardian is just annotation, needed only during compilation
0f9283
    %pom_xpath_set -f "pom:dependency[pom:artifactId='apiguardian-api']/pom:scope" provided $pom
0f9283
done
0f9283
0f9283
# Add deps which are shaded by upstream and therefore not present in POMs.
0f9283
%pom_add_dep net.sf.jopt-simple:jopt-simple:5.0.4 junit-platform-console
0f9283
%pom_add_dep com.univocity:univocity-parsers:2.5.4 junit-jupiter-params
0f9283
0f9283
# Incorrect scope - Junit4 is needed for compilation too, not only runtime.
0f9283
%pom_xpath_set "pom:dependency[pom:artifactId='junit']/pom:scope" compile junit-vintage-engine
0f9283
0f9283
%if %{without console}
0f9283
# Disable the console modules
0f9283
%pom_disable_module junit-platform-console
0f9283
%pom_disable_module junit-platform-console-standalone
0f9283
%endif
0f9283
0f9283
%mvn_package :aggregator __noinstall
0f9283
0f9283
%build
0f9283
%mvn_build -f
0f9283
0f9283
# Build docs.  Ignore exit asciidoc -- it fails for some reason, but
0f9283
# still produces readable docs.
0f9283
asciidoc documentation/src/docs/asciidoc/index.adoc || :
0f9283
ln -s ../../javadoc/junit5 documentation/src/docs/api
0f9283
0f9283
%install
0f9283
%mvn_install
0f9283
0f9283
%if %{with console}
0f9283
%jpackage_script org/junit/platform/console/ConsoleLauncher "" "" junit5:junit:opentest4j:jopt-simple %{name} true
0f9283
%endif
0f9283
0f9283
%files -f .mfiles
0f9283
%if %{with console}
0f9283
%{_bindir}/%{name}
0f9283
%endif
0f9283
%license LICENSE.md LICENSE-notice.md
0f9283
0f9283
%files javadoc -f .mfiles-javadoc
0f9283
%license LICENSE.md LICENSE-notice.md
0f9283
0f9283
%files guide
0f9283
%doc documentation/src/docs/*
0f9283
0f9283
%changelog
0f9283
* Wed Mar 06 2019 Mat Booth <mat.booth@redhat.com> - 5.4.0-1
0f9283
- Update to latest upstream release
0f9283
- License switched to EPL only now the surefire provider was moved to the
0f9283
  Apache Surefire project
0f9283
0f9283
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.1-2
0f9283
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
0f9283
0f9283
* Tue Sep 11 2018 Mat Booth <mat.booth@redhat.com> - 5.3.1-1
0f9283
- Update to latest upstream release
0f9283
- Conditionally build the console modules
0f9283
- Remove stuff for discontinued gradle plugin
0f9283
0f9283
* Fri Aug 31 2018 Severin Gehwolf <sgehwolf@redhat.com> - 5.2.0-3
0f9283
- Add explicit requirement on javapackages-tools since junit5 script
0f9283
  uses java-functions. See RHBZ#1600426.
0f9283
0f9283
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.2.0-2
0f9283
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
0f9283
0f9283
* Wed Jun 27 2018 Mat Booth <mat.booth@redhat.com> - 5.2.0-1
0f9283
- Update to latest upstream release
0f9283
0f9283
* Wed Jun 27 2018 Mat Booth <mat.booth@redhat.com> - 5.0.0-4
0f9283
- Add java 9 automatic module name headers to jar files
0f9283
- License correction EPL -> EPL-2.0
0f9283
0f9283
* Thu Mar 15 2018 Michael Simacek <msimacek@redhat.com> - 5.0.0-3
0f9283
- Disable gradle plugin to fix FTBFS
0f9283
0f9283
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-2
0f9283
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
0f9283
0f9283
* Thu Sep 14 2017 Mikolaj Izdebski <mizdebsk@redhat.com> - 5.0.0-1
0f9283
- Initial packaging