[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.
This commit is contained in:
Reinier Zwitserloot committed 2020-12-04 07:14:14 +01:00
1 parent 59bf969500
commit ea442e676c
5 files changed
+41 -7

No files matched your search

+1 -1
View File
@@ -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>
+4 -4
View File
@@ -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" />
+1 -1
View File
@@ -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" />
+1 -1
View File
@@ -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" />
+34
View File
@@ -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>