Fridrich Strba 2018-12-26 06:32:28 +00:00 committed by Git OBS Bridge
parent 73f1a50857
commit f2128f2da9
9 changed files with 398 additions and 214 deletions

367
build.xml Normal file
View File

@ -0,0 +1,367 @@
<project name="junit" default="dist" basedir="."
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<tstamp />
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property file="${user.home}/.junit.properties" />
<property name="src" value="src/main/java" />
<property name="target" location="target" />
<property name="bin" location="${target}/main" />
<property name="version-base" value="4.12" />
<property name="version-status" value="-SNAPSHOT" />
<property name="version" value="${version-base}${version-status}" />
<property name="dist" value="junit${version}" />
<property name="versionfile" value="${src}/junit/runner/Version.java" />
<property name="zipfile" value="${dist}/${dist}.zip" />
<property name="testsrc" location="src/test/java" />
<property name="testrsrc" location="src/test/resources" />
<property name="testbin" location="${target}/test/java" />
<property name="unjarred"
value="**/*.jar, ${testfiles}, doc/**, README.html, .classpath, .project, cpl-v10.html" />
<property name="binjar" value="junit-${version}.jar" />
<property name="srcjar" value="junit-${version}-src.jar" />
<property name="docjar" value="junit-${version}-javadoc.jar" />
<property name="depjar" value="junit-dep-${version}.jar" />
<property name="depsrcjar" value="junit-dep-${version}-src.jar" />
<property name="depdocjar" value="junit-dep-${version}-javadoc.jar" />
<property name="javadocdir" location="${dist}/javadoc" />
<property name="javadoczip" location="${dist}-javadoc.zip" />
<property name="hamcrestlib" location="lib/hamcrest-core-1.3.jar" />
<property name="hamcrestlibsources" location="lib/hamcrest-core-1.3-sources.jar" />
<property name="hamcrestsrc" location="${dist}/temp.hamcrest.source" />
<property name="maven.deploy.goal" value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<target name="init">
<tstamp/>
</target>
<target name="versiontag" depends="init">
<filter token="version" value="${version}" />
<copy
file="${versionfile}.template"
tofile="${versionfile}"
filtering="on"
overwrite="true"
/>
</target>
<target name="clean">
<!-- If two builds are made within a minute -->
<delete dir="${dist}" quiet="true" />
<!-- Delete all previous temporary build artifacts -->
<delete dir="${target}" quiet="true" />
<delete file="${zipfile}" quiet="true"/>
<delete file="${javadoczip}" />
</target>
<macrodef name="junit_compilation">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="classpath"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac
srcdir="@{srcdir}"
destdir="@{destdir}"
debug="on"
classpath="@{classpath}"
includeantruntime="false"
source="1.6"
target="1.6"
>
<compilerarg value="-Xlint:unchecked" />
</javac>
</sequential>
</macrodef>
<target name="build" depends="versiontag">
<junit_compilation srcdir="${src}" destdir="${bin}" classpath="${hamcrestlib}"/>
<unjar src="${hamcrestlib}" dest="${bin}" />
<junit_compilation srcdir="${testsrc}" destdir="${testbin}" classpath="${hamcrestlib};${bin}"/>
</target>
<target name="jars" depends="build">
<mkdir dir="${dist}" />
<jar
jarfile="${dist}/${srcjar}"
basedir="${src}"
excludes="${unjarred}, **/*.class"
/>
<jar
jarfile="${dist}/${binjar}"
basedir="${bin}"
excludes="${unjarred}, **/*.java, build.xml"
/>
<jar
jarfile="${dist}/${depjar}"
basedir="${bin}"
excludes="${unjarred}, org/hamcrest/**, **/*.java, build.xml"
/>
</target>
<target name="all.maven.jars" depends="jars,javadoc">
<mkdir dir="${dist}" />
<jar
jarfile="${dist}/${depsrcjar}"
basedir="${src}"
excludes="${unjarred}, **/*.class"
/>
<jar
jarfile="${dist}/${depdocjar}"
basedir="${javadocdir}"
excludes="${unjarred}, org/hamcrest/**"
/>
</target>
<target name="samples-and-tests">
<copy todir="${dist}">
<fileset dir="${testbin}" />
<fileset dir="${testsrc}" />
<fileset dir="${testrsrc}" />
</copy>
</target>
<target name="javadoc">
<javadoc destdir="${javadocdir}"
source="1.6"
author="false"
version="false"
use="false"
windowtitle="JUnit API"
>
<excludepackage name="junit.*" />
<excludepackage name="org.junit.internal.*" />
<excludepackage name="org.junit.experimental.theories.internal.*" />
<sourcepath location="${src}" />
<sourcepath location="${hamcrestsrc}" />
</javadoc>
</target>
<target name="javadoczip">
<delete file="${javadoczip}" />
<antcall target="javadoc" />
<zip basedir="${javadocdir}" file="${javadoczip}" />
</target>
<target name="populate-dist"
depends="clean, build, jars, samples-and-tests, javadoc"
>
<copy todir="${dist}/doc">
<fileset dir="doc"/>
</copy>
<copy file="README.md" tofile="${dist}/README.md" />
<copy file="BUILDING" tofile="${dist}/BUILDING" />
<copy file="epl-v10.html" tofile="${dist}/epl-v10.html" />
<copy file="build.xml" tofile="${dist}/build.xml" />
</target>
<macrodef name="run-dist-tests">
<!-- Runs the tests against the built jar files -->
<element name="extra-args" implicit="yes" />
<sequential>
<java classname="org.junit.runner.JUnitCore" fork="yes" failonerror="true">
<extra-args />
<arg value="org.junit.tests.AllTests"/>
<classpath>
<pathelement location="${dist}" />
<pathelement location="${dist}/${binjar}" />
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="run-local-tests">
<!-- Runs the tests against the local class files -->
<sequential>
<java classname="org.junit.runner.JUnitCore" fork="yes" failonerror="true">
<arg value="org.junit.tests.AllTests"/>
<classpath>
<pathelement location="${bin}" />
<pathelement location="${testbin}" />
<pathelement location="${hamcrestlib}" />
</classpath>
</java>
</sequential>
</macrodef>
<target name="test" depends="build">
<run-local-tests />
</target>
<target name="dist" depends="populate-dist">
<run-dist-tests>
<jvmarg value="-Dignore.this=ignored"/>
</run-dist-tests>
</target>
<target name="profile" depends="populate-dist">
<run-dist-tests>
<jvmarg value="-agentlib:hprof=cpu=samples"/>
</run-dist-tests>
</target>
<target name="zip" depends="dist">
<zip zipfile="${zipfile}" basedir="." includes="${dist}/**" />
</target>
<target name="upload.to.sourceforge" depends="zip">
<ftp server="upload.sourceforge.net"
userid="anonymous"
password="saff@mit.edu"
remotedir="incoming"
>
<fileset dir="${dist}" includes="*.jar" />
<fileset file="${zipfile}" />
</ftp>
<echo message="To upload docs, use build/upload_docs.sh" />
</target>
<!-- to do automatic build upload, you need the maven ant tasks jar. -->
<!-- therefore, you must run ant as ant -lib build/lib stage.maven -->
<macrodef name="push.maven.artifact">
<attribute name="file" />
<attribute name="pom" />
<attribute name="packaging" />
<attribute name="url" />
<attribute name="repo.id" />
<element name="artifact.args" implicit="true" optional="true" />
<sequential>
<artifact:mvn failonerror="true">
<arg value="${maven.deploy.goal}" />
<arg value="-Durl=@{url}" />
<arg value="-DrepositoryId=@{repo.id}" />
<arg value="-DpomFile=@{pom}" />
<arg value="-Dfile=@{file}" />
<arg value="-Dpackaging=@{packaging}" />
<artifact.args />
<arg value="-Pgpg" />
</artifact:mvn>
</sequential>
</macrodef>
<macrodef name="push.maven.jar">
<attribute name="jar" />
<attribute name="pom" />
<attribute name="url" />
<attribute name="repo.id" />
<element name="artifact.args" implicit="true" optional="true" />
<sequential>
<echo message="Pushing JAR to Maven: @{jar} -> @{url}" />
<push.maven.artifact file="@{jar}" pom="@{pom}" packaging="jar"
url="@{url}" repo.id="@{repo.id}">
<artifact.args />
</push.maven.artifact>
</sequential>
</macrodef>
<macrodef name="push.maven.pom">
<attribute name="pom" />
<attribute name="url" />
<attribute name="repo.id" />
<element name="artifact.args" implicit="true" optional="true" />
<sequential>
<echo message="Pushing POM to Maven: @{pom} -> @{url}" />
<push.maven.artifact file="@{pom}" pom="@{pom}" packaging="pom"
url="@{url}" repo.id="@{repo.id}">
<artifact.args />
</push.maven.artifact>
</sequential>
</macrodef>
<macrodef name="push.junit.maven.artifact">
<attribute name="url" />
<attribute name="repo.id" />
<attribute name="is.snapshot" default="true" />
<sequential>
<local name="m.prefix" />
<property name="m.prefix" value="${dist}/junit-dep-${version}" />
<local name="m.jar" />
<property name="m.jar" value="${m.prefix}.jar" />
<local name="m.sources.jar" />
<property name="m.sources.jar" value="${m.prefix}-src.jar" />
<local name="m.javadoc.jar" />
<property name="m.javadoc.jar" value="${m.prefix}-javadoc.jar" />
<local name="m.pom" />
<property name="m.pom" value="${dist}/pom-junit.xml" />
<filter token="version" value="${version}" />
<copy
file="build/maven/junit-pom-template.xml"
tofile="${m.pom}"
filtering="on"
overwrite="true"
/>
<push.maven.jar jar="${m.jar}" pom="${m.pom}"
url="@{url}" repo.id="@{repo.id}" />
<if>
<equals arg1="@{is.snapshot}" arg2="false" />
<then>
<push.maven.jar jar="${m.sources.jar}" pom="${m.pom}"
url="@{url}" repo.id="@{repo.id}">
<arg value="-Dclassifier=sources" />
</push.maven.jar>
<push.maven.jar jar="${m.javadoc.jar}" pom="${m.pom}"
url="@{url}" repo.id="@{repo.id}">
<arg value="-Dclassifier=javadoc" />
</push.maven.jar>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="push.junit-dep.maven.artifact">
<attribute name="url" />
<attribute name="repo.id" />
<sequential>
<local name="m.pom" />
<property name="m.pom" value="${dist}/pom-junit-dep.xml" />
<filter token="version" value="${version}" />
<copy
file="build/maven/junit-dep-pom-template.xml"
tofile="${m.pom}"
filtering="on"
overwrite="true"
/>
<push.maven.pom pom="${m.pom}"
url="@{url}" repo.id="@{repo.id}" />
</sequential>
</macrodef>
<target name="stage.maven" depends="all.maven.jars">
<property name="stage.url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<property name="stage.repo.id" value="sonatype-nexus-staging" />
<push.junit.maven.artifact url="${stage.url}"
repo.id="${stage.repo.id}"
is.snapshot="false" />
<push.junit-dep.maven.artifact url="${stage.url}"
repo.id="${stage.repo.id}" />
</target>
<target name="snapshot.maven" depends="all.maven.jars">
<property name="snapshot.url"
value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="snapshot.repo.id" value="sonatype-nexus-snapshots" />
<push.junit.maven.artifact url="${snapshot.url}"
repo.id="${snapshot.repo.id}" />
<push.junit-dep.maven.artifact url="${snapshot.url}"
repo.id="${snapshot.repo.id}" />
</target>
<target name="print.version">
<echo message="${version}" />
</target>
</project>

