Accepting request 981546 from home:fstrba:branches:Java:packages

2.2

OBS-URL: https://build.opensuse.org/request/show/981546
OBS-URL: https://build.opensuse.org/package/show/Java:packages/hamcrest?expand=0&rev=51
This commit is contained in:
Fridrich Strba 2022-06-09 16:21:19 +00:00 committed by Git OBS Bridge
parent 90e5f1ad3a
commit 7c105e58a6
24 changed files with 599 additions and 1693 deletions

View File

@ -0,0 +1,131 @@
From d33031924faa557bb43ba0471f74d942ddfeae50 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Tue, 5 Nov 2019 14:50:23 +0100
Subject: [PATCH] Fix build with OpenJDK 11
---
.../src/main/java/org/hamcrest/collection/ArrayMatching.java | 3 ++-
.../org/hamcrest/collection/IsArrayContainingInAnyOrder.java | 2 +-
.../org/hamcrest/collection/IsArrayContainingInOrder.java | 2 +-
.../hamcrest/collection/IsIterableContainingInAnyOrder.java | 2 +-
.../collection/IsIterableContainingInRelativeOrder.java | 2 +-
hamcrest/src/main/java/org/hamcrest/core/AllOf.java | 2 +-
hamcrest/src/main/java/org/hamcrest/core/AnyOf.java | 2 +-
.../src/main/java/org/hamcrest/core/CombinableMatcher.java | 4 ++--
8 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java
index fc968e0..baab775 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java
@@ -67,7 +67,8 @@ public class ArrayMatching {
*/
@SafeVarargs
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(asList(itemMatchers));
+ Collection<Matcher<? super E>> itemMatchersList = asList(itemMatchers);
+ return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchersList), itemMatchersList, "in any order");
}
/**
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java
index 7e72a62..c0c7efc 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java
@@ -59,7 +59,7 @@ public class IsArrayContainingInAnyOrder<E> extends TypeSafeMatcher<E[]> {
* a list of matchers, each of which must be satisfied by an entry in an examined array
*/
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsArrayContainingInAnyOrder<E>(Arrays.asList(itemMatchers));
}
/**
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java
index c046914..2022f1a 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java
@@ -73,7 +73,7 @@ public class IsArrayContainingInOrder<E> extends TypeSafeMatcher<E[]> {
* the matchers that must be satisfied by the items in the examined array
*/
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
- return arrayContaining(asList(itemMatchers));
+ return new IsArrayContainingInOrder<E>(asList(itemMatchers));
}
/**
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java
index d6a9a33..9a7e6c0 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java
@@ -98,7 +98,7 @@ public class IsIterableContainingInAnyOrder<T> extends TypeSafeDiagnosingMatcher
*/
@SafeVarargs
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers) {
- return containsInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsIterableContainingInAnyOrder<T>(Arrays.asList(itemMatchers));
}
/**
diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java
index 0657768..06d6a57 100644
--- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java
+++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java
@@ -99,7 +99,7 @@ public class IsIterableContainingInRelativeOrder<E> extends TypeSafeDiagnosingMa
*/
@SafeVarargs
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers) {
- return containsInRelativeOrder(asList(itemMatchers));
+ return new IsIterableContainingInRelativeOrder<E>(asList(itemMatchers));
}
/**
diff --git a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java
index b8c3faa..f8951bd 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java
@@ -56,6 +56,6 @@ public class AllOf<T> extends DiagnosingMatcher<T> {
*/
@SafeVarargs
public static <T> Matcher<T> allOf(Matcher<? super T>... matchers) {
- return allOf(Arrays.asList(matchers));
+ return new AllOf<T>(Arrays.asList(matchers));
}
}
diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java
index 7a22c22..5a63574 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java
@@ -46,6 +46,6 @@ public class AnyOf<T> extends ShortcutCombination<T> {
*/
@SafeVarargs
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) {
- return anyOf(Arrays.asList(matchers));
+ return new AnyOf<T>(Arrays.asList(matchers));
}
}
diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java
index e37efce..6b44884 100644
--- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java
+++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java
@@ -57,7 +57,7 @@ public class CombinableMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
this.first = matcher;
}
public CombinableMatcher<X> and(Matcher<? super X> other) {
- return new CombinableMatcher<>(first).and(other);
+ return new CombinableMatcher<>(first).and((Matcher)other);
}
}
@@ -76,7 +76,7 @@ public class CombinableMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
this.first = matcher;
}
public CombinableMatcher<X> or(Matcher<? super X> other) {
- return new CombinableMatcher<>(first).or(other);
+ return new CombinableMatcher<>(first).or((Matcher)other);
}
}
}
--
2.21.0

27
LICENSE.txt Normal file
View File

@ -0,0 +1,27 @@
BSD License
Copyright (c) 2000-2015 www.hamcrest.org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer. Redistributions in binary form must reproduce
the above copyright notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
Neither the name of Hamcrest nor the names of its contributors may be used to endorse
or promote products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.

