8ea29a4
# Component versions, taken from gradle.properties
8ea29a4
%global platform_version 1.0.0
8ea29a4
%global jupiter_version 5.0.0
8ea29a4
%global vintage_version 4.12.0
8ea29a4
8ea29a4
# Build with or without Gradle plugin.
8ea29a4
# NOTE: We are always building junit5 using Maven.
8ea29a4
%bcond_without gradle
8ea29a4
8ea29a4
Name:           junit5
8ea29a4
Version:        5.0.0
8ea29a4
Release:        1%{?dist}
8ea29a4
Summary:        Java regression testing framework
8ea29a4
# junit-platform-surefire-provider is under ASL 2.0, all other modules use EPL (see LICENSE.md)
8ea29a4
License:        EPL and ASL v2.0
8ea29a4
URL:            http://junit.org/junit5/
8ea29a4
BuildArch:      noarch
8ea29a4
8ea29a4
Source0:        https://github.com/junit-team/junit5/archive/r%{version}.tar.gz
8ea29a4
8ea29a4
# Aggregator POM (used for packaging only)
8ea29a4
Source100:      aggregator.pom
8ea29a4
# Platform POMs
8ea29a4
Source200:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-commons/%{platform_version}/junit-platform-commons-%{platform_version}.pom
8ea29a4
Source201:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console/%{platform_version}/junit-platform-console-%{platform_version}.pom
8ea29a4
Source202:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/%{platform_version}/junit-platform-console-standalone-%{platform_version}.pom
8ea29a4
Source203:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-engine/%{platform_version}/junit-platform-engine-%{platform_version}.pom
8ea29a4
Source204:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-gradle-plugin/%{platform_version}/junit-platform-gradle-plugin-%{platform_version}.pom
8ea29a4
Source205:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-launcher/%{platform_version}/junit-platform-launcher-%{platform_version}.pom
8ea29a4
Source206:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-runner/%{platform_version}/junit-platform-runner-%{platform_version}.pom
8ea29a4
Source207:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-suite-api/%{platform_version}/junit-platform-suite-api-%{platform_version}.pom
8ea29a4
Source208:      https://repo1.maven.org/maven2/org/junit/platform/junit-platform-surefire-provider/%{platform_version}/junit-platform-surefire-provider-%{platform_version}.pom
8ea29a4
# Jupiter POMs
8ea29a4
Source301:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/%{jupiter_version}/junit-jupiter-api-%{jupiter_version}.pom
8ea29a4
Source302:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/%{jupiter_version}/junit-jupiter-engine-%{jupiter_version}.pom
8ea29a4
Source303:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-migrationsupport/%{jupiter_version}/junit-jupiter-migrationsupport-%{jupiter_version}.pom
8ea29a4
Source304:      https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-params/%{jupiter_version}/junit-jupiter-params-%{jupiter_version}.pom
8ea29a4
# Vintage POM
8ea29a4
Source400:      https://repo1.maven.org/maven2/org/junit/vintage/junit-vintage-engine/%{vintage_version}/junit-vintage-engine-%{vintage_version}.pom
8ea29a4
8ea29a4
BuildRequires:  maven-local
8ea29a4
BuildRequires:  mvn(com.univocity:univocity-parsers)
8ea29a4
BuildRequires:  mvn(junit:junit)
8ea29a4
BuildRequires:  mvn(net.sf.jopt-simple:jopt-simple)
8ea29a4
BuildRequires:  mvn(org.apache.maven.surefire:common-java5)
8ea29a4
BuildRequires:  mvn(org.apache.maven.surefire:surefire-api)
8ea29a4
BuildRequires:  mvn(org.apiguardian:apiguardian-api)
8ea29a4
BuildRequires:  mvn(org.opentest4j:opentest4j)
8ea29a4
8ea29a4
%if %{with gradle}
8ea29a4
BuildRequires:  mvn(org.codehaus.gmavenplus:gmavenplus-plugin)
8ea29a4
BuildRequires:  mvn(org.codehaus.groovy:groovy-all)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-base-services)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-base-services-groovy)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-core)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-language-jvm)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-model-core)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-platform-base)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-platform-jvm)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-plugins)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-reporting)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-testing-base)
8ea29a4
BuildRequires:  mvn(org.gradle:gradle-testing-jvm)
8ea29a4
BuildRequires:  mvn(org.slf4j:slf4j-api)
8ea29a4
%endif
8ea29a4
8ea29a4
BuildRequires:  asciidoc
8ea29a4
8ea29a4
%description
8ea29a4
JUnit is a popular regression testing framework for Java platform.
8ea29a4
8ea29a4
%package javadoc
8ea29a4
Summary:        Javadoc for %{name}
8ea29a4
8ea29a4
%description javadoc
8ea29a4
Junit5 API documentation.
8ea29a4
8ea29a4
%package guide
8ea29a4
Summary:        Documentation for %{name}
8ea29a4
Requires:       %{name}-javadoc = %{version}-%{release}
8ea29a4
8ea29a4
%description guide
8ea29a4
JUnit 5 User Guide.
8ea29a4
8ea29a4
%prep
8ea29a4
%setup -q -n %{name}-r%{version}
1898161
find -name \*.jar -delete
8ea29a4
8ea29a4
cp -p junit-jupiter-api/LICENSE.md LICENSE-Eclipse.md
8ea29a4
cp -p junit-platform-surefire-provider/LICENSE.md LICENSE-Apache.md
8ea29a4
8ea29a4
cp -p %{SOURCE100} pom.xml
8ea29a4
cp -p %{SOURCE200} junit-platform-commons/pom.xml
8ea29a4
cp -p %{SOURCE201} junit-platform-console/pom.xml
8ea29a4
cp -p %{SOURCE202} junit-platform-console-standalone/pom.xml
8ea29a4
cp -p %{SOURCE203} junit-platform-engine/pom.xml
8ea29a4
cp -p %{SOURCE204} junit-platform-gradle-plugin/pom.xml
8ea29a4
cp -p %{SOURCE205} junit-platform-launcher/pom.xml
8ea29a4
cp -p %{SOURCE206} junit-platform-runner/pom.xml
8ea29a4
cp -p %{SOURCE207} junit-platform-suite-api/pom.xml
8ea29a4
cp -p %{SOURCE208} junit-platform-surefire-provider/pom.xml
8ea29a4
cp -p %{SOURCE301} junit-jupiter-api/pom.xml
8ea29a4
cp -p %{SOURCE302} junit-jupiter-engine/pom.xml
8ea29a4
cp -p %{SOURCE303} junit-jupiter-migrationsupport/pom.xml
8ea29a4
cp -p %{SOURCE304} junit-jupiter-params/pom.xml
8ea29a4
cp -p %{SOURCE400} junit-vintage-engine/pom.xml
8ea29a4
8ea29a4
for pom in $(find -mindepth 2 -name pom.xml); do
8ea29a4
    # Set parent to aggregator
