From 619209c6c8f2546be450f64ade61ecdcba700bdf Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Thu, 25 Apr 2024 12:37:30 +0200 Subject: [PATCH 1/3] add DownloadableLibrary --- src/mx/_impl/build/suite/dependency.py | 4 +++ src/mx/_impl/mx.py | 34 +++++++++++++++++--------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/mx/_impl/build/suite/dependency.py b/src/mx/_impl/build/suite/dependency.py index 0147784f..4d508f6d 100644 --- a/src/mx/_impl/build/suite/dependency.py +++ b/src/mx/_impl/build/suite/dependency.py @@ -57,6 +57,10 @@ def isBaseLibrary(self): from ...mx import BaseLibrary return isinstance(self, BaseLibrary) + def isDownloadableLibrary(self): + from ...mx import DownloadableLibrary + return isinstance(self, DownloadableLibrary) + def isLibrary(self): from ...mx import Library return isinstance(self, Library) diff --git a/src/mx/_impl/mx.py b/src/mx/_impl/mx.py index 902bd4db..fdc6e341 100755 --- a/src/mx/_impl/mx.py +++ b/src/mx/_impl/mx.py @@ -146,6 +146,7 @@ "ZipExtractor", "FileInfo", "BaseLibrary", + "DownloadableLibrary", "ResourceLibrary", "PackedResourceLibrary", "JreLibrary", @@ -8275,15 +8276,29 @@ def _check_hash_specified(self, path, name): self.abort(f'Missing "{name}" property for library {self}') -class ResourceLibrary(BaseLibrary, _RewritableLibraryMixin): +class DownloadableLibrary(BaseLibrary): + def __init__(self, suite, name, optional, urls, digest, sourceUrls, sourceDigest, theLicense, **kwArgs): + BaseLibrary.__init__(self, suite, name, optional, theLicense, **kwArgs) + # These are substituted but not rewritten urls. For informational purposes only. Do not use for downloading. + self.original_urls = self.substVarsList(urls) + self.original_sourceUrls = self.substVarsList(sourceUrls) if sourceUrls is not None else None + + # Perform URL and digest rewriting before potentially generating cache path. + assert digest is None or isinstance(digest, Digest), f'{digest} is of type {type(digest)}' + self.urls, self.digest = mx_urlrewrites._rewrite_urls_and_digest(self.original_urls, digest) + if sourceUrls is not None: + assert sourceDigest is None or isinstance(sourceDigest, Digest), f'{sourceDigest} is of type {type(sourceDigest)}' + self.sourceUrls, self.sourceDigest = mx_urlrewrites._rewrite_urls_and_digest(self.substVarsList(sourceUrls), sourceDigest) + else: + self.sourceUrls, self.sourceDigest = None, None + + +class ResourceLibrary(DownloadableLibrary, _RewritableLibraryMixin): """ A library that is just a resource and therefore not a `ClasspathDependency`. """ def __init__(self, suite, name, path, optional, urls, digest, ext=None, **kwArgs): - BaseLibrary.__init__(self, suite, name, optional, None, **kwArgs) - - # Perform URL and digest rewriting before potentially generating cache path. - self.urls, self.digest = mx_urlrewrites._rewrite_urls_and_digest(self.substVarsList(urls), digest) + DownloadableLibrary.__init__(self, suite, name, optional, urls, digest, sourceUrls=None, sourceDigest=None, theLicense=None, **kwArgs) # Path can be generated from URL and digest if needed. self.ext = ext @@ -8568,7 +8583,7 @@ def get_declaring_module_name(self): return getattr(self, 'module') -class Library(BaseLibrary, ClasspathDependency, _RewritableLibraryMixin): +class Library(DownloadableLibrary, ClasspathDependency, _RewritableLibraryMixin): """ A library that is provided (built) by some third-party and made available via a URL. A Library may have dependencies on other Libraries as expressed by the "deps" field. @@ -8579,14 +8594,9 @@ class Library(BaseLibrary, ClasspathDependency, _RewritableLibraryMixin): N.B. Not obvious but a Library can be an annotationProcessor """ def __init__(self, suite, name, path, optional, urls, digest, sourcePath, sourceUrls, sourceDigest, deps, theLicense, ignore=False, **kwArgs): - BaseLibrary.__init__(self, suite, name, optional, theLicense, **kwArgs) + DownloadableLibrary.__init__(self, suite, name, optional, urls, digest, sourceUrls, sourceDigest, theLicense, **kwArgs) ClasspathDependency.__init__(self, **kwArgs) - # Perform URL and digest rewriting before potentially generating cache path. - assert digest is None or isinstance(digest, Digest), f'{digest} is of type {type(digest)}' - self.urls, self.digest = mx_urlrewrites._rewrite_urls_and_digest(self.substVarsList(urls), digest) - self.sourceUrls, self.sourceDigest = mx_urlrewrites._rewrite_urls_and_digest(self.substVarsList(sourceUrls), sourceDigest) - # Path and sourcePath can be generated from URL and digest if needed. self.path = self._normalize_path(path) self.sourcePath = self._normalize_path(sourcePath) From 289998fc5f90fd5a8650c5a9979314b70db20248 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Thu, 2 May 2024 09:32:59 +0200 Subject: [PATCH 2/3] Bump mx version --- src/mx/_impl/mx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mx/_impl/mx.py b/src/mx/_impl/mx.py index fdc6e341..aa390a14 100755 --- a/src/mx/_impl/mx.py +++ b/src/mx/_impl/mx.py @@ -18180,7 +18180,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.24.0") # GR-45840 Deal with encoding errors during printing +version = VersionSpec("7.25.0") # DownloadableLibrary _mx_start_datetime = datetime.utcnow() From 892d789774fbc60b831c720983d75242ae14bf7e Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Thu, 2 May 2024 11:06:04 +0200 Subject: [PATCH 3/3] sync common files --- common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.json b/common.json index dd3f685e..4568d66e 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": "7.22.6", + "mx_version": "7.22.7", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": {