Skip to content

Commit 39b5b5d

Browse files
committed
set maven.repo.local in MAVEN_OPTS to have a new maven cache for each job
1 parent 94550a7 commit 39b5b5d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,24 @@ def graalvm_jdk():
944944
mx.run_mx(mx_args + ["graalvm-home"], out=out)
945945
return out.data.splitlines()[-1].strip()
946946

947+
def get_maven_cache():
948+
buildnr = os.environ.get('BUILD_NUMBER')
949+
# don't worry about maven.repo.local if not running on gate
950+
return os.path.join(SUITE.get_mx_output_dir(), 'm2_cache_' + buildnr) if buildnr else None
947951

948952
def deploy_local_maven_repo():
949953
if not DISABLE_REBUILD:
954+
env = os.environ.copy()
955+
m2_cache = get_maven_cache()
956+
if m2_cache:
957+
mvn_repo_local = f'-Dmaven.repo.local={m2_cache}'
958+
maven_opts = env.get('MAVEN_OPTS')
959+
maven_opts = maven_opts + " " + mvn_repo_local if maven_opts else mvn_repo_local
960+
env['MAVEN_OPTS'] = maven_opts
961+
mx.log(f'Added {mvn_repo_local} to MAVEN_OPTS={maven_opts}')
962+
950963
# build GraalPy and all the necessary dependencies, so that we can deploy them
951-
mx.run_mx(["build"])
964+
mx.run_mx(["build"], env=env)
952965
# deploy maven artifacts
953966
version = GRAAL_VERSION
954967
path = os.path.join(SUITE.get_mx_output_dir(), 'public-maven-repo')

0 commit comments

Comments
 (0)