Skip to content

Commit 50c1420

Browse files
committed
Enhance build scripts to check for up-to-date artifacts before creation
Don't rebuild jars if nothing changed! See #2233
1 parent be5a92e commit 50c1420

3 files changed

Lines changed: 51 additions & 22 deletions

File tree

apitools/org.eclipse.pde.api.tools/scripts/buildApiToolsAntSupportJar.xml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
Copyright (c) IBM Corporation and others 2008, 2013 This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.
4-
4+
55
All Platform Debug contexts, those for org.eclipse.debug.ui, are located in this file
66
All contexts are grouped by their relation, with all relations grouped alphabetically.
77
-->
88
<project name="Build API Tools Ant Support Jar" default="build" basedir="..">
99

10-
<target name="build" description="Cleans, builds and refreshes" depends="clean, lib/apitooling-ant.jar"/>
10+
<target name="build" description="Builds if needed" depends="lib/apitooling-ant.jar"/>
1111

1212
<target name="init" depends="properties">
1313
<property name="temp.folder" value="${basedir}/temp.folder"/>
@@ -17,15 +17,30 @@
1717
<target name="properties" if="eclipse.running">
1818
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
1919
</target>
20-
21-
<target name="lib/apitooling-ant.jar" description= "Creates the lib/apitooling-ant.jar" depends="init">
20+
21+
<target name="check.uptodate" depends="init">
22+
<!-- Check if the jar is up-to-date with respect to all source inputs -->
23+
<uptodate property="lib/apitooling-ant.jar.uptodate"
24+
targetfile="${build.result.folder}/lib/apitooling-ant.jar">
25+
<srcresources>
26+
<fileset dir="${basedir}/src_ant/"/>
27+
<fileset dir="xml/">
28+
<exclude name="**/*.xsd"/>
29+
<exclude name="**/*.xml"/>
30+
</fileset>
31+
</srcresources>
32+
</uptodate>
33+
</target>
34+
35+
<target name="lib/apitooling-ant.jar" description="Creates the lib/apitooling-ant.jar"
36+
depends="check.uptodate" unless="lib/apitooling-ant.jar.uptodate">
2237
<property name="destdir" value="${temp.folder}/lib/apitooling-ant.bin"/>
2338
<delete dir="${destdir}"/>
2439
<mkdir dir="${destdir}"/>
2540
<!-- copy necessary resources -->
26-
<copy todir="${destdir}">
27-
<fileset dir="${basedir}/bin_ant/"/>
28-
</copy>
41+
<copy todir="${destdir}">
42+
<fileset dir="${basedir}/bin_ant/"/>
43+
</copy>
2944
<!-- copy default XSLT files to the jar location -->
3045
<copy todir="${destdir}" failonerror="true" overwrite="false">
3146
<fileset dir="xml/">

build/org.eclipse.pde.build/localbuild.xml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
https://www.eclipse.org/legal/epl-2.0/
99
1010
SPDX-License-Identifier: EPL-2.0
11-
11+
1212
Contributors:
1313
IBM Corporation - initial API and implementation
1414
-->
@@ -19,25 +19,31 @@
1919
gathering up the results of a workspace build from bin_ant.
2020
</description>
2121

22-
<!-- =================================
23-
target: default
22+
<!-- =================================
23+
target: default
2424
================================= -->
25-
<target name="default" description="--> description">
25+
<target name="default" depends="checkSourceUpToDate" unless="pdebuild-ant.jar.uptodate"
26+
description="Build pdebuild-ant.jar from source if needed">
2627
<tstamp/>
27-
<eclipse.buildScript elements="plugin@org.eclipse.pde.build"
28-
buildDirectory="${buildDirectory}"
29-
configInfo="*,*,*"
30-
baseLocation="${baseLocation}"
28+
<eclipse.buildScript elements="plugin@org.eclipse.pde.build"
29+
buildDirectory="${buildDirectory}"
30+
configInfo="*,*,*"
31+
baseLocation="${baseLocation}"
3132
outputUpdateJars="false"
3233
pluginpath="${thisPlugin}"
3334
forceContextQualifier="z${DSTAMP}${TSTAMP}"
3435
/>
35-
<delete file="lib/pdebuild-ant.jar" failonerror="false"/>
3636
<ant antfile="build.xml" target="lib/pdebuild-ant.jar"/>
3737
</target>
38-
<target name="workspaceBinaries" description="Jar up the binaries that were compiled by the jdt builder" >
38+
<target name="checkSourceUpToDate">
39+
<uptodate property="pdebuild-ant.jar.uptodate" targetfile="lib/pdebuild-ant.jar">
40+
<srcfiles dir="src_ant" includes="**/*"/>
41+
</uptodate>
42+
</target>
43+
44+
<target name="workspaceBinaries" depends="checkSourceUpToDate" unless="pdebuild-ant.jar.uptodate"
45+
description="Jar up the binaries that were compiled by the jdt builder">
3946
<mkdir dir="lib" />
40-
<delete file="lib/pdebuild-ant.jar" failonerror="false"/>
4147
<jar destfile="lib/pdebuild-ant.jar" basedir="bin_ant"/>
4248
</target>
4349
</project>

ui/org.eclipse.pde.core/localbuild.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
<!-- =================================
2323
target: default
2424
================================= -->
25-
<target name="default" description="--> description">
25+
<target name="default" depends="checkSourceUpToDate" unless="pde-ant.jar.uptodate"
26+
description="Build pde-ant.jar from scratch if sources have changed">
2627
<tstamp/>
2728
<eclipse.buildScript elements="plugin@org.eclipse.pde.core"
2829
buildDirectory="${buildDirectory}"
@@ -33,12 +34,19 @@
3334
pluginpath="${thisPlugin}"
3435
forceContextQualifier="z${DSTAMP}${TSTAMP}"
3536
/>
36-
<delete file="ant_tasks/pde-ant.jar" failonerror="false"/>
3737
<ant antfile="build.xml" target="ant_tasks/pde-ant.jar"/>
3838
</target>
39-
<target name="workspaceBinaries" description="Jar up the binaries that were compiled by the jdt builder" >
39+
40+
<target name="checkSourceUpToDate">
41+
<uptodate property="pde-ant.jar.uptodate" targetfile="ant_tasks/pde-ant.jar">
42+
<srcfiles dir="src_ant" includes="**/*"/>
43+
</uptodate>
44+
</target>
45+
46+
<target name="workspaceBinaries" depends="checkSourceUpToDate" unless="pde-ant.jar.uptodate"
47+
description="Jar up the binaries that were compiled by the jdt builder">
4048
<mkdir dir="ant_tasks" />
41-
<delete file="ant_tasks/pde-ant.jar" failonerror="false"/>
4249
<jar destfile="ant_tasks/pde-ant.jar" basedir="binary"/>
4350
</target>
51+
4452
</project>

0 commit comments

Comments
 (0)