Bootstrap Maven as non-modular packages

Resolves: rhbz#1951482
This commit is contained in:
Mikolaj Izdebski 2021-06-08 20:17:56 +02:00
parent c9c95d6bf1
commit 3af8356e03
6 changed files with 182 additions and 48 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ junit3.8.2.zip
/r4.11.tar.gz
/junit-4.11-clean.tar.gz
/junit-4.12-clean.tar.gz
/junit-4.13.tar.gz
/junit-4.13.1.tar.gz

View File

@ -0,0 +1,108 @@
From 85c780b61cd35b4544d2926393805e1699641f38 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Fri, 6 Mar 2020 14:28:05 +0100
Subject: [PATCH] Port to hamcrest 2.2
---
.../org/junit/internal/matchers/StacktracePrintingMatcher.java | 3 ---
.../org/junit/internal/matchers/ThrowableCauseMatcher.java | 2 --
.../org/junit/internal/matchers/ThrowableMessageMatcher.java | 2 --
src/main/java/org/junit/matchers/JUnitMatchers.java | 2 +-
.../experimental/theories/runner/WithDataPointMethod.java | 2 +-
5 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
index 93a6827..3ea4a81 100644
--- a/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
+++ b/src/main/java/org/junit/internal/matchers/StacktracePrintingMatcher.java
@@ -1,7 +1,6 @@
package org.junit.internal.matchers;
import org.hamcrest.Description;
-import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.junit.internal.Throwables;
@@ -39,13 +38,11 @@ public class StacktracePrintingMatcher<T extends Throwable> extends
return Throwables.getStacktrace(throwable);
}
- @Factory
public static <T extends Throwable> Matcher<T> isThrowable(
Matcher<T> throwableMatcher) {
return new StacktracePrintingMatcher<T>(throwableMatcher);
}
- @Factory
public static <T extends Exception> Matcher<T> isException(
Matcher<T> exceptionMatcher) {
return new StacktracePrintingMatcher<T>(exceptionMatcher);
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
index 6e2ff5e..1f0a0a0 100644
--- a/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
+++ b/src/main/java/org/junit/internal/matchers/ThrowableCauseMatcher.java
@@ -1,7 +1,6 @@
package org.junit.internal.matchers;
import org.hamcrest.Description;
-import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@@ -43,7 +42,6 @@ public class ThrowableCauseMatcher<T extends Throwable> extends
* @param matcher to apply to the cause of the outer exception
* @param <T> type of the outer exception
*/
- @Factory
public static <T extends Throwable> Matcher<T> hasCause(final Matcher<?> matcher) {
return new ThrowableCauseMatcher<T>(matcher);
}
diff --git a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
index 74386a8..7d16b11 100644
--- a/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
+++ b/src/main/java/org/junit/internal/matchers/ThrowableMessageMatcher.java
@@ -1,7 +1,6 @@
package org.junit.internal.matchers;
import org.hamcrest.Description;
-import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@@ -30,7 +29,6 @@ public class ThrowableMessageMatcher<T extends Throwable> extends
matcher.describeMismatch(item.getMessage(), description);
}
- @Factory
public static <T extends Throwable> Matcher<T> hasMessage(final Matcher<String> matcher) {
return new ThrowableMessageMatcher<T>(matcher);
}
diff --git a/src/main/java/org/junit/matchers/JUnitMatchers.java b/src/main/java/org/junit/matchers/JUnitMatchers.java
index 13407cc..8889266 100644
--- a/src/main/java/org/junit/matchers/JUnitMatchers.java
+++ b/src/main/java/org/junit/matchers/JUnitMatchers.java
@@ -56,7 +56,7 @@ public class JUnitMatchers {
* @deprecated Please use {@link CoreMatchers#everyItem(Matcher)} instead.
*/
@Deprecated
- public static <T> Matcher<Iterable<T>> everyItem(final Matcher<T> elementMatcher) {
+ public static <T> Matcher<Iterable<? extends T>> everyItem(final Matcher<T> elementMatcher) {
return CoreMatchers.everyItem(elementMatcher);
}
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
index f2b2753..e5759ed 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
@@ -108,7 +108,7 @@ public class WithDataPointMethod {
return JUnitCore.runClasses(type).getFailures();
}
- private Matcher<Iterable<Failure>> empty() {
+ private Matcher<Iterable<? extends Failure>> empty() {
return everyItem(nullValue(Failure.class));
}
}
--
2.25.2

View File

@ -1,22 +0,0 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: ./create-tarball.sh VERSION"
exit 1
fi
VERSION=${1}
NAME="junit4"
wget https://github.com/${NAME}-team/${NAME}/archive/r${VERSION}.tar.gz
tar xvf r${VERSION}.tar.gz
(
cd ${NAME}-r${VERSION}
find . -name "*.jar" -delete
find . -name "*.class" -delete
)
tar czvf ${NAME}-${VERSION}-clean.tar.gz ${NAME}-r${VERSION}
rm -Rf ${NAME}-${VERSION}.tar.gz

22
generate-tarball.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
name=junit
version="$(sed -n 's/Version:\s*//p' *.spec)"
# RETRIEVE
wget "https://github.com/junit-team/junit/archive/r${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
rm -rf tarball-tmp
mkdir tarball-tmp
pushd tarball-tmp
tar -xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete
find -name '*.class' -delete
rm -r "junit4-r${version}/src/site"
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

View File

@ -1,23 +1,39 @@
# Workaround for rhbz#1969370: __bootstrap macro is not defined in
# CentOS Stream, See https://bugzilla.redhat.com/1969370
%global __bootstrap ~bootstrap
%bcond_without bootstrap
Name: junit
Epoch: 1
Version: 4.13
Release: 4%{?dist}
Version: 4.13.1
Release: 3%{?dist}
Summary: Java regression test package
License: EPL-1.0
URL: http://www.junit.org/
BuildArch: noarch
# ./clean-tarball.sh %%{version}
Source0: %{name}4-%{version}-clean.tar.gz
Source3: create-tarball.sh
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
Source1: generate-tarball.sh
Patch1: 0001-Port-to-hamcrest-2.2.patch
BuildRequires: maven-local
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin)
BuildRequires: mvn(org.hamcrest:hamcrest-core)
BuildRequires: mvn(org.hamcrest:hamcrest-library)
%endif
Obsoletes: %{name}-demo < 4.12
# For other packages, surefire-junit4 is normally pulled as transitive
# runtime dependency of junit, but junit doesn't build-depend on
# itself, so explicit BR on surefire-junit4 is needed.
%if %{without bootstrap}
BuildRequires: mvn(org.apache.maven.surefire:surefire-junit4)
%endif
%description
JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
@ -38,7 +54,12 @@ Summary: Javadoc for %{name}
Javadoc for %{name}.
%prep
%autosetup -n %{name}4-r%{version}
%setup -q -n junit4-r%{version}
%patch1 -p1
# InaccessibleBaseClassTest fails with Java 8
sed -i /InaccessibleBaseClassTest/d src/test/java/org/junit/tests/AllTests.java
%pom_remove_plugin :replacer
sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >src/main/java/junit/runner/Version.java
@ -65,24 +86,10 @@ sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >sr
</configuration>
</plugin>"
# Use compiler release flag when building on JDK >8 for correct cross-compiling
%pom_xpath_inject pom:profiles "
<profile>
<id>jdk-release-flag</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<maven.compiler.release>\${jdkVersion}</maven.compiler.release>
</properties>
</profile>"
%pom_xpath_set //pom:compilerVersion 1.8
%mvn_file : %{name}
%build
%mvn_build -- -DjdkVersion=8
%mvn_build -- -DjdkVersion=1.6
%install
%mvn_install
@ -99,12 +106,19 @@ sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >sr
%doc doc/*
%changelog
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:4.13-4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1:4.13.1-3
- Bootstrap Maven for CentOS Stream 9
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1:4.13.1-2
- Bootstrap build
- Non-bootstrap build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Dec 4 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.13.1-1
- Update to upstream version 4.13.1
* Sun Aug 16 2020 Fabio Valentini <decathorpe@gmail.com> - 1:4.13-2
- Bump release to account for previously untagged 4.13-1.fc33 build.
@ -127,12 +141,21 @@ sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >sr
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 1:4.12-14
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Fri Mar 06 2020 Marian Koncek <mkoncek@redhat.com> - 4.13-1
- Update to upstream version 4.13
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.12-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.12-11
- Mass rebuild for javapackages-tools 201902
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.12-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1:4.12-10
- Mass rebuild for javapackages-tools 201901
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.12-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
@ -296,6 +319,7 @@ sed s/@version@/%{version}/ src/main/java/junit/runner/Version.java.template >sr
* Mon Aug 23 2004 Randy Watler <rwatler at finali.com> - 0:3.8.1-4jpp
- Rebuild with ant-1.6.2
* Fri May 09 2003 David Walluck <david@anti-microsoft.org> 0:3.8.1-3jpp
- update for JPackage 1.5

View File

@ -1 +1 @@
SHA512 (junit4-4.13-clean.tar.gz) = a5ca6378dd50d912ad77893c6435e9e6f9500e5bc0dda811a68741a7055bfbd990c4075f7e43e8027568fa5d2ffb4579a76fd11dda86e26f52032f91674af87e
SHA512 (junit-4.13.1.tar.gz) = 53eb0ab9278bb792b8e5f7978d3d47f52d6e94898fbf77286f7d4836cdb78aac4f0db111c146373e2591feb9c8600193d09c146a6befa56029c06324e444ecfc