8ea29a4
    %pom_xpath_inject pom:project "<parent><groupId>org.fedoraproject.xmvn.junit5</groupId><artifactId>aggregator</artifactId><version>1.0.0</version></parent>" $pom
8ea29a4
    # OSGi BSN
8ea29a4
    bsn=$(sed 's|/pom.xml$||;s|.*/|org.|;s|-|.|g' <<<"$pom")
8ea29a4
    %pom_xpath_inject pom:project "<properties><osgi.bsn>${bsn}</osgi.bsn></properties>" $pom
8ea29a4
    # Incorrect scope - API guardian is just annotation, needed only during compilation
8ea29a4
    %pom_xpath_set -r "pom:dependency[pom:artifactId='apiguardian-api']/pom:scope" provided $pom
8ea29a4
done
8ea29a4
8ea29a4
# Add deps which are shaded by upstream and therefore not present in POMs.
8ea29a4
%pom_add_dep net.sf.jopt-simple:jopt-simple:5.0.4 junit-platform-console
8ea29a4
%pom_add_dep com.univocity:univocity-parsers:2.5.4 junit-jupiter-params
8ea29a4
8ea29a4
# Incorrect scope - whoever needs Surefire provider will have to depend on Surefire.
8ea29a4
%pom_xpath_set "pom:dependency[pom:groupId='org.apache.maven.surefire']/pom:scope" provided junit-platform-surefire-provider
8ea29a4
8ea29a4
# Incorrect scope - Junit4 is needed for compilation too, not only runtime.
8ea29a4
%pom_xpath_set "pom:dependency[pom:artifactId='junit']/pom:scope" compile junit-vintage-engine
8ea29a4
8ea29a4
%if %{with gradle}
8ea29a4
8ea29a4
# Gradle plugin is written in Groovy, so compile it with GMavenPlus.
8ea29a4
%pom_xpath_inject pom:project "<build><plugins><plugin><groupId>org.codehaus.gmavenplus</groupId><artifactId>gmavenplus-plugin</artifactId><version>1.6</version><executions><execution><goals><goal>compile</goal></goals></execution></executions></plugin></plugins></build>" junit-platform-gradle-plugin
8ea29a4
8ea29a4
# Gradle deps are only for compilation, and therefore not included in POM.
8ea29a4
%pom_add_dep org.codehaus.groovy:groovy-all::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-base-services-groovy::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-base-services::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-core::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-language-jvm::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-model-core::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-platform-base::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-platform-jvm::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-plugins::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-reporting::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-testing-base::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.gradle:gradle-testing-jvm::provided junit-platform-gradle-plugin
8ea29a4
%pom_add_dep org.slf4j:slf4j-api::provided junit-platform-gradle-plugin
8ea29a4
8ea29a4
%else
8ea29a4
%pom_disable_module junit-platform-gradle-plugin
8ea29a4
%endif
8ea29a4
8ea29a4
%mvn_package :aggregator __noinstall
8ea29a4
8ea29a4
%build
8ea29a4
%mvn_build -f
8ea29a4
8ea29a4
# Build docs.  Ignore exit asciidoc -- it fails for some reason, but
8ea29a4
# still produces readable docs.
8ea29a4
asciidoc documentation/src/docs/asciidoc/index.adoc || :
8ea29a4
ln -s ../../javadoc/junit5 documentation/src/docs/api
8ea29a4
8ea29a4
%install
8ea29a4
%mvn_install
8ea29a4
8ea29a4
%jpackage_script org/junit/platform/console/ConsoleLauncher "" "" junit5:junit:opentest4j:jopt-simple %{name} true
8ea29a4
8ea29a4
%files -f .mfiles
8ea29a4
%{_bindir}/%{name}
8ea29a4
%license LICENSE.md LICENSE-Eclipse.md LICENSE-Apache.md
8ea29a4
8ea29a4
%files javadoc -f .mfiles-javadoc
8ea29a4
%license LICENSE.md LICENSE-Eclipse.md LICENSE-Apache.md
8ea29a4
8ea29a4
%files guide
8ea29a4
%doc documentation/src/docs/*
8ea29a4
8ea29a4
%changelog
8ea29a4
* Thu Sep 14 2017 Mikolaj Izdebski <mizdebsk@redhat.com> - 5.0.0-1
8ea29a4
- Initial packaging