aboutsummaryrefslogtreecommitdiff
path: root/buildScripts
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-12-04 05:03:36 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2020-12-04 07:14:14 +0100
commitea442e676c9a44aefef7e2c22ac546ffd32f87c1 (patch)
treed5cac321d32fd5add533da8f7616c3434a1edcf3 /buildScripts
parent59bf969500d997382fdc0c83d21ed4bf2d6a401c (diff)
downloadlombok-ea442e676c9a44aefef7e2c22ac546ffd32f87c1.tar.gz
lombok-ea442e676c9a44aefef7e2c22ac546ffd32f87c1.tar.bz2
lombok-ea442e676c9a44aefef7e2c22ac546ffd32f87c1.zip
[build] the build can now autoclean
autocleaning means that the build system detects that the usual incremental mode, where the build artefacts are not deleted and instead used to skip steps already performed, is not an option due to changes in the build script itself or a change in deps not detectable. It works by having a version number which can be incremented, and a system that checks for mismatches and forces a clean.
Diffstat (limited to 'buildScripts')
-rw-r--r--buildScripts/build-support.ant.xml2
-rw-r--r--buildScripts/compile.ant.xml8
-rw-r--r--buildScripts/mapstructBinding.ant.xml2
-rw-r--r--buildScripts/maven.ant.xml2
-rw-r--r--buildScripts/setup.ant.xml34
5 files changed, 41 insertions, 7 deletions
diff --git a/buildScripts/build-support.ant.xml b/buildScripts/build-support.ant.xml
index 107f5f47..d6439cb0 100644
--- a/buildScripts/build-support.ant.xml
+++ b/buildScripts/build-support.ant.xml
@@ -50,7 +50,7 @@ None of these tasks are normally needed, unless modifying how the build works, s
<input addproperty="target.jdk">You need to specify the JDK9+ jdk whose jdk.compiler and java.compiler modules are to be converted. Run ant with -Dtarget.jdk=/full/path/here to automate this, or type the path in now (for example: /Library/JavaVirtualMachines/jdk-14.jdk/Contents/Home):</input>
</target>
- <target name="make.javac-patch-jar" depends="-ask.target-jdk" description="to test javac13 on JDK14, for example, you need a jar (not a jmod), to use with --patch-modules. This task makes those.">
+ <target name="make.javac-patch-jar" depends="-ask.target-jdk, -setup.build" description="to test javac13 on JDK14, for example, you need a jar (not a jmod), to use with --patch-modules. This task makes those.">
<exec executable="${target.jdk}/bin/java${executable.suffix}" outputproperty="target.javac.version.full" errorproperty="target.javac.version.err">
<arg value="--version" />
</exec>
diff --git a/buildScripts/compile.ant.xml b/buildScripts/compile.ant.xml
index 047558a5..c456ec75 100644
--- a/buildScripts/compile.ant.xml
+++ b/buildScripts/compile.ant.xml
@@ -27,7 +27,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<property name="mapstruct-binding.version" value="0.2.0" />
<!-- compiles just 'version.java' and runs the produced class file, setting up the various version properties -->
- <target name="version" depends="ipp.setup, deps.jdk-runtime" description="Shows the version number" unless="lombok.version">
+ <target name="version" depends="ipp.setup, deps.jdk-runtime, -setup.build" description="Shows the version number" unless="lombok.version">
<mkdir dir="build/lombok" />
<ivy:compile destdir="build/lombok" source="1.5" target="1.5" ecj="true" nowarn="true">
<bootclasspath path="${jdk6-rt.loc}" />
@@ -51,7 +51,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and buil
<echo level="info">Lombok version: ${lombok.version} (${lombok.fullversion})</echo>
</target>
- <target name="compile" depends="version, deps" description="Compiles the code">
+ <target name="compile" depends="version, deps, -setup.build" description="Compiles the code">
<!--
1. Compile stubs.
2. Compile lombok-utils.
@@ -218,7 +218,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo>
</target>
<!-- compiles the bit of API from mapstruct that lombok compiles against. -->
- <target name="mapstruct.compile">
+ <target name="mapstruct.compile" depends="-setup.build">
<mkdir dir="build/mapstruct" />
<ivy:compile destdir="build/mapstruct" release="8">
<src path="src/j9stubs" />
@@ -294,7 +294,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor,isolating</echo>
<property name="lombok.dist.built" value="true" />
</target>
- <target name="compile.support" depends="ipp.setup, deps" description="Compiles code that is used solely by the build, such as website and IDE project creation">
+ <target name="compile.support" depends="ipp.setup, deps, -setup.build" description="Compiles code that is used solely by the build, such as website and IDE project creation">
<ivy:compile includeDestClasses="false" includeantruntime="false" destdir="build/support" debug="on" source="1.8" target="1.8">
<compilerarg value="-proc:none" />
<compilerarg value="-Xlint:-options" />
diff --git a/buildScripts/mapstructBinding.ant.xml b/buildScripts/mapstructBinding.ant.xml
index a78c5351..d7c52dc3 100644
--- a/buildScripts/mapstructBinding.ant.xml
+++ b/buildScripts/mapstructBinding.ant.xml
@@ -26,7 +26,7 @@ version on mavencentral is the last version that is ever needed; the code itself
exists as a separate dependency solely because it is itself dependent on both lombok and mapstruct.
</description>
- <target name="-mapstructBinding.compile">
+ <target name="-mapstructBinding.compile" depends="-setup.build">
<mkdir dir="build/mapstruct" />
<javac includeAntRuntime="false" source="1.8" target="1.8" destdir="build/mapstruct">
<src path="src/j9stubs" />
diff --git a/buildScripts/maven.ant.xml b/buildScripts/maven.ant.xml
index dcba2ccb..57bb6b99 100644
--- a/buildScripts/maven.ant.xml
+++ b/buildScripts/maven.ant.xml
@@ -59,7 +59,7 @@ This buildfile is part of projectlombok.org. It makes maven-compatible repositor
</sequential>
</macrodef>
- <target name="maven" depends="version, dist, javadoc.build" description="Creates a maven repo for the current release into a build dir. The intent is for you to put that on a server someplace. Will invoke your local mvn installation.">
+ <target name="maven" depends="version, dist, javadoc.build, -setup.build" description="Creates a maven repo for the current release into a build dir. The intent is for you to put that on a server someplace. Will invoke your local mvn installation.">
<mkdir dir="build" />
<mkdir dir="dist" />
diff --git a/buildScripts/setup.ant.xml b/buildScripts/setup.ant.xml
index ed835960..7875f27d 100644
--- a/buildScripts/setup.ant.xml
+++ b/buildScripts/setup.ant.xml
@@ -24,6 +24,9 @@
This buildfile is part of projectlombok.org. It sets up the build itself.
</description>
+ <!-- increment this number to force a clean of the 'build' dir -->
+ <property name="build.version" value="1" />
+
<property name="pattern.jdk11plus" value="^(\d\d\d+|1[1-9]|[2-9]\d)(\..*)?$" />
<property name="ivy.retrieve.pattern" value="lib/[conf]/[organisation]-[artifact].[ext]" />
<property environment="env" />
@@ -84,6 +87,37 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<target name="setup.ssh" depends="-setup.ssh.ask, -setup.ssh.save" />
+ <target name="-autoclean.check">
+ <available type="dir" file="build" property="existingbuild.present" />
+ <loadresource property="existingbuild.ver">
+ <first count="1">
+ <resources>
+ <restrict>
+ <fileset dir="." includes="build/build-ver.txt" />
+ <exists />
+ </restrict>
+ <string>0</string>
+ </resources>
+ </first>
+ </loadresource>
+ <condition property="existingbuild.mismatch">
+ <and>
+ <isset property="existingbuild.present" />
+ <not><equals arg1="${existingbuild.ver}" arg2="${build.version}" trim="true" /></not>
+ </and>
+ </condition>
+ </target>
+
+ <target name="autoclean" depends="-autoclean.check" if="existingbuild.mismatch" description="Checks if a change in the build or deplist neccessitates a clean">
+ <echo>build ver has been incremented, neccessitating a clean...</echo>
+ <delete dir="build" />
+ </target>
+
+ <target name="-setup.build" depends="autoclean">
+ <mkdir dir="build" />
+ <echo file="build/build-ver.txt">${build.version}</echo>
+ </target>
+
<target name="clean" description="Removes all generated files.">
<delete dir="build" quiet="true" />
</target>