63
README.md Normal file
View File

@ -0,0 +1,63 @@
![JavaHamcrest](http://hamcrest.org/images/logo.jpg)
[![Build Status](https://travis-ci.org/hamcrest/JavaHamcrest.png?branch=master)](https://travis-ci.org/hamcrest/JavaHamcrest)
Java Hamcrest
=============
Licensed under [BSD License][].
What is Hamcrest?
-----------------
Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests.
They've also been used for other purposes.
Downloads
---------
You can obtain Hamcrest binaries from [maven central][].
Extensions
----------
For Hamcrest extension projects see the [hamcrest extensions page][].
Documentation
-------------
Documentation can be found on the [Hamcrest site](http://hamcrest.org).
Reporting Bugs/Issues
---------------------
If you find an issue with Java Hamcrest, please report it via the
[GitHub issue tracker](https://github.com/hamcrest/JavaHamcrest/issues),
after first checking that it hasn't been raised already.
Source
------
To build, please read BUILDING.txt
Acknowledgements
----------------
Developers:
* Joe Walnes
* Nat Pryce
* Steve Freeman
Contributors:
* Robert Chatley
* Tom White
* Neil Dunn
* Dan North
* Magne Rasmussen
* David Saff
* Tom Denley
Also, thanks to everyone who has worked on DynaMock, nMock, jMock, EasyMock and MiniMock! These libraries inspired Hamcrest.
[logo]: http://hamcrest.org/images/logo.jpg
[website]: https://github.com/hamcrest/JavaHamcrest
[BSD License]: http://opensource.org/licenses/BSD-3-Clause
[Maven central]: http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.hamcrest
[hamcrest extensions page]: https://github.com/hamcrest/JavaHamcrest/wiki/Related-Projects
[GitHub issue tracker]: https://github.com/hamcrest/JavaHamcrest/issues

19
_service Normal file
View File

@ -0,0 +1,19 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://github.com/hamcrest/JavaHamcrest.git</param>
<param name="subdir">hamcrest</param>
<param name="revision">v2.2</param>
<param name="match-tag">v*</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="filename">hamcrest</param>
<param name="exclude">*.gradle</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<!-- <service name="download_files" mode="disabled"/> -->
<service name="set_version" mode="disabled"/>
</services>

View File

@ -1,41 +0,0 @@
diff --git a/build.xml b/build.xml
index 1cfd4fb..5a7c740 100644
--- a/build.xml
+++ b/build.xml
@@ -14,13 +14,13 @@
<target name="generator" description="Build code generator tool">
<java-to-jar srcdir="hamcrest-generator/src/main/java"
modulename="hamcrest-generator-nodeps"
- classpath="lib/generator/qdox-1.12.jar"/>
+ classpath="lib/generator/qdox.jar"/>
<!-- Bundle QDox classes in hamcrest-generator.jar using JarJar to place classes under a different package -->
- <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar-1.3.jar"/>
+ <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar.jar"/>
<jarjar jarfile="build/hamcrest-generator-${version}.jar">
<zipfileset src="build/hamcrest-generator-nodeps-${version}.jar"/>
- <zipfileset src="lib/generator/qdox-1.12.jar"/>
+ <zipfileset src="lib/generator/qdox.jar"/>
<rule pattern="com.thoughtworks.qdox.**" result="org.hamcrest.generator.qdox.@1"/>
</jarjar>
<copy file="build/hamcrest-generator-nodeps-${version}-sources.jar" tofile="build/hamcrest-generator-${version}-sources.jar"/>
@@ -152,7 +152,8 @@
<javadoc packagenames="org.hamcrest.*" defaultexcludes="yes"
destdir="build/temp/hamcrest-all-${version}-javadoc.jar.contents" author="true" version="true" use="true"
- windowtitle="Hamcrest" source="1.6" failonerror="yes" overview="overview.html">
+ windowtitle="Hamcrest" source="1.8" failonerror="yes">
+ <arg value="-Xdoclint:none"/>
<classpath>
<fileset dir="lib/integration">
<include name="*.jar"/>
@@ -313,7 +314,8 @@
<sequential>
<javadoc packagenames="org.hamcrest.*" sourcepath="build/temp/@{modulename}-${version}-sources.jar.contents" defaultexcludes="yes"
destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true" use="true"
- windowtitle="Hamcrest" source="1.6" failonerror="yes">
+ windowtitle="Hamcrest" source="1.8" failonerror="yes">
+ <arg value="-Xdoclint:none"/>
<classpath>
<fileset dir="lib/integration">
<include name="*.jar"/>

View File

@ -1,25 +0,0 @@
From 54b7ccdd1e16f1d6dd07359eae0fcac8f1883373 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Mon, 2 Jan 2017 10:31:56 +0100
Subject: [PATCH] Fork javac
---
build.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 1cfd4fb..69acfe8 100644
--- a/build.xml
+++ b/build.xml
@@ -284,7 +284,7 @@
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
<mkdir dir="build/temp/@{modulename}-${version}.jar.contents"/>
- <javac srcdir="@{srcdir}" destdir="build/temp/@{modulename}-${version}.jar.contents" debug="${debug}" target="1.5" includeantruntime="false">
+ <javac srcdir="@{srcdir}" destdir="build/temp/@{modulename}-${version}.jar.contents" debug="${debug}" includeantruntime="false" fork="true">
<classpath>
<fileset dir="lib/integration">
<include name="*.jar"/>
--
2.9.3

View File

@ -1,17 +0,0 @@
diff --git a/build.xml b/build.xml
index ed57763..a4550cb 100644
--- a/build.xml
+++ b/build.xml
@@ -135,11 +135,10 @@
</target>
<target name="javadoc" description="build javadoc jars">
- <java-to-javadoc-jar modulename="hamcrest-generator-nodeps"/>
+ <java-to-javadoc-jar modulename="hamcrest-generator"/>
<java-to-javadoc-jar modulename="hamcrest-core"/>
<java-to-javadoc-jar modulename="hamcrest-library"/>
<java-to-javadoc-jar modulename="hamcrest-integration"/>
- <copy file="build/hamcrest-generator-nodeps-${version}-javadoc.jar" tofile="build/hamcrest-generator-${version}-javadoc.jar"/>
<javadoc packagenames="org.hamcrest.*" defaultexcludes="yes"
destdir="build/temp/hamcrest-all-${version}-javadoc.jar.contents" author="true" version="true" use="true"

View File

@ -1,12 +0,0 @@
--- hamcrest-1.3/build.xml 2012-07-02 21:14:09.000000000 +0200
+++ hamcrest-1.3/build.xml 2017-12-18 07:46:06.290074242 +0100
@@ -165,9 +165,6 @@
<group title="Hamcrest API and Utility Classes" packages="org.hamcrest"/>
<group title="Matcher Library" packages="org.hamcrest.*"/>
<group title="Integration" packages="org.hamcrest.integration, org.hamcrest.integration.*"/>
-
- <link offline="false" href="http://www.junit.org/junit/javadoc/3.8.1/"/>
- <link offline="false" href="http://kentbeck.github.com/junit/javadoc/latest/"/>
</javadoc>
<jar jarfile="build/hamcrest-all-${version}-javadoc.jar">
<fileset dir="build/temp/hamcrest-all-${version}-javadoc.jar.contents"/>

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
diff --git a/build.xml b/build.xml
index 54d43fe..ed57763 100644
--- a/build.xml
+++ b/build.xml
@@ -13,17 +13,8 @@
<target name="generator" description="Build code generator tool">
<java-to-jar srcdir="hamcrest-generator/src/main/java"
- modulename="hamcrest-generator-nodeps"
+ modulename="hamcrest-generator"
classpath="lib/generator/qdox.jar"/>
-
- <!-- Bundle QDox classes in hamcrest-generator.jar using JarJar to place classes under a different package -->
- <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="lib/generator/jarjar.jar"/>
- <jarjar jarfile="build/hamcrest-generator-${version}.jar">
- <zipfileset src="build/hamcrest-generator-nodeps-${version}.jar"/>
- <zipfileset src="lib/generator/qdox.jar"/>
- <rule pattern="com.thoughtworks.qdox.**" result="org.hamcrest.generator.qdox.@1"/>
- </jarjar>
- <copy file="build/hamcrest-generator-nodeps-${version}-sources.jar" tofile="build/hamcrest-generator-${version}-sources.jar"/>
</target>
<target name="core" depends="generator" description="Build core Hamcrest library">

View File

@ -1,105 +0,0 @@
From 6d7da5456a7458a249bed9c4c1e768cc7cc2fe40 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Wed, 1 Feb 2017 12:57:14 +0100
Subject: [PATCH] Port to qdox 2.0
---
.../src/main/java/org/hamcrest/generator/QDox.java | 4 ++--
.../org/hamcrest/generator/QDoxFactoryReader.java | 26 ++++++++++++----------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java
index efaf615..338178d 100644
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java
+++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java
@@ -1,6 +1,6 @@
package org.hamcrest.generator;
-import com.thoughtworks.qdox.JavaDocBuilder;
+import com.thoughtworks.qdox.JavaProjectBuilder;
import com.thoughtworks.qdox.model.JavaClass;
import java.io.File;
@@ -16,7 +16,7 @@ import java.io.Reader;
*/
public class QDox {
- private final JavaDocBuilder javaDocBuilder = new JavaDocBuilder();
+ private final JavaProjectBuilder javaDocBuilder = new JavaProjectBuilder();
public void addSourceTree(File sourceDir) {
javaDocBuilder.addSourceTree(sourceDir);
diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java
index 5108140..97fce01 100644
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java
+++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java
@@ -4,8 +4,10 @@ import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaMethod;
import com.thoughtworks.qdox.model.JavaParameter;
-import com.thoughtworks.qdox.model.Type;
+import com.thoughtworks.qdox.model.JavaType;
+import com.thoughtworks.qdox.model.impl.DefaultJavaClass;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
@@ -56,15 +58,15 @@ public class QDoxFactoryReader implements Iterable<FactoryMethod> {
JavaMethod methodSource = findMethodInSource(factoryMethod);
if (methodSource != null) {
factoryMethod.setJavaDoc(createJavaDocComment(methodSource));
- JavaParameter[] parametersFromSource
+ List<JavaParameter> parametersFromSource
= methodSource.getParameters();
List<FactoryMethod.Parameter> parametersFromReflection
= factoryMethod.getParameters();
- if (parametersFromReflection.size() == parametersFromSource.length) {
- for (int i = 0; i < parametersFromSource.length; i++) {
+ if (parametersFromReflection.size() == parametersFromSource.size()) {
+ for (int i = 0; i < parametersFromSource.size(); i++) {
parametersFromReflection.get(i).setName(
- parametersFromSource[i].getName());
+ parametersFromSource.get(i).getName());
}
}
}
@@ -79,18 +81,18 @@ public class QDoxFactoryReader implements Iterable<FactoryMethod> {
// Note, this doesn't always work - it struggles with some kinds of generics.
// This seems to cover most cases though.
List<FactoryMethod.Parameter> params = factoryMethod.getParameters();
- Type[] types = new Type[params.size()];
+ List<JavaType> types = new ArrayList<JavaType>(params.size());
boolean varArgs = false;
- for (int i = 0; i < types.length; i++) {
+ for (int i = 0; i < params.size(); i++) {
String type = params.get(i).getType();
varArgs = VARARGS_REGEX.matcher(type).find();
// QDox ignores varargs and generics, so we strip them out to help QDox.
type = GENERIC_REGEX.matcher(type).replaceAll("");
type = VARARGS_REGEX.matcher(type).replaceAll("");
- types[i] = new Type(type);
+ types.add(new DefaultJavaClass(type));
}
- JavaMethod[] methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs);
- return methods.length == 1 ? methods[0] : null;
+ List<JavaMethod> methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs);
+ return methods.size() == 1 ? methods.get(0) : null;
}
/**
@@ -98,8 +100,8 @@ public class QDoxFactoryReader implements Iterable<FactoryMethod> {
*/
private static String createJavaDocComment(JavaMethod methodSource) {
String comment = methodSource.getComment();
- DocletTag[] tags = methodSource.getTags();
- if ((comment == null || comment.trim().length() == 0) && tags.length == 0) {
+ List<DocletTag> tags = methodSource.getTags();
+ if ((comment == null || comment.trim().length() == 0) && tags.size() == 0) {
return null;
}
StringBuilder result = new StringBuilder();
--
2.9.3

View File

@ -1,42 +0,0 @@
diff -urN hamcrest-1.3.old/build.xml hamcrest-1.3/build.xml
--- hamcrest-1.3.old/build.xml 2014-06-16 13:00:29.321699344 +0200
+++ hamcrest-1.3/build.xml 2014-06-16 14:24:30.160165471 +0200
@@ -27,6 +27,7 @@
</target>
<target name="core" depends="generator" description="Build core Hamcrest library">
+ <parallel threadcount="1">
<java-to-jar srcdir="hamcrest-core/src/main/java" modulename="hamcrest-core"/>
<!-- Generate one class with all static imports -->
@@ -36,7 +37,7 @@
fork="yes"
failonerror="yes"
classpath="
- build/hamcrest-core-${version}.jar;
+ build/temp/hamcrest-core-${version}.jar.contents;
build/hamcrest-generator-${version}.jar;
">
<arg value="core-matchers.xml"/>
@@ -48,11 +49,13 @@
<java-to-jar srcdir="build/temp/hamcrest-core/generated-code"
modulename="hamcrest-core"
classpath="build/hamcrest-core-${version}.jar"/>
+ </parallel>
</target>
<target name="library"
depends="core,generator"
description="Build library of matchers">
+ <parallel threadcount="1">
<mkdir dir="build/temp/hamcrest-library/generated-code"/>
<java-to-jar srcdir="hamcrest-library/src/main/java"
modulename="hamcrest-library"
@@ -75,6 +78,7 @@
<java-to-jar srcdir="build/temp/hamcrest-library/generated-code"
modulename="hamcrest-library"
classpath="build/hamcrest-core-${version}.jar"/>
+ </parallel>
</target>
<target name="integration" depends="core, library" description="Build integration with external tools">

35
hamcrest-2.2.pom Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<name>Hamcrest</name>
<description>Core API and libraries of hamcrest matcher framework.</description>
<url>http://hamcrest.org/JavaHamcrest/</url>
<licenses>
<license>
<name>BSD License 3</name>
<url>http://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>
<developers>
<developer>
<id>joewalnes</id>
<name>Joe Walnes</name>
</developer>
<developer>
<id>npryce</id>
<name>Nat Pryce</name>
</developer>
<developer>
<id>sf105</id>
<name>Steve Freeman</name>
</developer>
</developers>
<scm>
<connection>git@github.com:hamcrest/JavaHamcrest.git</connection>
<url>https://github.com/hamcrest/JavaHamcrest</url>
</scm>
</project>

BIN
hamcrest-2.2.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

210
hamcrest-build.xml Normal file
View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="hamcrest" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.groupId" value="org.hamcrest"/>
<property name="project.artifactId" value="hamcrest"/>
<property name="project.version" value="2.2"/>
<property name="compiler.source" value="1.8"/>
<property name="compiler.target" value="${compiler.source}"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir" value="src/test/java"/>
<property name="build.testResourceDir" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.testOutputDir}"/>
<javac destdir="${build.testOutputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.testDir}"/>
</src>
<classpath>
<pathelement location="${build.outputDir}"/>
</classpath>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<classpath>
<pathelement location="${build.outputDir}"/>
<pathelement location="${build.testOutputDir}"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${build.testDir}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${build.testDir}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
source="${compiler.source}"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="ISO-8859-1"
linksource="false"
doctitle="Hamcrest ${project.version} API"
breakiterator="false"/>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Automatic-Module-Name" value="${project.groupId}"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${project.artifactId}"/>
<attribute name="Bundle-SymbolicName" value="${project.groupId}"/>
<attribute name="Bundle-Version" value="${project.version}"/>
<attribute name="Export-Package" value="org.hamcrest.beans;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.collection;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.comparator;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.core;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.internal;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.io;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.number;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.object;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.text;version=&quot;${project.version}&quot;;uses:=&quot;org.hamcrest&quot;,org.hamcrest.xml;version=&quot;${project.version}&quot;;uses:=&quot;javax.xml.namespace,org.hamcrest,org.w3c.dom&quot;,org.hamcrest;version=&quot;${project.version}&quot;;uses:=&quot;javax.xml.namespace,org.hamcrest.collection,org.hamcrest.core,org.hamcrest.internal,org.w3c.dom&quot;"/>
<attribute name="Import-Package" value="javax.xml.namespace;resolution:=optional,javax.xml.xpath;resolution:=optional,org.hamcrest.beans,org.hamcrest.collection,org.hamcrest.comparator,org.hamcrest.core,org.hamcrest.internal,org.hamcrest.number,org.hamcrest.object,org.hamcrest.text,org.hamcrest.xml,org.hamcrest,org.w3c.dom;resolution:=optional,"/>
<attribute name="Implementation-Title" value="${project.artifactId}"/>
<attribute name="Implementation-Vendor" value="${project.groupId}"/>
<attribute name="Implementation-Version" value="${project.version}"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=${compiler.target}))&quot;"/>
</manifest>
</jar>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
</project>

View File

@ -1,14 +0,0 @@
Manifest-Version: 1.0
Bundle-Vendor: Fedoraproject.org
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Name: Hamcrest Core
Bundle-SymbolicName: org.hamcrest.core
Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/too
ls:org.eclipse.orbit/org.hamcrest.core;tag=v201303031735
Export-Package: org.hamcrest;version="1.3.0";core=split;mandatory:=cor
e,org.hamcrest.core;version="1.3.0",org.hamcrest.internal;version="1.
3.0";x-internal:=true
Bundle-Version: 1.3.0.v201303031735
Bundle-ManifestVersion: 2

View File

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Name: %pluginName
Bundle-SymbolicName: org.hamcrest.generator
Bundle-Version: 1.3.0.v20090501071000
Export-Package: org.hamcrest.generator;version="1.3.0",org.hamcrest.ge
nerator.config;version="1.3.0"
Bundle-ManifestVersion: 2
Import-Package: com.thoughtworks.qdox;version="1.6.3",com.thoughtworks
.qdox.ant;version="1.6.3",com.thoughtworks.qdox.directorywalker;versi
on="1.6.3",com.thoughtworks.qdox.junit;version="1.6.3",com.thoughtwor
ks.qdox.model;version="1.6.3",com.thoughtworks.qdox.model.util;versio
n="1.6.3",com.thoughtworks.qdox.parser;version="1.6.3",com.thoughtwor
ks.qdox.parser.impl;version="1.6.3",com.thoughtworks.qdox.parser.stru
cts;version="1.6.3",com.thoughtworks.qdox.tools;version="1.6.3"

View File

@ -1,14 +0,0 @@
Manifest-Version: 1.0
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Name: %pluginName
Bundle-SymbolicName: org.hamcrest.integration
Require-Bundle: org.hamcrest.core;bundle-version="1.3.0"
Bundle-Version: 1.3.0.v20090501071000
Export-Package: org.hamcrest;integration=split;mandatory:=integration;
version="1.3.0",org.hamcrest.integration;version="1.3.0"
Bundle-ManifestVersion: 2
Import-Package: org.easymock;version="2.4.0";resolution:=optional,org.
jmock.core;version="1.10";resolution:=optional

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6ac31de50c6f3b047a7bd7f62ab7ca3e88b2a8449d22b0978c9f575740d0e085
size 2007925

View File

@ -1,15 +0,0 @@
Manifest-Version: 1.0
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Name: %pluginName
Bundle-SymbolicName: org.hamcrest.library
Require-Bundle: org.hamcrest.core;bundle-version="1.3.0"
Bundle-Version: 1.3.0.v20090501071000
Export-Package: org.hamcrest;version="1.3.0";library=split;mandatory:=
library,org.hamcrest.beans;version="1.3.0",org.hamcrest.collection;ve
rsion="1.3.0",org.hamcrest.number;version="1.3.0",org.hamcrest.object
;version="1.3.0",org.hamcrest.text;version="1.3.0",org.hamcrest.xml;v
ersion="1.3.0"
Bundle-ManifestVersion: 2

View File

@ -1,66 +0,0 @@
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java 2022-03-18 20:35:38.293788586 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java 2022-03-18 20:46:34.534452749 +0100
@@ -57,7 +57,7 @@
*/
@Factory
public static <T> Matcher<T> allOf(Matcher<? super T>... matchers) {
- return allOf(Arrays.asList(matchers));
+ return new AllOf<T>(Arrays.asList(matchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java 2022-03-18 20:35:38.293788586 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java 2022-03-18 20:39:13.031315993 +0100
@@ -47,7 +47,7 @@
*/
@Factory
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) {
- return anyOf(Arrays.asList(matchers));
+ return new AnyOf<T>(Arrays.asList(matchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java 2022-03-18 20:49:03.047502492 +0100
@@ -55,7 +55,7 @@
*/
@Factory
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsArrayContainingInAnyOrder<E>(Arrays.asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java 2022-03-18 20:49:57.623888266 +0100
@@ -69,7 +69,7 @@
*/
@Factory
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
- return arrayContaining(asList(itemMatchers));
+ return new IsArrayContainingInOrder<E>(asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java 2022-03-18 20:56:50.738808383 +0100
@@ -122,7 +122,7 @@
*/
@Factory
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers) {
- return containsInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsIterableContainingInAnyOrder<T>(Arrays.asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java 2022-03-18 21:21:22.189211465 +0100
@@ -138,7 +138,7 @@
*/
@Factory
public static <E> Matcher<Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers) {
- return contains(asList(itemMatchers));
+ return new IsIterableContainingInOrder<E>(asList(itemMatchers));
}
/**

View File

@ -1,23 +0,0 @@
--- a/hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java
+++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/ReflectiveFactoryReader.java
@@ -43,6 +43,13 @@
private int currentMethod = -1;
private Method[] allMethods = cls.getMethods();
+ {
+ java.util.Arrays.sort(allMethods, new java.util.Comparator<Method>() {
+ public int compare(Method m1, Method m2) {
+ return m1.toGenericString().compareTo(m2.toGenericString());
+ }
+ });
+ }
@Override
public boolean hasNext() {
@@ -171,4 +178,4 @@
return name.replace('$', '.');
}
-}
\ No newline at end of file
+}

View File

@ -1,3 +1,77 @@
-------------------------------------------------------------------
Thu Jun 9 16:00:32 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Upgrade to upstream version 2.2
* After a long hiatus without releases, this version simplifies
the packaging of Hamcrest into a single jar. Other big changes
include Java 9 module compatibility, along with numerous other
improvements and bug fixes.
* Breaking Changes
+ Although the class API has not changed since Hamcrest 1.3, the
way that the project is packaged has changed. Refer to the
Hamcrest Distributables documentation for more information,
and in particular the section on Upgrading from Hamcrest 1.x
+ The org.hamcrest.Factory annotation has been removed
(it should not be used in client code)
* Improvements
+ AllOf/AnyOf: Pass the matchers to constructor using varargs
+ Matchers.anyOf: Fix generic bounds compatibility for JDK 11
+ AssertionError message is unhelpful when match fails for byte
type
+ Use platform specific line breaks
+ Build now checks for consistent use of spaces
* Changes
+ Fix compatibility issue for development with Android D8
+ Fix typo in license name
+ 1.3 compatible constructors for string matchers
+ Fix for split packages with Java 9 modules
+ Documentation updates
+ Add implementation for CharSequence length matcher
+ Fix for TypeSafeDiagnosingMatcher can't detect generic types
for subclass
+ Renamed IsCollectionContaining to IsIterableContaining
+ Make Hamcrest an OSGI bundle
+ Add StringRegularExpression matcher
+ Fix StringContainsInOrder to detect if a repeated pattern is
missing
+ Add ArrayAsIterableMatcher
+ Fix description for IsEqualIgnoringCase
+ Fix JavaDoc examples
+ Upgraded to Java 7
+ Build with Gradle
+ Deprecate IsCollectionContaining and IsArrayContainingXXX
+ Removed deprecated methods from previous release
+ Improve mismatch description of hasItem/hasItems
+ General improvements to mismatch descriptions
+ Several JavaDoc improvements and corrections
+ Deprecated several matcher factory methods of the for "isXyz"
+ Fix address doclint errors reported in JDK 1.8
+ Fix Iterable contains in order is null-safe
+ Added equalToObject() (i.e. unchecked) method
+ Fix arrayContaining(null, null) cause NullPointerException
* Fix string matching on regular expressions
* Fix isCloseTo() shows wrong delta in mismatch description
* Fix add untyped version of equalTo, named equalToObject
* Implement IsEmptyMap, IsMapWithSize
* Fix IsArray.describeMismatchSafely() should use
Matcher.describeMismatch
* Add Matcher implementation for files
* Fix NPE in IsIterableContainingInOrder
- Removed patches:
* hamcrest-1.3-build.patch
* hamcrest-1.3-fork-javac.patch
* hamcrest-1.3-javadoc.patch
* hamcrest-1.3-javadoc10.patch
* hamcrest-1.3-javadoc9.patch
* hamcrest-1.3-no-jarjar.patch
* hamcrest-1.3-qdox-2.0.patch
* hamcrest-1.3-random-build-crash.patch
* hamcrest-reproducible-builds.patch
+ not needed with the new version
- Modified patch:
* hamcrest-matchers.patch -> 0001-Fix-build-with-OpenJDK-11.patch
+ adapt to the changed context
-------------------------------------------------------------------
Fri Mar 18 20:25:15 UTC 2022 - Fridrich Strba <fstrba@suse.com>

View File

@ -16,46 +16,31 @@
#
%bcond_with jmock
%bcond_with easymock
%bcond_with tests
Name: hamcrest
Version: 1.3
Version: 2.2
Release: 0
Summary: Library of matchers for building test expressions
License: BSD-3-Clause
Group: Development/Libraries/Java
URL: https://github.com/hamcrest/JavaHamcrest
Source0: https://github.com/hamcrest/JavaHamcrest/archive/hamcrest-java-%{version}.tar.gz
Source8: hamcrest-core-MANIFEST.MF
Source9: hamcrest-library-MANIFEST.MF
Source11: hamcrest-integration-MANIFEST.MF
Source12: hamcrest-generator-MANIFEST.MF
Patch0: %{name}-%{version}-build.patch
Patch1: %{name}-%{version}-no-jarjar.patch
Patch3: %{name}-%{version}-javadoc.patch
Patch4: %{name}-%{version}-qdox-2.0.patch
Patch5: %{name}-%{version}-fork-javac.patch
Patch6: %{name}-%{version}-javadoc9.patch
Patch7: %{name}-%{version}-javadoc10.patch
Patch8: %{name}-%{version}-random-build-crash.patch
Patch9: hamcrest-reproducible-builds.patch
Patch10: hamcrest-matchers.patch
Source0: %{name}-%{version}.tar.xz
Source1: %{name}-build.xml
Source2: https://repo1.maven.org/maven2/org/hamcrest/%{name}/%{version}/%{name}-%{version}.pom
Source3: https://raw.githubusercontent.com/hamcrest/JavaHamcrest/v2.2/LICENSE.txt
Source4: https://raw.githubusercontent.com/hamcrest/JavaHamcrest/v2.2/README.md
Patch0: 0001-Fix-build-with-OpenJDK-11.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: qdox >= 2.0
Requires: %{name}-core = %{version}-%{release}
Requires: qdox >= 2.0
%if %{with tests}
BuildRequires: ant-junit
%endif
Provides: %{name}-core = %{version}
Obsoletes: %{name}-core < %{version}
Obsoletes: %{name}-demo < %{version}
BuildArch: noarch
%if %{with jmock}
BuildRequires: jmock
Requires: jmock
%endif
%if %{with easymock}
BuildRequires: easymock
Requires: easymock
%endif
%description
Provides a library of matcher objects (also known as constraints or
@ -63,15 +48,6 @@ predicates) allowing 'match' rules to be defined declaratively, to be
used in other frameworks. Typical scenarios include testing frameworks,
mocking libraries and UI validation rules.
%package core
Summary: Core API of hamcrest matcher framework
Group: Development/Libraries/Java
Obsoletes: %{name} < %{version}-%{release}
%description core
The core API of hamcrest matcher framework to be used by third-party framework providers.
This includes a foundation set of matcher implementations for common operations.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
@ -79,115 +55,45 @@ Group: Documentation/HTML
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demo files for %{name}
Group: Development/Libraries/Java
Requires: %{name} = %{version}-%{release}
Requires: junit
%description demo
Demo files for %{name}.
%prep
%setup -q -n JavaHamcrest-%{name}-java-%{version}
%setup -q -n %{name}-%{version}
cp %{SOURCE1} build.xml
cp %{SOURCE3} %{SOURCE4} .
find . -type f -name "*.jar" | xargs -t rm
ln -sf $(build-classpath qdox) lib/generator/
%if %{with jmock}
ln -sf $(build-classpath jmock) lib/integration/
%else
rm -fr hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java
rm -fr hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java
rm -fr hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java
%endif
%if %{with easymock}
ln -sf $(build-classpath easymock3) lib/integration/
%else
rm -fr hamcrest-integration/src/main/java/org/hamcrest/integration/EasyMock2Adapter.java
rm -fr hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java
%endif
%patch0 -p1
%patch1 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
sed -i 's/\r//' LICENSE.txt
%patch0 -p2
%build
export CLASSPATH=$(build-classpath qdox)
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 -Dversion=%{version} -Dbuild.sysclasspath=last clean core generator library bigjar javadoc
# inject OSGi manifests
jar ufm build/%{name}-core-%{version}.jar %{SOURCE8}
jar ufm build/%{name}-library-%{version}.jar %{SOURCE9}
jar ufm build/%{name}-integration-%{version}.jar %{SOURCE11}
jar ufm build/%{name}-generator-%{version}.jar %{SOURCE12}
%ant \
%if %{without tests}
-Dtest.skip=true \
%endif
jar javadoc
%install
sed -i 's/@VERSION@/%{version}/g' pom/*.pom
# jars
install -d -m 755 %{buildroot}%{_javadir}/%{name}
install -d -m 755 %{buildroot}%{_mavenpomdir}/%{name}
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
ln -sf %{name}.jar %{buildroot}%{_javadir}/%{name}/all.jar
ln -sf %{name}.jar %{buildroot}%{_javadir}/%{name}/core.jar
ln -sf %{name}.jar %{buildroot}%{_javadir}/%{name}/library.jar
rm -f pom/%{name}-parent.pom
for i in pom/%{name}*.pom; do
%pom_remove_parent ${i}
%pom_xpath_inject "pom:project" "
<groupId>org.hamcrest</groupId>
<version>%{version}</version>" ${i}
done
install -m 644 build/%{name}-core-%{version}.jar %{buildroot}%{_javadir}/%{name}/core.jar
install -m 644 pom/%{name}-core.pom %{buildroot}%{_mavenpomdir}/%{name}/core.pom
%add_maven_depmap %{name}/core.pom %{name}/core.jar -f core
install -m 644 build/%{name}-all-%{version}.jar %{buildroot}%{_javadir}/%{name}/all.jar
install -m 644 pom/%{name}-all.pom %{buildroot}%{_mavenpomdir}/%{name}/all.pom
%add_maven_depmap %{name}/all.pom %{name}/all.jar
install -m 644 build/%{name}-generator-%{version}.jar %{buildroot}%{_javadir}/%{name}/generator.jar
install -m 644 pom/%{name}-generator.pom %{buildroot}%{_mavenpomdir}/%{name}/generator.pom
%add_maven_depmap %{name}/generator.pom %{name}/generator.jar
install -m 644 build/%{name}-integration-%{version}.jar %{buildroot}%{_javadir}/%{name}/integration.jar
install -m 644 pom/%{name}-integration.pom %{buildroot}%{_mavenpomdir}/%{name}/integration.pom
%add_maven_depmap %{name}/integration.pom %{name}/integration.jar
install -m 644 build/%{name}-library-%{version}.jar %{buildroot}%{_javadir}/%{name}/library.jar
install -m 644 pom/%{name}-library.pom %{buildroot}%{_mavenpomdir}/%{name}/library.pom
%add_maven_depmap %{name}/library.pom %{name}/library.jar
# poms
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 %{SOURCE2} %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar -a "org.hamcrest:hamcrest-all,org.hamcrest:hamcrest-core,org.hamcrest:hamcrest-library"
# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr build/temp/hamcrest-all-%{version}-javadoc.jar.contents/* %{buildroot}%{_javadocdir}/%{name}
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}
# demo
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -pr %{name}-examples %{buildroot}%{_datadir}/%{name}/
%files -f .mfiles
%defattr(0644,root,root,0755)
%license LICENSE.txt
%files core -f .mfiles-core
%defattr(0644,root,root,0755)
%{_javadir}/%{name}
%license LICENSE.txt
%doc README.md
%files javadoc
%defattr(0644,root,root,0755)
%license LICENSE.txt
%{_javadocdir}/%{name}
%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}
%changelog