Skip to content

Commit eaf2e82

Browse files
authored
Consolidate boilerplate build.xml files into shared templates (#7117)
* Consolidate boilerplate build.xml files into shared templates Extract duplicated Ant targets and build logic into shared template files, replacing 29 external and 9 system boilerplate build.xml files with minimal stubs that import a generic template. external/: - external-targets.xml: shared targets (move_scripts, clean_image, build_image, prepare_base_image, copy_dest) extracted from build.xml - external-test.xml: generic child template with auto-derived TEST name and configurable pipeline via build.properties - 29 children converted to 3-line stubs importing external-test.xml - 12 build.properties files for non-default pipeline behaviour (skip.impls, do.prepare, do.build_image, do.move_scripts, etc.) - 3 custom tests (criu-ubi-portable-checkpoint, external_custom, tck-ubi-test) updated to import external-targets.xml directly - build.xml reduced to orchestrator-only (init, subant, dist, prune) system/: - system-test.xml: generic child template with auto-derived DEST, init + common_build + copy pattern - 9 identical children converted to stubs importing system-test.xml - churn and jcstress left unchanged (unique logic) Net result: 57 files changed, -604 lines of duplicated XML. * Fix system-test.xml import path for common.xml Ant resolves <import> paths relative to the project basedir, not the importing file's directory, when processing chained imports via subant. Use ${TEST_ROOT} to ensure the absolute path to common.xml is correct regardless of the build context.
1 parent 4e25023 commit eaf2e82

57 files changed

Lines changed: 322 additions & 685 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

external/aot/build.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
do.prepare=true
2+
do.build_image=false

external/aot/build.xml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
<?xml version="1.0"?>
2-
<project name="aot" default="build" basedir=".">
3-
<description>
4-
Build aot Test
5-
</description>
6-
<import file="${TEST_ROOT}/external/build.xml"/>
7-
8-
<!-- set properties for this build -->
9-
<property name="TEST" value="aot" />
10-
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
11-
<property name="src" location="." />
12-
13-
<target name="prepare_base_image" depends="move_scripts,clean_image" description="prepare the base image">
14-
<echo message="Executing external.sh --prepare --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --base_docker_registry_url 'icr.io' --base_docker_registry_dir 'default' --docker_args ${extra_docker_args} " />
15-
<exec executable="bash" failonerror="true">
16-
<arg value="${DEST_EXTERNAL}/external.sh"/>
17-
<arg value="--prepare"/>
18-
<arg value="--dir"/>
19-
<arg value="${TEST}"/>
20-
<arg value="--tag"/>
21-
<arg value="${dockerImageTag}"/>
22-
<arg value="--version"/>
23-
<arg value="${JDK_VERSION}"/>
24-
<arg value="--impl"/>
25-
<arg value="${JDK_IMPL}"/>
26-
<arg value="--base_docker_registry_url"/>
27-
<arg value="icr.io"/>
28-
<arg value="--base_docker_registry_dir"/>
29-
<arg value="default"/>
30-
<arg value="--docker_args"/>
31-
<arg value="${extra_docker_args}"/>
32-
</exec>
33-
</target>
34-
35-
<target name="build" depends="prepare_base_image, copy_dest" />
2+
<project default="build" basedir=".">
3+
<import file="${TEST_ROOT}/external/external-test.xml" />
364
</project>

external/build.xml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,7 @@
1919
Build external tests
2020
</description>
2121

22-
<!-- set properties for this build -->
23-
<property name="DEST_EXTERNAL" value="${BUILD_ROOT}/external" />
24-
<property environment="env" />
25-
<property name="top" location="../" />
26-
27-
<set-property name="DOCKERIMAGE_TAG_ISSET" if-property-isset="env.DOCKERIMAGE_TAG"/>
28-
<set-property name="EXTRA_DOCKER_ARGS_ISSET" if-property-isset="env.EXTRA_DOCKER_ARGS"/>
29-
<condition property="dockerImageTag" value="${env.DOCKERIMAGE_TAG}" else="nightly">
30-
<isset property="DOCKERIMAGE_TAG_ISSET"/>
31-
</condition>
32-
<condition property="extra_docker_args" value="${env.EXTRA_DOCKER_ARGS}" else="">
33-
<isset property="EXTRA_DOCKER_ARGS_ISSET"/>
34-
</condition>
22+
<import file="external-targets.xml" />
3523

3624
<target name="init">
3725
<mkdir dir="${DEST_EXTERNAL}" />
@@ -51,62 +39,9 @@
5139
</target>
5240

5341
<target name="docker_prune" description="Remove all unused images from the machine before running new builds">
54-
<exec executable="bash">
55-
<arg value="${DEST_EXTERNAL}/external.sh"/>
56-
<arg value="--prune"/>
57-
</exec>
58-
</target>
59-
60-
<target name="clean_image" description="clean test docker image if there is one">
61-
<echo message="Executing external.sh --clean --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} " />
6242
<exec executable="bash">
6343
<arg value="${DEST_EXTERNAL}/external.sh"/>
64-
<arg value="--clean"/>
65-
<arg value="--dir"/>
66-
<arg value="${TEST}"/>
67-
<arg value="--tag"/>
68-
<arg value="${dockerImageTag}"/>
69-
<arg value="--version"/>
70-
<arg value="${JDK_VERSION}"/>
71-
<arg value="--impl"/>
72-
<arg value="${JDK_IMPL}"/>
73-
</exec>
74-
</target>
75-
76-
<target name="move_scripts" description="move shell scripts to working directory">
77-
<copy todir="${DEST_EXTERNAL}/${TEST}">
78-
<fileset dir="${src}/" includes="*.sh, *.properties"/>
79-
</copy>
80-
<copy todir="${DEST_EXTERNAL}">
81-
<fileset dir="${top}" includes="*.sh common.properties"/>
82-
</copy>
83-
</target>
84-
85-
<target name="build_image" description="build test dockerfile">
86-
<echo message="Executing external.sh --build --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --platform ${env.SPEC} --docker_args ${extra_docker_args} " />
87-
<exec executable="bash" failonerror="true">
88-
<arg value="${DEST_EXTERNAL}/external.sh"/>
89-
<arg value="--build"/>
90-
<arg value="--dir"/>
91-
<arg value="${TEST}"/>
92-
<arg value="--tag"/>
93-
<arg value="${dockerImageTag}"/>
94-
<arg value="--version"/>
95-
<arg value="${JDK_VERSION}"/>
96-
<arg value="--impl"/>
97-
<arg value="${JDK_IMPL}"/>
98-
<arg value="--platform"/>
99-
<arg value="${env.SPEC}"/>
100-
<arg value="--docker_args"/>
101-
<arg value="${extra_docker_args}"/>
44+
<arg value="--prune"/>
10245
</exec>
10346
</target>
104-
<target name="copy_dest" >
105-
<copy todir="${DEST}">
106-
<fileset dir="${src}" includes="*.xml, *.mk, *.sh"/>
107-
</copy>
108-
<copy todir="${src}">
109-
<fileset dir="${DEST}" includes="**/Dockerfile.*"/>
110-
</copy>
111-
</target>
11247
</project>

external/camel/build.xml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
<?xml version="1.0"?>
2-
<project name="Camel-Test" default="build" basedir=".">
3-
<description>
4-
Build camel-test Docker image
5-
</description>
6-
<import file="${TEST_ROOT}/external/build.xml"/>
7-
8-
<!-- set properties for this build -->
9-
<property name="TEST" value="camel" />
10-
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
11-
<property name="src" location="." />
12-
13-
<target name="build" depends="move_scripts,clean_image,build_image,copy_dest" />
2+
<project default="build" basedir=".">
3+
<import file="${TEST_ROOT}/external/external-test.xml" />
144
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
do.prepare=true

external/criu-functional/build.xml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
<?xml version="1.0"?>
2-
<project name="criu-functional" default="build" basedir=".">
3-
<description>
4-
Build criu-functional Docker image
5-
</description>
6-
<import file="${TEST_ROOT}/external/build.xml"/>
7-
8-
<!-- set properties for this build -->
9-
<property name="TEST" value="criu-functional" />
10-
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
11-
<property name="src" location="." />
12-
13-
<target name="prepare_base_image" depends="move_scripts,clean_image" description="prepare the base image">
14-
<echo message="Executing external.sh --prepare --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --base_docker_registry_url 'icr.io' --base_docker_registry_dir 'default' --docker_args ${extra_docker_args} " />
15-
<exec executable="bash" failonerror="true">
16-
<arg value="${DEST_EXTERNAL}/external.sh"/>
17-
<arg value="--prepare"/>
18-
<arg value="--dir"/>
19-
<arg value="${TEST}"/>
20-
<arg value="--tag"/>
21-
<arg value="${dockerImageTag}"/>
22-
<arg value="--version"/>
23-
<arg value="${JDK_VERSION}"/>
24-
<arg value="--impl"/>
25-
<arg value="${JDK_IMPL}"/>
26-
<arg value="--base_docker_registry_url"/>
27-
<arg value="icr.io"/>
28-
<arg value="--base_docker_registry_dir"/>
29-
<arg value="default"/>
30-
<arg value="--docker_args"/>
31-
<arg value="${extra_docker_args}"/>
32-
</exec>
33-
</target>
34-
35-
<target name="build" depends="prepare_base_image,build_image,copy_dest" />
2+
<project default="build" basedir=".">
3+
<import file="${TEST_ROOT}/external/external-test.xml" />
364
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
do.prepare=true
Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
<?xml version="1.0"?>
2-
<project name="criu-portable-checkpoint" default="build" basedir=".">
3-
<description>
4-
Build criu-portable-checkpoint Test
5-
</description>
6-
<import file="${TEST_ROOT}/external/build.xml"/>
7-
8-
<!-- set properties for this build -->
9-
<property name="TEST" value="criu-portable-checkpoint" />
10-
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
11-
<property name="src" location="." />
12-
13-
<target name="prepare_base_image" depends="move_scripts,clean_image" description="prepare the base image">
14-
<echo message="Executing external.sh --prepare --dir ${TEST} --tag ${dockerImageTag} --version ${JDK_VERSION} --impl ${JDK_IMPL} --base_docker_registry_url 'icr.io' --base_docker_registry_dir 'default' --docker_args ${extra_docker_args} " />
15-
<exec executable="bash" failonerror="true">
16-
<arg value="${DEST_EXTERNAL}/external.sh"/>
17-
<arg value="--prepare"/>
18-
<arg value="--dir"/>
19-
<arg value="${TEST}"/>
20-
<arg value="--tag"/>
21-
<arg value="${dockerImageTag}"/>
22-
<arg value="--version"/>
23-
<arg value="${JDK_VERSION}"/>
24-
<arg value="--impl"/>
25-
<arg value="${JDK_IMPL}"/>
26-
<arg value="--base_docker_registry_url"/>
27-
<arg value="icr.io"/>
28-
<arg value="--base_docker_registry_dir"/>
29-
<arg value="default"/>
30-
<arg value="--docker_args"/>
31-
<arg value="${extra_docker_args}"/>
32-
</exec>
33-
</target>
34-
35-
<target name="build" depends="prepare_base_image,build_image,copy_dest" />
2+
<project default="build" basedir=".">
3+
<import file="${TEST_ROOT}/external/external-test.xml" />
364
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
do.build_image=false
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
<?xml version="1.0"?>
2-
<project name="criu-portable-restore" default="build" basedir=".">
3-
<description>
4-
Build criu-portable-restore Test
5-
</description>
6-
<import file="${TEST_ROOT}/external/build.xml"/>
7-
8-
<!-- set properties for this build -->
9-
<property name="TEST" value="criu-portable-restore" />
10-
<property name="DEST" value="${BUILD_ROOT}/external/${TEST}" />
11-
<property name="src" location="." />
12-
13-
<target name="build" depends="move_scripts,clean_image,copy_dest" />
14-
2+
<project default="build" basedir=".">
3+
<import file="${TEST_ROOT}/external/external-test.xml" />
154
</project>

0 commit comments

Comments
 (0)