2022-02-07 17:14:32 +03:00
|
|
|
import io.circe.yaml
|
|
|
|
import io.circe.syntax._
|
2021-01-15 18:26:51 +03:00
|
|
|
import sbt.internal.util.ManagedLogger
|
|
|
|
import sbt._
|
2020-12-09 16:58:11 +03:00
|
|
|
import sbt.io.syntax.fileToRichFile
|
|
|
|
import sbt.util.{CacheStore, CacheStoreFactory, FileInfo, Tracked}
|
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
import scala.sys.process._
|
|
|
|
|
2023-05-18 16:00:52 +03:00
|
|
|
import org.enso.build.WithDebugCommand
|
|
|
|
|
2020-12-09 16:58:11 +03:00
|
|
|
object DistributionPackage {
|
2021-04-07 17:19:23 +03:00
|
|
|
|
|
|
|
/** File extensions. */
|
|
|
|
implicit class FileExtensions(file: File) {
|
|
|
|
|
|
|
|
/** Get the outermost directory of this file. For absolute paths this
|
|
|
|
* function always returns root.
|
|
|
|
*
|
|
|
|
* == Example ==
|
|
|
|
* Get top directory of the relative path.
|
|
|
|
* {{{
|
|
|
|
* file("foo/bar/baz").getTopDirectory == file("foo")
|
|
|
|
* }}}
|
|
|
|
*
|
|
|
|
* Get top directory of the absolute path.
|
|
|
|
* {{{
|
|
|
|
* file(/foo/bar/baz").getTopDirectory == file("/")
|
|
|
|
* }}}
|
|
|
|
*
|
|
|
|
* @return the outermost directory of this file.
|
|
|
|
*/
|
|
|
|
def getTopDirectory: File = {
|
|
|
|
@scala.annotation.tailrec
|
|
|
|
def go(path: File): File = {
|
|
|
|
val parent = path.getParentFile
|
|
|
|
if (parent == null) path else go(parent)
|
|
|
|
}
|
|
|
|
go(file)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-08 15:37:48 +03:00
|
|
|
/** Conditional copying, based on the contents of cache and timestamps of files.
|
2022-05-11 13:12:18 +03:00
|
|
|
*
|
|
|
|
* @param source source directory
|
|
|
|
* @param destination target directory
|
|
|
|
* @param cache cache used for persisting the cached information
|
|
|
|
* @return true, if copying was necessary, false if no change was detected between the directories
|
|
|
|
*/
|
2020-12-09 16:58:11 +03:00
|
|
|
def copyDirectoryIncremental(
|
|
|
|
source: File,
|
|
|
|
destination: File,
|
|
|
|
cache: CacheStore
|
2022-05-11 13:12:18 +03:00
|
|
|
): Boolean = {
|
2020-12-09 16:58:11 +03:00
|
|
|
val allFiles = source.allPaths.get().toSet
|
|
|
|
Tracked.diffInputs(cache, FileInfo.lastModified)(allFiles) { diff =>
|
|
|
|
val missing = diff.unmodified.exists { f =>
|
2022-02-07 17:14:32 +03:00
|
|
|
val relativePath = f.relativeTo(source).get
|
|
|
|
val destinationFile =
|
|
|
|
destination.toPath.resolve(relativePath.toPath).toFile
|
2020-12-09 16:58:11 +03:00
|
|
|
!destinationFile.exists()
|
|
|
|
}
|
2022-02-07 17:14:32 +03:00
|
|
|
|
2020-12-09 16:58:11 +03:00
|
|
|
if (diff.modified.nonEmpty || diff.removed.nonEmpty || missing) {
|
|
|
|
IO.delete(destination)
|
|
|
|
IO.copyDirectory(source, destination)
|
2022-05-11 13:12:18 +03:00
|
|
|
true
|
|
|
|
} else false
|
2020-12-09 16:58:11 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def copyFilesIncremental(
|
|
|
|
sources: Seq[File],
|
|
|
|
destinationDirectory: File,
|
|
|
|
cache: CacheStore
|
|
|
|
): Unit = {
|
|
|
|
val allFiles = sources.toSet
|
|
|
|
IO.createDirectory(destinationDirectory)
|
|
|
|
Tracked.diffInputs(cache, FileInfo.lastModified)(allFiles) { diff =>
|
|
|
|
for (f <- diff.removed) {
|
|
|
|
IO.delete(destinationDirectory / f.getName)
|
|
|
|
}
|
|
|
|
for (f <- diff.modified -- diff.removed) {
|
|
|
|
IO.copyFile(f, destinationDirectory / f.getName)
|
|
|
|
}
|
|
|
|
for (f <- diff.unmodified) {
|
|
|
|
val destinationFile = destinationDirectory / f.getName
|
|
|
|
if (!destinationFile.exists()) {
|
|
|
|
IO.copyFile(f, destinationDirectory / f.getName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def executableName(baseName: String): String =
|
|
|
|
if (Platform.isWindows) baseName + ".exe" else baseName
|
|
|
|
|
2023-11-21 02:21:14 +03:00
|
|
|
private def batName(baseName: String): String =
|
|
|
|
if (Platform.isWindows) baseName + ".bat" else baseName
|
|
|
|
|
2020-12-09 16:58:11 +03:00
|
|
|
def createProjectManagerPackage(
|
|
|
|
distributionRoot: File,
|
|
|
|
cacheFactory: CacheStoreFactory
|
|
|
|
): Unit = {
|
|
|
|
copyDirectoryIncremental(
|
|
|
|
file("distribution/project-manager/THIRD-PARTY"),
|
|
|
|
distributionRoot / "THIRD-PARTY",
|
|
|
|
cacheFactory.make("project-manager-third-party")
|
|
|
|
)
|
|
|
|
|
|
|
|
copyFilesIncremental(
|
|
|
|
Seq(file(executableName("project-manager"))),
|
|
|
|
distributionRoot / "bin",
|
|
|
|
cacheFactory.make("project-manager-exe")
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
def createEnginePackage(
|
|
|
|
distributionRoot: File,
|
|
|
|
cacheFactory: CacheStoreFactory,
|
2022-02-07 17:14:32 +03:00
|
|
|
log: Logger,
|
2023-11-17 21:02:36 +03:00
|
|
|
jarModulesToCopy: Seq[File],
|
2020-12-09 16:58:11 +03:00
|
|
|
graalVersion: String,
|
2021-08-13 19:14:20 +03:00
|
|
|
javaVersion: String,
|
2022-02-07 17:14:32 +03:00
|
|
|
ensoVersion: String,
|
|
|
|
editionName: String,
|
|
|
|
sourceStdlibVersion: String,
|
2022-11-09 18:26:25 +03:00
|
|
|
targetStdlibVersion: String,
|
2023-03-30 12:59:49 +03:00
|
|
|
targetDir: File,
|
|
|
|
generateIndex: Boolean
|
2020-12-09 16:58:11 +03:00
|
|
|
): Unit = {
|
|
|
|
copyDirectoryIncremental(
|
|
|
|
file("distribution/engine/THIRD-PARTY"),
|
|
|
|
distributionRoot / "THIRD-PARTY",
|
|
|
|
cacheFactory.make("engine-third-party")
|
|
|
|
)
|
|
|
|
|
|
|
|
copyFilesIncremental(
|
2023-11-17 21:02:36 +03:00
|
|
|
jarModulesToCopy,
|
2020-12-09 16:58:11 +03:00
|
|
|
distributionRoot / "component",
|
2023-11-17 21:02:36 +03:00
|
|
|
cacheFactory.make("module jars")
|
2020-12-09 16:58:11 +03:00
|
|
|
)
|
2023-11-17 21:02:36 +03:00
|
|
|
// Put runner.jar into a nested directory, so that it is outside of the default
|
|
|
|
// module-path.
|
|
|
|
IO.copyFile(
|
|
|
|
file("runner.jar"),
|
|
|
|
distributionRoot / "component" / "runner" / "runner.jar"
|
|
|
|
)
|
|
|
|
|
2023-03-08 15:37:48 +03:00
|
|
|
val parser = targetDir / Platform.dynamicLibraryFileName("enso_parser")
|
2022-11-02 20:13:53 +03:00
|
|
|
copyFilesIncremental(
|
2022-11-09 18:26:25 +03:00
|
|
|
Seq(parser),
|
2022-11-02 20:13:53 +03:00
|
|
|
distributionRoot / "component",
|
|
|
|
cacheFactory.make("engine-parser-library")
|
|
|
|
)
|
2020-12-09 16:58:11 +03:00
|
|
|
|
2022-02-07 17:14:32 +03:00
|
|
|
(distributionRoot / "editions").mkdirs()
|
|
|
|
Editions.writeEditionConfig(
|
|
|
|
editionsRoot = distributionRoot / "editions",
|
|
|
|
ensoVersion = ensoVersion,
|
|
|
|
editionName = editionName,
|
|
|
|
libraryVersion = targetStdlibVersion,
|
|
|
|
log = log
|
2021-07-08 16:38:20 +03:00
|
|
|
)
|
|
|
|
|
2022-02-07 17:14:32 +03:00
|
|
|
copyLibraryCacheIncremental(
|
|
|
|
sourceRoot = file("distribution/lib"),
|
|
|
|
destinationRoot = distributionRoot / "lib",
|
|
|
|
sourceVersion = sourceStdlibVersion,
|
|
|
|
targetVersion = targetStdlibVersion,
|
|
|
|
cacheFactory = cacheFactory.sub("engine-libraries"),
|
|
|
|
log = log
|
2020-12-09 16:58:11 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
copyDirectoryIncremental(
|
|
|
|
file("distribution/bin"),
|
|
|
|
distributionRoot / "bin",
|
|
|
|
cacheFactory.make("engine-bin")
|
|
|
|
)
|
|
|
|
|
|
|
|
buildEngineManifest(
|
|
|
|
template = file("distribution/manifest.template.yaml"),
|
|
|
|
destination = distributionRoot / "manifest.yaml",
|
|
|
|
graalVersion = graalVersion,
|
|
|
|
javaVersion = javaVersion
|
|
|
|
)
|
2023-03-01 11:53:29 +03:00
|
|
|
|
2023-03-30 12:59:49 +03:00
|
|
|
if (generateIndex) {
|
|
|
|
indexStdLibs(
|
|
|
|
stdLibVersion = targetStdlibVersion,
|
|
|
|
ensoVersion = ensoVersion,
|
|
|
|
stdLibRoot = distributionRoot / "lib",
|
|
|
|
ensoExecutable = distributionRoot / "bin" / "enso",
|
|
|
|
cacheFactory = cacheFactory.sub("stdlib"),
|
|
|
|
log = log
|
|
|
|
)
|
|
|
|
}
|
2023-03-01 11:53:29 +03:00
|
|
|
}
|
|
|
|
|
2023-03-29 01:28:38 +03:00
|
|
|
def indexStdLibs(
|
2023-03-11 03:15:58 +03:00
|
|
|
stdLibVersion: String,
|
|
|
|
ensoVersion: String,
|
|
|
|
stdLibRoot: File,
|
|
|
|
ensoExecutable: File,
|
|
|
|
cacheFactory: CacheStoreFactory,
|
|
|
|
log: Logger
|
|
|
|
): Unit = {
|
2023-03-01 11:53:29 +03:00
|
|
|
for {
|
|
|
|
libMajor <- stdLibRoot.listFiles()
|
2023-03-11 03:15:58 +03:00
|
|
|
libName <- (stdLibRoot / libMajor.getName).listFiles()
|
2023-03-01 11:53:29 +03:00
|
|
|
} yield {
|
2023-03-29 01:28:38 +03:00
|
|
|
indexStdLib(
|
|
|
|
libName,
|
|
|
|
stdLibVersion,
|
|
|
|
ensoVersion,
|
|
|
|
ensoExecutable,
|
|
|
|
cacheFactory,
|
|
|
|
log
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def indexStdLib(
|
|
|
|
libName: File,
|
|
|
|
stdLibVersion: String,
|
|
|
|
ensoVersion: String,
|
|
|
|
ensoExecutable: File,
|
|
|
|
cacheFactory: CacheStoreFactory,
|
|
|
|
log: Logger
|
|
|
|
): Unit = {
|
|
|
|
object FileOnlyFilter extends sbt.io.FileFilter {
|
|
|
|
def accept(arg: File): Boolean = arg.isFile
|
|
|
|
}
|
|
|
|
val cache = cacheFactory.make(s"$libName.$ensoVersion")
|
|
|
|
val path = libName / ensoVersion
|
|
|
|
Tracked.diffInputs(cache, FileInfo.lastModified)(
|
|
|
|
path.globRecursive("*.enso" && FileOnlyFilter).get().toSet
|
|
|
|
) { diff =>
|
|
|
|
if (diff.modified.nonEmpty) {
|
2024-07-31 12:43:17 +03:00
|
|
|
log.info(s"Generating index for $libName ")
|
2023-03-29 01:28:38 +03:00
|
|
|
val command = Seq(
|
2024-07-31 12:43:17 +03:00
|
|
|
Platform.executableFile(ensoExecutable.getAbsoluteFile),
|
2023-03-29 01:28:38 +03:00
|
|
|
"--no-compile-dependencies",
|
|
|
|
"--no-global-cache",
|
|
|
|
"--compile",
|
2024-07-31 12:43:17 +03:00
|
|
|
path.getAbsolutePath
|
2023-03-29 01:28:38 +03:00
|
|
|
)
|
|
|
|
log.debug(command.mkString(" "))
|
|
|
|
val exitCode = Process(
|
|
|
|
command,
|
2024-07-31 12:43:17 +03:00
|
|
|
Some(path.getAbsoluteFile.getParentFile),
|
2023-03-29 01:28:38 +03:00
|
|
|
"JAVA_OPTS" -> "-Dorg.jline.terminal.dumb=true"
|
|
|
|
).!
|
|
|
|
if (exitCode != 0) {
|
2024-07-31 12:43:17 +03:00
|
|
|
throw new RuntimeException(s"Cannot compile $libName.")
|
2023-03-01 11:53:29 +03:00
|
|
|
}
|
2023-03-29 01:28:38 +03:00
|
|
|
} else {
|
2024-07-31 12:43:17 +03:00
|
|
|
log.debug(s"No modified files. Not generating index for $libName.")
|
2023-03-01 11:53:29 +03:00
|
|
|
}
|
|
|
|
}
|
2020-12-09 16:58:11 +03:00
|
|
|
}
|
|
|
|
|
2023-02-17 00:37:12 +03:00
|
|
|
def runEnginePackage(
|
|
|
|
distributionRoot: File,
|
|
|
|
args: Seq[String],
|
|
|
|
log: Logger
|
|
|
|
): Boolean = {
|
|
|
|
import scala.collection.JavaConverters._
|
|
|
|
|
2023-11-21 02:21:14 +03:00
|
|
|
val enso = distributionRoot / "bin" / batName("enso")
|
2023-02-17 00:37:12 +03:00
|
|
|
log.info(s"Executing $enso ${args.mkString(" ")}")
|
2023-03-11 03:15:58 +03:00
|
|
|
val pb = new java.lang.ProcessBuilder()
|
2023-02-17 00:37:12 +03:00
|
|
|
val all = new java.util.ArrayList[String]()
|
2024-08-05 16:22:22 +03:00
|
|
|
val disablePrivateCheck = {
|
|
|
|
val findRun = args.indexOf("--run")
|
|
|
|
if (findRun >= 0 && findRun + 1 < args.size) {
|
|
|
|
val whatToRun = args(findRun + 1)
|
|
|
|
if (whatToRun.startsWith("test/") && whatToRun.endsWith("_Tests")) {
|
|
|
|
whatToRun.contains("_Internal_")
|
|
|
|
} else {
|
|
|
|
false
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
2023-02-17 00:37:12 +03:00
|
|
|
all.add(enso.getAbsolutePath())
|
|
|
|
all.addAll(args.asJava)
|
|
|
|
pb.command(all)
|
2023-05-18 16:00:52 +03:00
|
|
|
if (args.contains("--debug")) {
|
|
|
|
all.remove("--debug")
|
2024-02-01 11:07:43 +03:00
|
|
|
pb.environment().put("JAVA_OPTS", "-ea " + WithDebugCommand.DEBUG_OPTION)
|
|
|
|
} else {
|
|
|
|
pb.environment().put("JAVA_OPTS", "-ea")
|
2023-05-18 16:00:52 +03:00
|
|
|
}
|
2024-08-05 16:22:22 +03:00
|
|
|
if (disablePrivateCheck) {
|
|
|
|
all.add("--disable-private-check")
|
|
|
|
}
|
2023-02-17 00:37:12 +03:00
|
|
|
pb.inheritIO()
|
2023-03-11 03:15:58 +03:00
|
|
|
val p = pb.start()
|
2023-02-17 00:37:12 +03:00
|
|
|
val exitCode = p.waitFor()
|
|
|
|
if (exitCode != 0) {
|
|
|
|
log.warn(enso + " finished with exit code " + exitCode)
|
2023-07-17 20:38:54 +03:00
|
|
|
}
|
|
|
|
exitCode == 0
|
|
|
|
}
|
|
|
|
|
|
|
|
def runProjectManagerPackage(
|
|
|
|
engineRoot: File,
|
|
|
|
distributionRoot: File,
|
|
|
|
args: Seq[String],
|
|
|
|
log: Logger
|
|
|
|
): Boolean = {
|
|
|
|
import scala.collection.JavaConverters._
|
|
|
|
|
|
|
|
val enso = distributionRoot / "bin" / "project-manager"
|
|
|
|
log.info(s"Executing $enso ${args.mkString(" ")}")
|
|
|
|
val pb = new java.lang.ProcessBuilder()
|
|
|
|
val all = new java.util.ArrayList[String]()
|
|
|
|
all.add(enso.getAbsolutePath())
|
|
|
|
all.addAll(args.asJava)
|
|
|
|
pb.command(all)
|
|
|
|
pb.environment().put("ENSO_ENGINE_PATH", engineRoot.toString())
|
|
|
|
pb.environment().put("ENSO_JVM_PATH", System.getProperty("java.home"))
|
|
|
|
if (args.contains("--debug")) {
|
|
|
|
all.remove("--debug")
|
|
|
|
pb.environment().put("ENSO_JVM_OPTS", WithDebugCommand.DEBUG_OPTION)
|
|
|
|
}
|
|
|
|
pb.inheritIO()
|
|
|
|
val p = pb.start()
|
|
|
|
val exitCode = p.waitFor()
|
|
|
|
if (exitCode != 0) {
|
|
|
|
log.warn(enso + " finished with exit code " + exitCode)
|
2023-02-17 00:37:12 +03:00
|
|
|
}
|
|
|
|
exitCode == 0
|
|
|
|
}
|
|
|
|
|
2022-02-07 17:14:32 +03:00
|
|
|
def fixLibraryManifest(
|
|
|
|
packageRoot: File,
|
|
|
|
targetVersion: String,
|
|
|
|
log: Logger
|
|
|
|
): Unit = {
|
|
|
|
val packageConfig = packageRoot / "package.yaml"
|
|
|
|
val originalContent = IO.read(packageConfig)
|
|
|
|
yaml.parser.parse(originalContent) match {
|
|
|
|
case Left(error) =>
|
|
|
|
log.error(s"Failed to parse $packageConfig: $error")
|
|
|
|
throw error
|
|
|
|
case Right(parsed) =>
|
|
|
|
val obj = parsed.asObject.getOrElse {
|
|
|
|
throw new IllegalStateException(s"Incorrect format of $packageConfig")
|
|
|
|
}
|
|
|
|
|
|
|
|
val key = "version"
|
|
|
|
val updated = obj.remove(key).add(key, targetVersion.asJson)
|
|
|
|
val serialized = yaml.printer.print(updated.asJson)
|
|
|
|
if (serialized == originalContent) {
|
|
|
|
log.info(
|
|
|
|
s"No need to update $packageConfig, already in correct version."
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
IO.write(packageConfig, serialized)
|
|
|
|
log.debug(s"Updated $packageConfig to $targetVersion")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def copyLibraryCacheIncremental(
|
|
|
|
sourceRoot: File,
|
|
|
|
destinationRoot: File,
|
|
|
|
sourceVersion: String,
|
|
|
|
targetVersion: String,
|
|
|
|
cacheFactory: CacheStoreFactory,
|
|
|
|
log: Logger
|
|
|
|
): Unit = {
|
|
|
|
val existingLibraries =
|
|
|
|
collection.mutable.ArrayBuffer.empty[(String, String)]
|
|
|
|
for (prefix <- sourceRoot.list()) {
|
|
|
|
for (libName <- (sourceRoot / prefix).list()) {
|
|
|
|
val targetPackageRoot =
|
|
|
|
destinationRoot / prefix / libName / targetVersion
|
|
|
|
copyDirectoryIncremental(
|
|
|
|
source = sourceRoot / prefix / libName / sourceVersion,
|
|
|
|
destination = targetPackageRoot,
|
|
|
|
cache = cacheFactory.make(s"$prefix.$libName")
|
|
|
|
)
|
|
|
|
fixLibraryManifest(targetPackageRoot, targetVersion, log)
|
|
|
|
existingLibraries.append((prefix, libName))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val existingLibrariesSet = existingLibraries.toSet
|
|
|
|
for (prefix <- destinationRoot.list()) {
|
|
|
|
for (libName <- (destinationRoot / prefix).list()) {
|
|
|
|
if (!existingLibrariesSet.contains((prefix, libName))) {
|
|
|
|
log.info(
|
|
|
|
s"Removing a library $prefix.$libName from the distribution, " +
|
|
|
|
s"because it does not exist in the sources anymore."
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-09 16:58:11 +03:00
|
|
|
private def buildEngineManifest(
|
|
|
|
template: File,
|
|
|
|
destination: File,
|
|
|
|
graalVersion: String,
|
|
|
|
javaVersion: String
|
|
|
|
): Unit = {
|
|
|
|
val base = IO.read(template)
|
|
|
|
val extensions =
|
|
|
|
s"""graal-vm-version: $graalVersion
|
|
|
|
|graal-java-version: $javaVersion
|
|
|
|
|""".stripMargin
|
|
|
|
IO.write(destination, base + extensions)
|
|
|
|
}
|
|
|
|
|
|
|
|
def createLauncherPackage(
|
|
|
|
distributionRoot: File,
|
|
|
|
cacheFactory: CacheStoreFactory
|
|
|
|
): Unit = {
|
|
|
|
copyDirectoryIncremental(
|
|
|
|
file("distribution/launcher/THIRD-PARTY"),
|
|
|
|
distributionRoot / "THIRD-PARTY",
|
|
|
|
cacheFactory.make("launcher-third-party")
|
|
|
|
)
|
|
|
|
|
|
|
|
copyFilesIncremental(
|
2024-07-16 17:30:23 +03:00
|
|
|
Seq(file(executableName("ensoup"))),
|
2020-12-09 16:58:11 +03:00
|
|
|
distributionRoot / "bin",
|
|
|
|
cacheFactory.make("launcher-exe")
|
|
|
|
)
|
|
|
|
|
|
|
|
IO.createDirectory(distributionRoot / "dist")
|
|
|
|
IO.createDirectory(distributionRoot / "runtime")
|
|
|
|
|
|
|
|
copyFilesIncremental(
|
|
|
|
Seq(
|
|
|
|
file("distribution/launcher/.enso.portable"),
|
|
|
|
file("distribution/launcher/README.md")
|
|
|
|
),
|
|
|
|
distributionRoot,
|
|
|
|
cacheFactory.make("launcher-rootfiles")
|
|
|
|
)
|
|
|
|
}
|
2021-01-15 18:26:51 +03:00
|
|
|
|
|
|
|
sealed trait OS {
|
2021-04-07 17:19:23 +03:00
|
|
|
def name: String
|
|
|
|
def hasSupportForSulong: Boolean
|
2021-01-15 18:26:51 +03:00
|
|
|
def executableName(base: String): String = base
|
|
|
|
def archiveExt: String = ".tar.gz"
|
|
|
|
def isUNIX: Boolean = true
|
2023-12-05 13:24:02 +03:00
|
|
|
def archs: Seq[Architecture]
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
object OS {
|
|
|
|
case object Linux extends OS {
|
2021-04-07 17:19:23 +03:00
|
|
|
override val name: String = "linux"
|
|
|
|
override val hasSupportForSulong: Boolean = true
|
2023-12-05 13:24:02 +03:00
|
|
|
override val archs = Seq(Architecture.X64)
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
2023-12-05 13:24:02 +03:00
|
|
|
trait MacOS extends OS {
|
|
|
|
override val name: String = "macos"
|
|
|
|
}
|
|
|
|
case object MacOSAmd extends MacOS {
|
|
|
|
override val hasSupportForSulong: Boolean = true
|
|
|
|
override val archs = Seq(Architecture.X64)
|
|
|
|
}
|
|
|
|
|
|
|
|
case object MacOSArm extends MacOS {
|
2021-04-07 17:19:23 +03:00
|
|
|
override val hasSupportForSulong: Boolean = true
|
2023-12-05 13:24:02 +03:00
|
|
|
override val archs = Seq(Architecture.AarchX64)
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
case object Windows extends OS {
|
2021-04-07 17:19:23 +03:00
|
|
|
override val name: String = "windows"
|
|
|
|
override val hasSupportForSulong: Boolean = false
|
2021-01-15 18:26:51 +03:00
|
|
|
override def executableName(base: String): String = base + ".exe"
|
|
|
|
override def archiveExt: String = ".zip"
|
|
|
|
override def isUNIX: Boolean = false
|
2023-12-05 13:24:02 +03:00
|
|
|
override val archs = Seq(Architecture.X64)
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
|
2023-12-05 13:24:02 +03:00
|
|
|
val platforms = Seq(Linux, MacOSArm, MacOSAmd, Windows)
|
2021-04-07 17:19:23 +03:00
|
|
|
|
2023-12-05 13:24:02 +03:00
|
|
|
def apply(name: String, arch: Option[String]): Option[OS] =
|
2021-04-07 17:19:23 +03:00
|
|
|
name.toLowerCase match {
|
2023-12-05 13:24:02 +03:00
|
|
|
case Linux.`name` => Some(Linux)
|
|
|
|
case MacOSAmd.`name` =>
|
|
|
|
arch match {
|
|
|
|
case Some(Architecture.X64.`name`) =>
|
|
|
|
Some(MacOSAmd)
|
|
|
|
case Some(Architecture.AarchX64.`name`) =>
|
|
|
|
Some(MacOSArm)
|
|
|
|
case _ =>
|
|
|
|
None
|
|
|
|
}
|
|
|
|
case MacOSArm.`name` => Some(MacOSArm)
|
|
|
|
case Windows.`name` => Some(Windows)
|
|
|
|
case _ => None
|
2021-04-07 17:19:23 +03:00
|
|
|
}
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
sealed trait Architecture {
|
|
|
|
def name: String
|
2023-07-24 16:53:03 +03:00
|
|
|
|
|
|
|
/** Name of the architecture for GraalVM releases
|
|
|
|
*/
|
|
|
|
def graalName: String
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
object Architecture {
|
|
|
|
case object X64 extends Architecture {
|
2023-12-05 13:24:02 +03:00
|
|
|
override val name: String = "amd64"
|
|
|
|
override def graalName: String = "x64"
|
|
|
|
}
|
|
|
|
|
|
|
|
case object AarchX64 extends Architecture {
|
|
|
|
override val name: String = "aarch64"
|
2023-07-24 16:53:03 +03:00
|
|
|
override def graalName: String = "x64"
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/** A helper class that manages building distribution artifacts. */
|
|
|
|
class Builder(
|
|
|
|
ensoVersion: String,
|
|
|
|
graalVersion: String,
|
|
|
|
graalJavaVersion: String,
|
|
|
|
artifactRoot: File
|
|
|
|
) {
|
|
|
|
|
|
|
|
def artifactName(
|
|
|
|
component: String,
|
|
|
|
os: OS,
|
|
|
|
architecture: Architecture
|
|
|
|
): String =
|
|
|
|
s"enso-$component-$ensoVersion-${os.name}-${architecture.name}"
|
|
|
|
|
|
|
|
def graalInPackageName: String =
|
|
|
|
s"graalvm-ce-java$graalJavaVersion-$graalVersion"
|
|
|
|
|
|
|
|
private def extractZip(archive: File, root: File): Unit = {
|
|
|
|
IO.createDirectory(root)
|
|
|
|
val exitCode = Process(
|
|
|
|
Seq("unzip", "-q", archive.toPath.toAbsolutePath.normalize.toString),
|
|
|
|
cwd = Some(root)
|
|
|
|
).!
|
|
|
|
if (exitCode != 0) {
|
|
|
|
throw new RuntimeException(s"Cannot extract $archive.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
private def listZip(archive: File): Seq[File] = {
|
|
|
|
val suppressStdErr = ProcessLogger(_ => ())
|
|
|
|
val zipList = Process(
|
|
|
|
Seq("zip", "-l", archive.toPath.toAbsolutePath.normalize.toString)
|
|
|
|
)
|
|
|
|
zipList.lineStream(suppressStdErr).map(file)
|
|
|
|
}
|
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
private def extractTarGz(archive: File, root: File): Unit = {
|
|
|
|
IO.createDirectory(root)
|
|
|
|
val exitCode = Process(
|
|
|
|
Seq(
|
|
|
|
"tar",
|
|
|
|
"xf",
|
|
|
|
archive.toPath.toAbsolutePath.toString
|
|
|
|
),
|
|
|
|
cwd = Some(root)
|
|
|
|
).!
|
|
|
|
if (exitCode != 0) {
|
|
|
|
throw new RuntimeException(s"Cannot extract $archive.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
private def listTarGz(archive: File): Seq[File] = {
|
|
|
|
val suppressStdErr = ProcessLogger(_ => ())
|
|
|
|
val tarList =
|
|
|
|
Process(Seq("tar", "tf", archive.toPath.toAbsolutePath.toString))
|
|
|
|
tarList.lineStream(suppressStdErr).map(file)
|
|
|
|
}
|
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
private def extract(archive: File, root: File): Unit = {
|
|
|
|
if (archive.getName.endsWith("zip")) {
|
|
|
|
extractZip(archive, root)
|
|
|
|
} else {
|
|
|
|
extractTarGz(archive, root)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
private def list(archive: File): Seq[File] = {
|
|
|
|
if (archive.getName.endsWith("zip")) {
|
|
|
|
listZip(archive)
|
|
|
|
} else {
|
|
|
|
listTarGz(archive)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private def graalArchive(os: OS, architecture: Architecture): File = {
|
|
|
|
val packageDir =
|
|
|
|
artifactRoot / s"graalvm-$graalVersion-${os.name}-${architecture.name}"
|
|
|
|
if (!packageDir.exists()) {
|
|
|
|
IO.createDirectory(packageDir)
|
|
|
|
}
|
2023-10-06 21:49:57 +03:00
|
|
|
val archiveName =
|
|
|
|
s"graalvm-${os.name}-${architecture.name}-$graalVersion-$graalJavaVersion"
|
2021-04-07 17:19:23 +03:00
|
|
|
packageDir / (archiveName + os.archiveExt)
|
|
|
|
}
|
|
|
|
|
|
|
|
private def downloadGraal(
|
2021-01-15 18:26:51 +03:00
|
|
|
log: ManagedLogger,
|
|
|
|
os: OS,
|
2021-04-07 17:19:23 +03:00
|
|
|
architecture: Architecture
|
|
|
|
): File = {
|
|
|
|
val archive = graalArchive(os, architecture)
|
2021-03-31 16:33:02 +03:00
|
|
|
if (!archive.exists()) {
|
2021-01-15 18:26:51 +03:00
|
|
|
log.info(
|
|
|
|
s"Downloading GraalVM $graalVersion Java $graalJavaVersion " +
|
|
|
|
s"for $os $architecture"
|
|
|
|
)
|
|
|
|
val graalUrl =
|
|
|
|
s"https://github.com/graalvm/graalvm-ce-builds/releases/download/" +
|
2023-07-23 12:21:21 +03:00
|
|
|
s"jdk-$graalJavaVersion/" +
|
|
|
|
s"graalvm-community-jdk-${graalJavaVersion}_${os.name}-" +
|
2023-07-24 16:53:03 +03:00
|
|
|
s"${architecture.graalName}_bin${os.archiveExt}"
|
2021-01-15 18:26:51 +03:00
|
|
|
val exitCode = (url(graalUrl) #> archive).!
|
|
|
|
if (exitCode != 0) {
|
|
|
|
throw new RuntimeException(s"Graal download from $graalUrl failed.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
archive
|
|
|
|
}
|
|
|
|
|
|
|
|
private def copyGraal(
|
|
|
|
os: OS,
|
|
|
|
architecture: Architecture,
|
|
|
|
runtimeDir: File
|
|
|
|
): Unit = {
|
|
|
|
val archive = graalArchive(os, architecture)
|
2021-03-31 16:33:02 +03:00
|
|
|
extract(archive, runtimeDir)
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
/** Prepare the GraalVM package.
|
|
|
|
*
|
|
|
|
* @param log the logger
|
|
|
|
* @param os the system type
|
|
|
|
* @param architecture the architecture type
|
|
|
|
* @return the path to the created GraalVM package
|
|
|
|
*/
|
|
|
|
def createGraalPackage(
|
|
|
|
log: ManagedLogger,
|
|
|
|
os: OS,
|
|
|
|
architecture: Architecture
|
|
|
|
): File = {
|
|
|
|
log.info("Building GraalVM distribution")
|
|
|
|
val archive = downloadGraal(log, os, architecture)
|
|
|
|
|
|
|
|
if (os.hasSupportForSulong) {
|
2023-09-06 14:58:10 +03:00
|
|
|
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)
|
|
|
|
}
|
2021-04-07 17:19:23 +03:00
|
|
|
if (extractedGraalDir.exists()) {
|
|
|
|
IO.delete(extractedGraalDir)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.info(s"Extracting $archive to $packageDir")
|
|
|
|
extract(archive, packageDir)
|
|
|
|
|
2023-09-06 14:58:10 +03:00
|
|
|
if (extractedGraalDir0 != extractedGraalDir) {
|
|
|
|
log.info(s"Standardizing GraalVM directory name")
|
|
|
|
IO.move(extractedGraalDir0, extractedGraalDir)
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
log.info("Installing components")
|
2023-07-23 12:21:21 +03:00
|
|
|
gu(log, os, extractedGraalDir, "install", "python")
|
2021-04-07 17:19:23 +03:00
|
|
|
|
|
|
|
log.info(s"Re-creating $archive")
|
|
|
|
IO.delete(archive)
|
2023-09-06 14:58:10 +03:00
|
|
|
makeArchive(packageDir, graalRuntimeDir, archive)
|
2021-04-07 17:19:23 +03:00
|
|
|
|
|
|
|
log.info(s"Cleaning up $extractedGraalDir")
|
|
|
|
IO.delete(extractedGraalDir)
|
|
|
|
}
|
|
|
|
archive
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Run the `gu` executable from the GraalVM distribution.
|
|
|
|
*
|
|
|
|
* @param log the logger
|
|
|
|
* @param os the system type
|
|
|
|
* @param graalDir the directory with a GraalVM distribution
|
|
|
|
* @param arguments the command arguments
|
2022-11-23 17:30:48 +03:00
|
|
|
* @return Stdout from the `gu` command.
|
2021-04-07 17:19:23 +03:00
|
|
|
*/
|
|
|
|
def gu(
|
|
|
|
log: ManagedLogger,
|
|
|
|
os: OS,
|
|
|
|
graalDir: File,
|
|
|
|
arguments: String*
|
2022-11-23 17:30:48 +03:00
|
|
|
): String = {
|
|
|
|
val shallowFile = graalDir / "bin" / "gu"
|
2023-03-08 15:37:48 +03:00
|
|
|
val deepFile = graalDir / "Contents" / "Home" / "bin" / "gu"
|
2021-04-07 17:19:23 +03:00
|
|
|
val executableFile = os match {
|
|
|
|
case OS.Linux =>
|
2022-11-23 17:30:48 +03:00
|
|
|
shallowFile
|
2023-12-05 13:24:02 +03:00
|
|
|
case _: OS.MacOS =>
|
2022-11-23 17:30:48 +03:00
|
|
|
if (deepFile.exists) {
|
|
|
|
deepFile
|
|
|
|
} else {
|
|
|
|
shallowFile
|
|
|
|
}
|
2021-04-07 17:19:23 +03:00
|
|
|
case OS.Windows =>
|
|
|
|
graalDir / "bin" / "gu.cmd"
|
|
|
|
}
|
|
|
|
val javaHomeFile = executableFile.getParentFile.getParentFile
|
2023-03-08 15:37:48 +03:00
|
|
|
val javaHome = javaHomeFile.toPath.toAbsolutePath
|
2021-04-07 17:19:23 +03:00
|
|
|
val command =
|
|
|
|
executableFile.toPath.toAbsolutePath.toString +: arguments
|
2022-11-23 17:30:48 +03:00
|
|
|
|
2023-03-08 15:37:48 +03:00
|
|
|
log.debug(
|
|
|
|
s"Running $command in $graalDir with JAVA_HOME=${javaHome.toString}"
|
|
|
|
)
|
2022-11-23 17:30:48 +03:00
|
|
|
|
|
|
|
try {
|
|
|
|
Process(
|
|
|
|
command,
|
|
|
|
Some(graalDir),
|
|
|
|
("JAVA_HOME", javaHome.toString),
|
|
|
|
("GRAALVM_HOME", javaHome.toString)
|
|
|
|
).!!
|
|
|
|
} catch {
|
|
|
|
case _: RuntimeException =>
|
|
|
|
throw new RuntimeException(
|
|
|
|
s"Failed to run '${command.mkString(" ")}'"
|
|
|
|
)
|
2021-04-07 17:19:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
def copyEngine(os: OS, architecture: Architecture, distDir: File): Unit = {
|
|
|
|
val engine = builtArtifact("engine", os, architecture)
|
|
|
|
if (!engine.exists()) {
|
|
|
|
throw new IllegalStateException(
|
|
|
|
s"Cannot create bundle for $os / $architecture because corresponding " +
|
|
|
|
s"engine has not been built."
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
IO.copyDirectory(engine / s"enso-$ensoVersion", distDir / ensoVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
def makeExecutable(file: File): Unit = {
|
|
|
|
val ownerOnly = false
|
|
|
|
file.setExecutable(true, ownerOnly)
|
|
|
|
}
|
|
|
|
|
|
|
|
def fixLauncher(root: File, os: OS): Unit = {
|
|
|
|
makeExecutable(root / "enso" / "bin" / os.executableName("enso"))
|
|
|
|
IO.createDirectories(
|
|
|
|
Seq("dist", "config", "runtime").map(root / "enso" / _)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
def makeArchive(root: File, rootDir: String, target: File): Unit = {
|
|
|
|
val exitCode = if (target.getName.endsWith("zip")) {
|
|
|
|
Process(
|
|
|
|
Seq(
|
|
|
|
"zip",
|
2021-03-31 16:33:02 +03:00
|
|
|
"-9",
|
2021-01-15 18:26:51 +03:00
|
|
|
"-q",
|
|
|
|
"-r",
|
|
|
|
target.toPath.toAbsolutePath.normalize.toString,
|
|
|
|
rootDir
|
|
|
|
),
|
|
|
|
cwd = Some(root)
|
|
|
|
).!
|
|
|
|
} else {
|
|
|
|
Process(
|
|
|
|
Seq(
|
|
|
|
"tar",
|
2021-03-31 16:33:02 +03:00
|
|
|
"--use-compress-program=gzip -9",
|
|
|
|
"-cf",
|
2021-01-15 18:26:51 +03:00
|
|
|
target.toPath.toAbsolutePath.normalize.toString,
|
|
|
|
rootDir
|
|
|
|
),
|
|
|
|
cwd = Some(root)
|
|
|
|
).!
|
|
|
|
}
|
|
|
|
if (exitCode != 0) {
|
|
|
|
throw new RuntimeException(s"Failed to create archive $target")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Path to an arbitrary built artifact. */
|
|
|
|
def builtArtifact(
|
|
|
|
component: String,
|
|
|
|
os: OS,
|
|
|
|
architecture: Architecture
|
|
|
|
): File = artifactRoot / artifactName(component, os, architecture)
|
|
|
|
|
|
|
|
/** Path to the artifact that is built on this local machine. */
|
|
|
|
def localArtifact(component: String): File = {
|
|
|
|
val os =
|
|
|
|
if (Platform.isWindows) OS.Windows
|
|
|
|
else if (Platform.isLinux) OS.Linux
|
2023-12-05 13:24:02 +03:00
|
|
|
else if (Platform.isMacOS) {
|
|
|
|
if (Platform.isAmd64) OS.MacOSAmd
|
|
|
|
else if (Platform.isArm64) OS.MacOSArm
|
|
|
|
else
|
|
|
|
throw new IllegalStateException(
|
|
|
|
"Unknown Arch: " + sys.props("os.arch")
|
|
|
|
)
|
|
|
|
} else
|
|
|
|
throw new IllegalStateException("Unknown OS: " + sys.props("os.name"))
|
|
|
|
artifactRoot / artifactName(component, os, os.archs.head)
|
2021-01-15 18:26:51 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Path to a built archive.
|
|
|
|
*
|
|
|
|
* These archives are built by [[makePackages]] and [[makeBundles]].
|
|
|
|
*/
|
|
|
|
def builtArchive(
|
|
|
|
component: String,
|
|
|
|
os: OS,
|
|
|
|
architecture: Architecture
|
|
|
|
): File =
|
|
|
|
artifactRoot / (artifactName(
|
|
|
|
component,
|
|
|
|
os,
|
|
|
|
architecture
|
|
|
|
) + os.archiveExt)
|
|
|
|
|
2021-04-07 17:19:23 +03:00
|
|
|
private def cleanDirectory(dir: File): Unit = {
|
|
|
|
for (f <- IO.listFiles(dir)) {
|
|
|
|
IO.delete(f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
/** Creates compressed and ready for release packages for the launcher and
|
|
|
|
* engine.
|
|
|
|
*
|
|
|
|
* A project manager package is not created, as we release only its bundle.
|
|
|
|
* See [[makeBundles]].
|
|
|
|
*
|
|
|
|
* It does not trigger any builds. Instead, it uses available artifacts
|
|
|
|
* placed in `artifactRoot`. These artifacts may be created using the
|
|
|
|
* `enso/build*Distribution` tasks or they may come from other workers (as
|
|
|
|
* is the case in the release CI where the artifacts are downloaded from
|
|
|
|
* other jobs).
|
|
|
|
*/
|
|
|
|
def makePackages = Command.command("makePackages") { state =>
|
|
|
|
val log = state.log
|
|
|
|
for {
|
|
|
|
os <- OS.platforms
|
2023-12-05 13:24:02 +03:00
|
|
|
arch <- os.archs
|
2021-01-15 18:26:51 +03:00
|
|
|
} {
|
|
|
|
val launcher = builtArtifact("launcher", os, arch)
|
|
|
|
if (launcher.exists()) {
|
|
|
|
fixLauncher(launcher, os)
|
|
|
|
val archive = builtArchive("launcher", os, arch)
|
|
|
|
makeArchive(launcher, "enso", archive)
|
|
|
|
log.info(s"Created $archive")
|
|
|
|
}
|
|
|
|
|
|
|
|
val engine = builtArtifact("engine", os, arch)
|
|
|
|
if (engine.exists()) {
|
|
|
|
if (os.isUNIX) {
|
|
|
|
makeExecutable(engine / s"enso-$ensoVersion" / "bin" / "enso")
|
|
|
|
}
|
|
|
|
val archive = builtArchive("engine", os, arch)
|
|
|
|
makeArchive(engine, s"enso-$ensoVersion", archive)
|
|
|
|
log.info(s"Created $archive")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
state
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Creates launcher and project-manager bundles that include the component
|
|
|
|
* itself, the engine and a Graal runtime.
|
|
|
|
*
|
|
|
|
* It will download the GraalVM runtime and cache it in `artifactRoot` so
|
|
|
|
* further invocations for the same version will not need to download it.
|
|
|
|
*
|
|
|
|
* It does not trigger any builds. Instead, it uses available artifacts
|
|
|
|
* placed in `artifactRoot`. These artifacts may be created using the
|
|
|
|
* `enso/build*Distribution` tasks or they may come from other workers (as
|
|
|
|
* is the case in the release CI where the artifacts are downloaded from
|
|
|
|
* other jobs).
|
|
|
|
*/
|
|
|
|
def makeBundles = Command.command("makeBundles") { state =>
|
|
|
|
val log = state.log
|
|
|
|
for {
|
|
|
|
os <- OS.platforms
|
2023-12-05 13:24:02 +03:00
|
|
|
arch <- os.archs
|
2021-01-15 18:26:51 +03:00
|
|
|
} {
|
|
|
|
val launcher = builtArtifact("launcher", os, arch)
|
|
|
|
if (launcher.exists()) {
|
|
|
|
fixLauncher(launcher, os)
|
|
|
|
copyEngine(os, arch, launcher / "enso" / "dist")
|
2023-10-06 21:49:57 +03:00
|
|
|
copyGraal(
|
|
|
|
os,
|
|
|
|
arch,
|
|
|
|
launcher / "enso" / "runtime" / s"graalvm-ce-java$graalJavaVersion-$graalVersion/"
|
|
|
|
)
|
2021-01-15 18:26:51 +03:00
|
|
|
|
|
|
|
val archive = builtArchive("bundle", os, arch)
|
|
|
|
makeArchive(launcher, "enso", archive)
|
|
|
|
|
|
|
|
cleanDirectory(launcher / "enso" / "dist")
|
|
|
|
cleanDirectory(launcher / "enso" / "runtime")
|
|
|
|
|
|
|
|
log.info(s"Created $archive")
|
|
|
|
}
|
|
|
|
|
|
|
|
val pm = builtArtifact("project-manager", os, arch)
|
|
|
|
if (pm.exists()) {
|
|
|
|
if (os.isUNIX) {
|
|
|
|
makeExecutable(pm / "enso" / "bin" / "project-manager")
|
|
|
|
}
|
|
|
|
|
|
|
|
copyEngine(os, arch, pm / "enso" / "dist")
|
2023-10-06 21:49:57 +03:00
|
|
|
copyGraal(
|
|
|
|
os,
|
|
|
|
arch,
|
|
|
|
pm / "enso" / "runtime" / s"graalvm-ce-java$graalJavaVersion-$graalVersion/"
|
|
|
|
)
|
2021-04-07 17:19:23 +03:00
|
|
|
|
2021-01-15 18:26:51 +03:00
|
|
|
IO.copyFile(
|
|
|
|
file("distribution/enso.bundle.template"),
|
|
|
|
pm / "enso" / ".enso.bundle"
|
|
|
|
)
|
|
|
|
|
|
|
|
val archive = builtArchive("project-manager", os, arch)
|
|
|
|
makeArchive(pm, "enso", archive)
|
|
|
|
|
|
|
|
cleanDirectory(pm / "enso" / "dist")
|
|
|
|
cleanDirectory(pm / "enso" / "runtime")
|
|
|
|
|
|
|
|
log.info(s"Created $archive")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
state
|
|
|
|
}
|
|
|
|
}
|
2020-12-09 16:58:11 +03:00
|
|
|
}
|