Skip to content

Commit

Permalink
[GR-54060] Ensure shaded dependencies are downloaded before the shadi…
Browse files Browse the repository at this point in the history
…ng task.

PullRequest: graal/17705
  • Loading branch information
gilles-duboscq committed May 17, 2024
2 parents 75776ac + 6c184fd commit 7fdb9c3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions sdk/mx.sdk/mx_sdk_shaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def __init__(self, suite, name, deps, workingSets, theLicense, **args):
srcDirs = args.pop('sourceDirs', ['src']) # + [source_gen_dir()], added below
d = os.path.join(suite.dir, subDir, name)
shadedLibraries = args.pop('shadedDependencies', [])
self.shadedDeps = list(set(mx.dependency(d) for d in shadedLibraries))
assert all(dep.isLibrary() for dep in self.shadedDeps), f"shadedDependencies must all be libraries: {self.shadedDeps}"
self.shadedDeps = shadedLibraries
self.buildDependencies = shadedLibraries
super().__init__(suite, name, subDir=subDir, srcDirs=srcDirs, deps=deps, # javaCompliance
workingSets=workingSets, d=d, theLicense=theLicense, **args)

Expand All @@ -110,6 +110,13 @@ def __init__(self, suite, name, deps, workingSets, theLicense, **args):
self.checkstyleProj = args.get('checkstyle', name)
self.checkPackagePrefix = False

def resolveDeps(self):
super().resolveDeps()
self._resolveDepsHelper(self.shadedDeps)
not_libraries = [dep for dep in self.shadedDeps if not dep.isLibrary()]
if not_libraries:
raise self.abort(f"shadedDependencies must all be libraries, but the following are not libraries: {not_libraries}")

def getBuildTask(self, args):
jdk = mx.get_jdk(self.javaCompliance, tag=mx.DEFAULT_JDK_TAG, purpose='building ' + self.name)
return ShadedLibraryBuildTask(args, self, jdk)
Expand Down Expand Up @@ -199,7 +206,7 @@ def _collect_files(self):
proj = self.subject
binDir = proj.output_dir()
for dep in proj.shaded_deps():
srcFilePath = dep.get_source_path(True)
srcFilePath = dep.get_source_path(False)
if srcFilePath is None:
continue

Expand Down Expand Up @@ -255,8 +262,8 @@ def build(self):
]

for dep in shadedDeps:
jarFilePath = dep.get_path(True)
srcFilePath = dep.get_source_path(True)
jarFilePath = dep.get_path(False)
srcFilePath = dep.get_source_path(False)

if srcFilePath is None:
mx.abort(f'Cannot shade {dep} without a source jar (missing sourceDigest?)')
Expand Down

0 comments on commit 7fdb9c3

Please sign in to comment.