Skip to content

Commit

Permalink
[GR-56702] Add version information to the manifest only when it is av…
Browse files Browse the repository at this point in the history
…ailable from the suite.

PullRequest: mx/1821
  • Loading branch information
ansalond committed Sep 25, 2024
2 parents 24bdc64 + 953566a commit fa8a52a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 7 additions & 7 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@

"oraclejdk23": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+37", "platformspecific": true, "extrabundles": ["static-libs"]},

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

"eclipse": {
Expand Down
19 changes: 13 additions & 6 deletions src/mx/_impl/mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2660,7 +2660,7 @@ def is_release(self):
"""
Returns True if the release tag from VC is known and is not a snapshot
"""
_release = self._get_early_suite_dict_property('release')
_release = self.is_release_from_suite()
if _release is not None:
return _release
if not self.vc:
Expand All @@ -2671,22 +2671,29 @@ def is_release(self):
else:
return self.vc.is_release_from_tags(self.vc_dir, self.name)

def is_release_from_suite(self):
return self._get_early_suite_dict_property('release')

def release_version(self, snapshotSuffix='dev'):
"""
Gets the release tag from VC or create a time based once if VC is unavailable
"""
if snapshotSuffix not in self._releaseVersion:
_version = self._get_early_suite_dict_property('version')
if _version and self.getMxCompatibility().addVersionSuffixToExplicitVersion():
if not self.is_release():
_version = _version + '-' + snapshotSuffix
_version = self.release_version_from_suite(snapshotSuffix=snapshotSuffix)
if not _version and self.vc:
_version = self.vc.release_version_from_tags(self.vc_dir, self.name, snapshotSuffix=snapshotSuffix)
if not _version:
_version = f"unknown-{platform.node()}-{time.strftime('%Y-%m-%d_%H-%M-%S_%Z')}"
self._releaseVersion[snapshotSuffix] = _version
return self._releaseVersion[snapshotSuffix]

def release_version_from_suite(self, snapshotSuffix='dev'):
_version = self._get_early_suite_dict_property('version')
if _version and self.getMxCompatibility().addVersionSuffixToExplicitVersion():
if not self.is_release_from_suite():
_version = _version + '-' + snapshotSuffix
return _version

def scm_metadata(self, abortOnError=False):
scm = self.scm
if scm:
Expand Down Expand Up @@ -18197,7 +18204,7 @@ def alarm_handler(signum, frame):
_CACHE_DIR = get_env('MX_CACHE_DIR', join(dot_mx_dir(), 'cache'))

# The version must be updated for every PR (checked in CI) and the comment should reflect the PR's issue
version = VersionSpec("7.31.2") # GR-55288 support for new BaristaBenchmarkSuite
version = VersionSpec("7.32.0") # GR-56702: fix manifest version

_mx_start_datetime = datetime.utcnow()

Expand Down
9 changes: 7 additions & 2 deletions src/mx/_impl/mx_jardistribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,17 @@ def stage_archive(self):

if self.dist.maven:
developer = self.dist.suite.developer
release_version = self.dist.suite.release_version()
release_version = self.dist.suite.release_version_from_suite()
if release_version is None:
public_tag = 'public'
if isinstance(self.dist.maven, dict) and public_tag in self.dist.maven.get('tag', []):
mx.warn(f"Distribution '{self.dist.name}' has a maven dictionary with tag '{public_tag}' but its declaring suite ('{self.dist.suite.name}') does not have a version. Therefore, its manifest will not contain version information.")

self.manifest.setdefault('Name', self.dist.maven_artifact_id())

for group in 'Specification', 'Implementation':
self.manifest.setdefault(f'{group}-Version', release_version)
if release_version is not None:
self.manifest.setdefault(f'{group}-Version', release_version)
if 'organization' in developer:
self.manifest.setdefault(f'{group}-Vendor', developer['organization'])

Expand Down

0 comments on commit fa8a52a

Please sign in to comment.