Skip to content

Commit

Permalink
Fix sbt task that creates GraalVM package (#7721)
Browse files Browse the repository at this point in the history
While looking into #7698 discovered that the `buildGraalDistribution`
task would fail to use the old (pre-23.0) GraalVM naming of artifacts.
This has changed since #7176.

The fix does not attempt to fix a problem of packaged GraalVM name in
`runtime`. That, as the ticket mentiones it, is the role of rust build
script that creates the correct bundle.
  • Loading branch information
hubertp authored Sep 6, 2023
1 parent a1f2560 commit ceb6084
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions project/DistributionPackage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -606,22 +606,35 @@ object DistributionPackage {
val archive = downloadGraal(log, os, architecture)

if (os.hasSupportForSulong) {
val packageDir = archive.getParentFile
val archiveRootDir = list(archive).head.getTopDirectory.getName
val extractedGraalDir = packageDir / archiveRootDir
log.info("Building GraalVM distribution2")
val packageDir = archive.getParentFile
val archiveRootDir = list(archive).head.getTopDirectory.getName
val extractedGraalDir0 = packageDir / archiveRootDir
val graalRuntimeDir =
s"graalvm-ce-java${graalJavaVersion}-${graalVersion}"
val extractedGraalDir = packageDir / graalRuntimeDir

if (extractedGraalDir0.exists()) {
IO.delete(extractedGraalDir0)
}
if (extractedGraalDir.exists()) {
IO.delete(extractedGraalDir)
}

log.info(s"Extracting $archive to $packageDir")
extract(archive, packageDir)

if (extractedGraalDir0 != extractedGraalDir) {
log.info(s"Standardizing GraalVM directory name")
IO.move(extractedGraalDir0, extractedGraalDir)
}

log.info("Installing components")
gu(log, os, extractedGraalDir, "install", "python")

log.info(s"Re-creating $archive")
IO.delete(archive)
makeArchive(packageDir, archiveRootDir, archive)
makeArchive(packageDir, graalRuntimeDir, archive)

log.info(s"Cleaning up $extractedGraalDir")
IO.delete(extractedGraalDir)
Expand Down

0 comments on commit ceb6084

Please sign in to comment.