From de1f11cb0229a26d8019465d9f834b9e205db8e0 Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 9 Aug 2023 17:25:23 +0200 Subject: [PATCH 1/3] LayoutDirDistribution does proper needsRebuild check --- mx.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mx.py b/mx.py index ecfe7f71..7e54176a 100755 --- a/mx.py +++ b/mx.py @@ -6462,11 +6462,6 @@ def needsUpdate(self, newestInput): sup = super(LayoutDistribution, self).needsUpdate(newestInput) if sup: return sup - else: - if self.output: - output_up = _needsUpdate(newestInput, self.get_output()) - if output_up: - return output_up for destination, source in self._walk_layout(): source_type = source['source_type'] if source_type == 'file': @@ -6645,6 +6640,8 @@ class LayoutDirDistribution(LayoutDistribution, ClasspathDependency): # A layout distribution that is not archived, useful to define the contents of a directory. # When added as a dependency of a JarDistribution, it is included in the jar. It is not appended to the classpath # unless `classpath_entries` is called with `preferProjects=True`. + # We use a dummy sentinel file as the "archive" such that the LayoutDistribution machinery including + # rebuild detection works as expected def __init__(self, *args, **kw_args): # we have *args here because some subclasses in suites have been written passing positional args to # LayoutDistribution.__init__ instead of keyword args. We just forward it as-is to super(), it's risky but better @@ -6657,6 +6654,11 @@ def __init__(self, *args, **kw_args): def classpath_repr(self, resolve=True): return self.get_output() + def make_archive(self): + super().make_archive() + with open(self._default_path(), 'w'): + pass + def getArchivableResults(self, use_relpath=True, single=False): if single: raise ValueError("{} only produces multiple output".format(self)) @@ -6668,10 +6670,10 @@ def getArchivableResults(self, use_relpath=True, single=False): yield file_path, archive_path def remoteExtension(self): - return 'does_not_exist' + return 'sentinel' def localExtension(self): - return 'does_not_exist' + return 'sentinel' class LayoutTARDistribution(LayoutDistribution, AbstractTARDistribution): @@ -18586,7 +18588,7 @@ def alarm_handler(signum, frame): abort(1, killsig=signal.SIGINT) # The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue -version = VersionSpec("6.39.1") # Compute java homes lazily to respect env files priority +version = VersionSpec("6.39.2") # LayoutDirDistribution does proper needsRebuild check _mx_start_datetime = datetime.utcnow() _last_timestamp = _mx_start_datetime From 9dbae73c774e0c1c05808ef3936d2ae0c182081d Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 9 Aug 2023 20:13:26 +0200 Subject: [PATCH 2/3] Sync CI files --- common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.json b/common.json index af80f923..24fc827e 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.38.0", + "mx_version": "6.39.0", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { From 9a7b291fdcedd9063bf9e9ab66283f211546e6fd Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 9 Aug 2023 22:05:05 +0200 Subject: [PATCH 3/3] LayoutDirDistribution: make sure the output directory for the sentinel exists --- mx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mx.py b/mx.py index 7e54176a..759ca920 100755 --- a/mx.py +++ b/mx.py @@ -6656,7 +6656,9 @@ def classpath_repr(self, resolve=True): def make_archive(self): super().make_archive() - with open(self._default_path(), 'w'): + sentinel = self._default_path() + os.makedirs(os.path.abspath(os.path.dirname(sentinel)), exist_ok=True) + with open(sentinel, 'w'): pass def getArchivableResults(self, use_relpath=True, single=False):