Skip to content

Commit 2ceafe4

Browse files
committed
split out the hamcrest-api again, in an effort to rid the codebase of circular dependencies
1 parent 08f500d commit 2ceafe4

8 files changed

Lines changed: 41 additions & 7 deletions

File tree

.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3+
<classpathentry kind="src" path="hamcrest-api/src/main/java"/>
34
<classpathentry kind="src" path="hamcrest-core/src/main/java"/>
45
<classpathentry kind="src" path="build/temp/hamcrest-core/generated-code"/>
56
<classpathentry kind="src" path="hamcrest-generator/src/main/java"/>

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.xml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
<delete dir="build"/>
1212
</target>
1313

14+
<target name="api" description="Build Hamcrest APIs">
15+
<java-to-jar srcdir="hamcrest-api/src/main/java" modulename="hamcrest-api"/>
16+
</target>
17+
1418
<target name="generator" description="Build code generator tool">
1519
<java-to-jar srcdir="hamcrest-generator/src/main/java"
1620
modulename="hamcrest-generator-nodeps"
@@ -26,28 +30,42 @@
2630
<copy file="build/hamcrest-generator-nodeps-${version}-sources.jar" tofile="build/hamcrest-generator-${version}-sources.jar"/>
2731
</target>
2832

29-
<target name="core" depends="generator" description="Build core Hamcrest library">
30-
<java-to-jar srcdir="hamcrest-core/src/main/java" modulename="hamcrest-core"/>
33+
<target name="core" depends="api,generator" description="Build core Hamcrest library">
34+
<java-to-jar srcdir="hamcrest-core/src/main/java"
35+
modulename="hamcrest-core-nodeps"
36+
classpath="build/hamcrest-api-${version}.jar"/>
3137

3238
<!-- Generate one class with all static imports -->
3339
<mkdir dir="build/temp/hamcrest-core/generated-code"/>
34-
3540
<java classname="org.hamcrest.generator.config.XmlConfigurator"
3641
fork="yes"
3742
failonerror="yes"
3843
classpath="
39-
build/hamcrest-core-${version}.jar;
44+
build/hamcrest-api-${version}.jar;
45+
build/hamcrest-core-nodeps-${version}.jar;
4046
build/hamcrest-generator-${version}.jar;
4147
">
4248
<arg value="core-matchers.xml"/>
4349
<arg value="hamcrest-core/src/main/java"/>
4450
<arg value="org.hamcrest.CoreMatchers"/>
4551
<arg value="build/temp/hamcrest-core/generated-code"/>
4652
</java>
47-
<!-- Append to core jar -->
53+
54+
<!-- Append generated code to core jar -->
4855
<java-to-jar srcdir="build/temp/hamcrest-core/generated-code"
49-
modulename="hamcrest-core"
50-
classpath="build/hamcrest-core-${version}.jar"/>
56+
modulename="hamcrest-core-nodeps"
57+
classpath="build/hamcrest-api-${version}.jar;
58+
build/hamcrest-core-nodeps-${version}.jar"/>
59+
60+
<!-- Bundle api into core jar -->
61+
<jar jarfile="build/hamcrest-core-${version}.jar" duplicate="preserve">
62+
<zipfileset src="build/hamcrest-api-${version}.jar"/>
63+
<zipfileset src="build/hamcrest-core-nodeps-${version}.jar"/>
64+
</jar>
65+
<jar jarfile="build/hamcrest-core-${version}-sources.jar" duplicate="preserve">
66+
<zipfileset src="build/hamcrest-api-${version}-sources.jar"/>
67+
<zipfileset src="build/hamcrest-core-nodeps-${version}-sources.jar"/>
68+
</jar>
5169
</target>
5270

5371
<target name="library"
@@ -311,6 +329,7 @@
311329
<macrodef name="java-to-javadoc-jar" description="Generate javadoc for a module and build a Jar">
312330
<attribute name="modulename" description="Name of the module to document"/>
313331
<sequential>
332+
<unzip src="build/@{modulename}-${version}-sources.jar" dest="build/temp/@{modulename}-${version}-sources.jar.contents"/>
314333
<javadoc packagenames="org.hamcrest.*" sourcepath="build/temp/@{modulename}-${version}-sources.jar.contents" defaultexcludes="yes"
315334
destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true" use="true"
316335
windowtitle="Hamcrest" source="1.6" failonerror="yes">
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
12+

hamcrest-core/src/main/java/org/hamcrest/Description.java renamed to hamcrest-api/src/main/java/org/hamcrest/Description.java

File renamed without changes.
File renamed without changes.

hamcrest-core/src/main/java/org/hamcrest/SelfDescribing.java renamed to hamcrest-api/src/main/java/org/hamcrest/SelfDescribing.java

File renamed without changes.

hamcrest-core/src/main/hamcrest-core.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
</content>
88
<orderEntry type="inheritedJdk" />
99
<orderEntry type="sourceFolder" forTests="false" />
10+
<orderEntry type="module" module-name="hamcrest-api" />
1011
</component>
1112
</module>
1213

0 commit comments

Comments
 (0)