Skip to content

Commit 9ecee2f

Browse files
committed
factor out compilation
1 parent a24ab2e commit 9ecee2f

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

‎build.xml‎

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -190,28 +190,30 @@
190190
<macrodef name="compile-module">
191191
<attribute name="modulename" description="Name of the module to jar"/>
192192
<sequential>
193-
<mkdir dir="build/temp/@{modulename}-${version}-sources.jar.contents"/>
194-
<copy todir="build/temp/@{modulename}-${version}-sources.jar.contents">
195-
<fileset dir="@{modulename}/src/main/java"/>
196-
</copy>
197-
<mkdir dir="build/temp/@{modulename}-${version}.jar.contents"/>
198-
<javac srcdir="build/temp/@{modulename}-${version}-sources.jar.contents"
199-
destdir="build/temp/@{modulename}-${version}.jar.contents"
200-
debug="${debug}" source="1.5" target="1.5" includeantruntime="false">
201-
<classpath refid="cp-@{modulename}-main"/>
202-
</javac>
193+
<compile-content srcdir="@{modulename}/src/main/java" jarname="@{modulename}-${version}" classpathref="cp-@{modulename}-main" />
194+
<path id="cp-@{modulename}-test-complete">
195+
<path refid="cp-@{modulename}-main"/>
196+
<path refid="cp-@{modulename}-test"/>
197+
<path path="build/temp/@{modulename}-${version}.jar.contents"/>
198+
</path>
199+
<compile-content srcdir="@{modulename}/src/test/java" jarname="@{modulename}-${version}-tests" classpathref="cp-@{modulename}-test-complete" />
200+
</sequential>
201+
</macrodef>
203202

204-
<mkdir dir="build/temp/@{modulename}-${version}-tests-sources.jar.contents"/>
205-
<copy todir="build/temp/@{modulename}-${version}-tests-sources.jar.contents" failonerror="false">
206-
<fileset dir="@{modulename}/src/test/java"/>
203+
<macrodef name="compile-content">
204+
<attribute name="srcdir"/>
205+
<attribute name="jarname" description="Name of the jar whose content is being compiled (without .jar suffix)"/>
206+
<attribute name="classpathref"/>
207+
<sequential>
208+
<mkdir dir="build/temp/@{jarname}-sources.jar.contents"/>
209+
<copy todir="build/temp/@{jarname}-sources.jar.contents">
210+
<fileset dir="@{srcdir}"/>
207211
</copy>
208-
<mkdir dir="build/temp/@{modulename}-${version}-tests.jar.contents"/>
209-
<javac srcdir="build/temp/@{modulename}-${version}-tests-sources.jar.contents"
210-
destdir="build/temp/@{modulename}-${version}-tests.jar.contents"
212+
<mkdir dir="build/temp/@{jarname}.jar.contents"/>
213+
<javac srcdir="build/temp/@{jarname}-sources.jar.contents"
214+
destdir="build/temp/@{jarname}.jar.contents"
211215
debug="${debug}" source="1.5" target="1.5" includeantruntime="false">
212-
<classpath refid="cp-@{modulename}-main"/>
213-
<classpath refid="cp-@{modulename}-test"/>
214-
<classpath path="build/temp/@{modulename}-${version}.jar.contents"/>
216+
<classpath refid="@{classpathref}"/>
215217
</javac>
216218
</sequential>
217219
</macrodef>

0 commit comments

Comments
 (0)