Skip to content

Commit

Permalink
[GR-48618] Pom distributions propagate the build status.
Browse files Browse the repository at this point in the history
PullRequest: mx/1692
  • Loading branch information
ansalond committed Oct 19, 2023
2 parents ef9413e + 54686c8 commit 4a85f88
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 15 deletions.
24 changes: 12 additions & 12 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true },

"oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15", "platformspecific": true },
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15", "platformspecific": true },
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b15-sulong", "platformspecific": true },
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b21", "platformspecific": true },
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b21-debug", "platformspecific": true },
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b21-sulong", "platformspecific": true },
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b21", "platformspecific": true },
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b21-debug", "platformspecific": true },
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.1+11-jvmci-23.1-b21-sulong", "platformspecific": true },

"oraclejdk-latest": {"name": "jpg-jdk", "version": "22", "build_id": "18", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+18-jvmci-b01", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+18-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+18-jvmci-b01-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+18-jvmci-b01", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+18-jvmci-b01-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+18-jvmci-b01-sulong", "platformspecific": true }
"labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-22+18-jvmci-b02", "platformspecific": true },
"labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-22+18-jvmci-b02-debug", "platformspecific": true },
"labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-22+18-jvmci-b02-sulong", "platformspecific": true },
"labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-22+18-jvmci-b02", "platformspecific": true },
"labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-22+18-jvmci-b02-debug", "platformspecific": true },
"labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-22+18-jvmci-b02-sulong", "platformspecific": true }
},

"eclipse": {
Expand Down
2 changes: 1 addition & 1 deletion mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -18833,7 +18833,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.51.5") # GR-49438: Improve ninja rebuild detection
version = VersionSpec("6.51.6") # GR-48618: Pom distributions propagate the build status

_mx_start_datetime = datetime.utcnow()
_last_timestamp = _mx_start_datetime
Expand Down
42 changes: 40 additions & 2 deletions mx_pomdistribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#

import mx
from os import remove
from os.path import exists, join


class POMDistribution(mx.Distribution):
Expand All @@ -47,13 +49,13 @@ def __init__(self, suite, name, distDependencies, runtimeDependencies, theLicens
self.runtimeDependencies = runtimeDependencies

def getBuildTask(self, args):
return mx.NoOpTask(self, args)
return PomBuildTask(self, args)

def make_archive(self):
pass

def exists(self):
return True
return mx.exists(self.output_witness())

def remoteExtension(self):
return 'pom'
Expand All @@ -68,5 +70,41 @@ def resolveDeps(self):
new_runtime_deps.append(mx.dependency(runtime_dep, fatalIfMissing=True, context=self))
self.runtimeDependencies = new_runtime_deps

def output_directory(self):
return join(self.get_output_base(), self.name)

def output_witness(self):
return join(self.output_directory(), 'witness')

def is_runtime_dependency(self, dependency):
return dependency in self.runtimeDependencies


class PomBuildTask(mx.BuildTask):
def __init__(self, subject, args):
super(PomBuildTask, self).__init__(subject, args, 1)

def newestOutput(self):
return mx.TimeStampFile(self.subject.output_witness())

def needsBuild(self, newestInput):
sup = super(PomBuildTask, self).needsBuild(newestInput)
if sup[0]:
return sup
newestOutput = self.newestOutput()
if not newestOutput.exists():
return True, '{} does not exist'.format(newestOutput.path)
if newestInput and newestOutput.isOlderThan(newestInput):
return True, '{} is older than {}'.format(newestOutput, newestInput)
return False, None

def build(self):
mx.TimeStampFile(self.subject.output_witness()).touch()

def clean(self, forBuild=False):
witness = self.subject.output_witness()
if exists(witness):
remove(witness)

def __str__(self):
return 'Building {}'.format(self.subject.name)

0 comments on commit 4a85f88

Please sign in to comment.