Skip to content

Commit 682e139

Browse files
committed
merge copy-additional
1 parent 09ab9d0 commit 682e139

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

scripts/build/docker-compose.build.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -264,24 +264,24 @@ services:
264264
fi
265265
echo 'JDK 21 Maven build completed'
266266
267-
copy-jacoco:
268-
image: alpine:latest
269-
volumes:
270-
- ${DIST_FOLDER}:/dist
271-
- ${JACOCO_FOLDER}:/jacoco
272-
command: >
273-
sh -c "cp /jacoco/jacocoagent.jar /dist/ &&
274-
cp /jacoco/jacococli.jar /dist/ &&
275-
echo 'Jacoco files copied'"
276-
277-
copy-evomaster-agent:
267+
copy-additional-files:
278268
image: alpine:latest
279269
volumes:
280270
- ${HOME}/.m2:/root/.m2
281271
- ${DIST_FOLDER}:/dist
282-
command: >
283-
sh -c "cp /root/.m2/repository/org/evomaster/evomaster-client-java-instrumentation/${EVOMASTER_VERSION}/evomaster-client-java-instrumentation-${EVOMASTER_VERSION}.jar /dist/evomaster-agent.jar &&
284-
echo 'evomaster-agent.jar copied'"
272+
- ${JACOCO_FOLDER}:/jacoco
273+
command:
274+
- sh
275+
- -c
276+
- |
277+
set -e
278+
cp /jacoco/jacocoagent.jar /dist/
279+
cp /jacoco/jacococli.jar /dist/
280+
echo 'Jacoco files copied'
281+
if [ "$${BUILD_EVOMASTER:-false}" = "true" ]; then
282+
cp /root/.m2/repository/org/evomaster/evomaster-client-java-instrumentation/${EVOMASTER_VERSION}/evomaster-client-java-instrumentation-${EVOMASTER_VERSION}.jar /dist/evomaster-agent.jar
283+
echo 'evomaster-agent.jar copied'
284+
fi
285285
286286
volumes:
287287
gradle-cache-jdk8:

scripts/dist-docker.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,11 @@ def run_build(compose, service, *, background=False, evomaster=False):
6565
return subprocess.run(cmd, check=False)
6666

6767

68-
def copy_jacoco(compose):
69-
print(">>> Copying jacoco files to dist...")
70-
run(compose + ["-f", COMPOSE_FILE, "run", "--rm", "-T", "copy-jacoco"])
71-
print("Jacoco files copied!\n")
72-
73-
74-
def copy_evomaster_agent(compose):
75-
print(">>> Copying evomaster-agent to dist...")
76-
run(compose + ["-f", COMPOSE_FILE, "run", "--rm", "-T", "copy-evomaster-agent"])
77-
print("evomaster-agent.jar copied!\n")
68+
def copy_additional_files(compose, *, evomaster=False):
69+
print(">>> Copying additional files to dist...")
70+
env_args = ["-e", "BUILD_EVOMASTER=true"] if evomaster else []
71+
run(compose + ["-f", COMPOSE_FILE, "run", "--rm", "-T"] + env_args + ["copy-additional-files"])
72+
print("Additional files copied!\n")
7873

7974

8075
def show_jar(path):
@@ -109,8 +104,8 @@ def parse_args():
109104
" dist-docker.py --parallel # Build all projects in parallel\n"
110105
" dist-docker.py 8 gradle # Build only JDK 8 Gradle projects\n"
111106
" dist-docker.py 11 maven -p # Build JDK 11 Maven in parallel mode\n"
112-
" dist-docker.py --copy-files # Only copy jacoco files\n"
113-
" dist-docker.py --copy-files -E # Only copy jacoco + evomaster-agent files\n"
107+
" dist-docker.py --copy-files # Only copy additional files (jacoco)\n"
108+
" dist-docker.py --copy-files -E # Copy additional files (jacoco + evomaster-agent)\n"
114109
" dist-docker.py --interactive # Prompt before deleting dist/ on full build\n"
115110
" dist-docker.py --evomaster # Also build evomaster runners + copy evomaster-agent\n"
116111
" dist-docker.py -E --parallel # Full build in parallel"
@@ -191,9 +186,7 @@ def main():
191186
print("Copy Additional Files Only Mode")
192187
dist_dir.mkdir(parents=True, exist_ok=True)
193188
os.chdir(PROJ_DIR)
194-
copy_jacoco(compose)
195-
if args.evomaster:
196-
copy_evomaster_agent(compose)
189+
copy_additional_files(compose, evomaster=args.evomaster)
197190
print("Files copied successfully!")
198191
for f in ["evomaster-agent.jar", "jacocoagent.jar", "jacococli.jar"]:
199192
show_jar(f)
@@ -335,9 +328,7 @@ def main():
335328
sys.exit(1)
336329
print(f" Completed in {svc_elapsed}\n")
337330

338-
copy_jacoco(compose)
339-
if args.evomaster:
340-
copy_evomaster_agent(compose)
331+
copy_additional_files(compose, evomaster=args.evomaster)
341332

342333
# Cleanup
343334
print("Cleaning up Docker containers...")

0 commit comments

Comments
 (0)