Skip to content

Commit

Permalink
[GR-47858] LayoutDirDistribution does proper needsRebuild check.
Browse files Browse the repository at this point in the history
PullRequest: mx/1653
  • Loading branch information
steve-s committed Aug 9, 2023
2 parents 892f8d4 + 9a7b291 commit 5e967b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
20 changes: 12 additions & 8 deletions mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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
Expand All @@ -6657,6 +6654,13 @@ def __init__(self, *args, **kw_args):
def classpath_repr(self, resolve=True):
return self.get_output()

def make_archive(self):
super().make_archive()
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):
if single:
raise ValueError("{} only produces multiple output".format(self))
Expand All @@ -6668,10 +6672,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):
Expand Down Expand Up @@ -18586,7 +18590,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
Expand Down

0 comments on commit 5e967b7

Please sign in to comment.