View File

@ -1,68 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
<modelVersion>4.0.0</modelVersion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<name>JUnit</name>
<url>http://junit.org</url>
<description>
JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
It is used by the developer who implements unit tests in Java.
</description>
<organization>
<name>JUnit</name>
<url>http://www.junit.org</url>
</organization>
<mailingLists>
<mailingList>
<name>JUnit Mailing List</name>
<post>junit@yahoogroups.com</post>
<archive>
http://tech.groups.yahoo.com/group/junit/
</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>Common Public License Version 1.0</name>
<url>http://www.opensource.org/licenses/cpl1.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/KentBeck/junit.git</connection>
<developerConnection>scm:git:git@github.com:KentBeck/junit.git</developerConnection>
<url>http://github.com/KentBeck/junit/tree/master</url>
</scm>
<developers>
<developer>
<id>dsaff</id>
<name>David Saff</name>
<email>david@saff.net</email>
</developer>
</developers>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>ISO-8859-1</encoding>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<jdk.version>1.5</jdk.version>
</properties>
</project>

View File

@ -1,41 +0,0 @@
Index: junit-r4.11/src/main/java/org/junit/runners/model/FrameworkMethod.java
===================================================================
--- junit-r4.11.orig/src/main/java/org/junit/runners/model/FrameworkMethod.java
+++ junit-r4.11/src/main/java/org/junit/runners/model/FrameworkMethod.java
@@ -83,14 +83,11 @@ public class FrameworkMethod extends Fra
* <li>is not static (given {@code isStatic is true}).
*/
public void validatePublicVoid(boolean isStatic, List<Throwable> errors) {
- if (Modifier.isStatic(fMethod.getModifiers()) != isStatic) {
+ if (isStatic() != isStatic) {
String state = isStatic ? "should" : "should not";
errors.add(new Exception("Method " + fMethod.getName() + "() " + state + " be static"));
}
- if (!Modifier.isPublic(fMethod.getDeclaringClass().getModifiers())) {
- errors.add(new Exception("Class " + fMethod.getDeclaringClass().getName() + " should be public"));
- }
- if (!Modifier.isPublic(fMethod.getModifiers())) {
+ if (!isPublic()) {
errors.add(new Exception("Method " + fMethod.getName() + "() should be public"));
}
if (fMethod.getReturnType() != Void.TYPE) {
Index: junit-r4.11/src/test/java/org/junit/tests/AllTests.java
===================================================================
--- junit-r4.11.orig/src/test/java/org/junit/tests/AllTests.java
+++ junit-r4.11/src/test/java/org/junit/tests/AllTests.java
@@ -77,7 +77,6 @@ import org.junit.tests.running.methods.T
import org.junit.tests.running.methods.TimeoutTest;
import org.junit.tests.validation.BadlyFormedClassesTest;
import org.junit.tests.validation.FailedConstructionTest;
-import org.junit.tests.validation.InaccessibleBaseClassTest;
import org.junit.tests.validation.ValidationTest;
// These test files need to be cleaned. See
@@ -118,7 +117,6 @@ import org.junit.tests.validation.Valida
JUnit38ClassRunnerTest.class,
SystemExitTest.class,
JUnitCoreReturnsCorrectExitCodeTest.class,
- InaccessibleBaseClassTest.class,
SuiteMethodTest.class,
BadlyFormedClassesTest.class,
IgnoreClassTest.class,

View File

@ -1,13 +0,0 @@
--- junit-r4.11/build.xml 2012-11-13 21:10:09.000000000 +0100
+++ junit-r4.11/build.xml 2017-09-08 10:38:22.639250431 +0200
@@ -71,8 +71,8 @@
debug="on"
classpath="@{classpath}"
includeantruntime="false"
- source="1.5"
- target="1.5"
+ source="1.6"
+ target="1.6"
>
<compilerarg value="-Xlint:unchecked" />
</javac>

View File

@ -1,40 +0,0 @@
diff --git a/build.xml b/build.xml
index 0efaf87..2efa11c 100644
--- a/build.xml
+++ b/build.xml
@@ -30,7 +30,6 @@
<property name="javadoczip" location="${dist}-javadoc.zip" />
<property name="hamcrestlib" location="lib/hamcrest-core-1.3.jar" />
<property name="hamcrestlibsources" location="lib/hamcrest-core-1.3-sources.jar" />
- <property name="hamcrestsrc" location="${dist}/temp.hamcrest.source" />
<property name="maven.deploy.goal" value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
@@ -125,10 +124,6 @@
</copy>
</target>
- <target name="unjar.hamcrest">
- <unjar src="${hamcrestlibsources}" dest="${hamcrestsrc}" />
- </target>
-
<target name="release-notes">
<property name="basename" value="doc/ReleaseNotes${version-base}" />
<exec executable="perl" failonerror="true">
@@ -138,7 +133,7 @@
</exec>
</target>
- <target name="javadoc" depends="unjar.hamcrest">
+ <target name="javadoc">
<javadoc destdir="${javadocdir}"
author="false"
version="false"
@@ -151,7 +146,6 @@
<excludepackage name="org.junit.experimental.theories.internal.*" />
<sourcepath location="${src}" />
- <sourcepath location="${hamcrestsrc}" />
<link href="http://java.sun.com/javase/6/docs/api/" />
</javadoc>
</target>

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Dec 26 06:27:56 UTC 2018 - Fridrich Strba <fstrba@suse.com>
- Upgrade to 4.12
- Removed patches:
* junit-jdk8.patch
* junit-jdk9.patch
* junit-no-hamcrest-src.patch
+ Integrated directly in the added build.xml file
-------------------------------------------------------------------
Wed Jul 11 14:52:48 UTC 2018 - fstrba@suse.com

View File

@ -17,31 +17,24 @@
Name: junit
Version: 4.11
Version: 4.12
Release: 0
Summary: Java regression test package
License: CPL-1.0
Group: Development/Libraries/Java
Url: http://www.junit.org/
Source0: https://github.com/junit-team/junit/archive/r%{version}.tar.gz
#Source1: http://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.pom
Source1: junit-4.11.pom
#PATCH-FIX-OPENSUSE: do not use bundled hamcrest sources, which btw fixes hamcrest build with junit4
Patch0: junit-no-hamcrest-src.patch
#PATCH-FIX-UPSTREAM: build with jdk8 and newer, already in upstream repo
Patch1: junit-jdk8.patch
Patch2: junit-jdk9.patch
Patch3: junit-jdk10.patch
Patch4: junit-jdk11.patch
Source1: build.xml
Patch0: junit-jdk10.patch
Patch1: junit-jdk11.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: hamcrest >= 1.3
BuildRequires: java-devel >= 1.6.0
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
BuildRequires: perl(Digest::MD5)
Requires: hamcrest
Requires: java >= 1.6.0
Requires: java >= 1.6
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
Provides: junit4 = %{version}
@ -54,41 +47,28 @@ It is used by the developer who implements unit tests in Java. JUnit is Open
Source Software, released under the Common Public License Version 1.0 and
hosted on GitHub.
%package manual
Summary: Manual for %{name}
Group: Documentation/Other
Provides: junit4-manual = %{version}
Obsoletes: junit4-manual <= 4.10
%description manual
Manual for %{name}.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
Provides: junit4-javadoc = %{version}
Obsoletes: junit4-javadoc <= 4.10
Provides: junit4-manual = %{version}
Obsoletes: junit4-manual <= 4.10
Provides: junit4-demo = %{version}
Obsoletes: junit4-demo <= 4.10
Provides: %{name}-manual = %{version}
Obsoletes: %{name}-manual < %{version}
Provides: %{name}-demo = %{version}
Obsoletes: %{name}-demo < %{version}
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demos for %{name}
Group: Documentation/Other
Requires: %{name} = %{version}
Provides: junit4-demo = %{version}
Obsoletes: junit4-demo <= 4.10
%description demo
Demos for %{name}.
%prep
%setup -q -n junit-r%{version}
%setup -q -n junit4-r%{version}
cp %{SOURCE1} .
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
find . -type f -name "*.jar" -or -name "*.class" | xargs -t rm -rf
@ -96,7 +76,7 @@ ln -s $(build-classpath hamcrest/core) lib/hamcrest-core-1.3.jar
%build
export CLASSPATH=$(build-classpath hamcrest/core)
ant dist -Dversion-status=
ant jars javadoc -Dversion-status=
%install
# jars
@ -107,7 +87,7 @@ ln -sf %{_javadir}/%{name}.jar %{buildroot}%{_javadir}/junit4.jar
# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -m 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
install -m 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap
# javadoc
@ -115,11 +95,6 @@ install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr junit%{version}/javadoc/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}/%{name}
# demo
install -d -m 755 %{buildroot}%{_datadir}/%{name}/demo/junit # Not using % name for last part because it is
# part of package name
cp -pr junit%{version}/junit/* %{buildroot}%{_datadir}/%{name}/demo/junit
%check
cat > test.java <<EOF
@ -137,7 +112,7 @@ java -cp %{buildroot}/%{_javadir}/%{name}.jar: test 2>&1 | \
grep 'Exception in thread "main" java.lang.AssertionError: Hello world from junit'
%files
%doc CODING_STYLE LICENSE README acknowledgements.txt
%doc CODING_STYLE.txt LICENSE-junit.txt README.md acknowledgements.txt
%{_javadir}/%{name}.jar
%{_javadir}/junit4.jar
%{_mavenpomdir}/*
@ -147,13 +122,7 @@ java -cp %{buildroot}/%{_javadir}/%{name}.jar: test 2>&1 | \
%{_datadir}/maven-metadata/%{name}.xml*
%endif
%files demo
%{_datadir}/%{name}
%files javadoc
%{_javadocdir}/%{name}
%files manual
%doc junit%{version}/doc/*
%changelog

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f427e18a21006ea5394fb71b268d2fa1d12a9f4575b5743ff093547c7ac7b37
size 1974196

3
r4.12.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a5b458258c6537df0d2df7122a06895a26b9c7c8061e5991a0be81d76b10d24
size 443804