Renaming launcher executable to ensoup (#10535)

Closes #10476.

# Important Notes
Let's see what exactly fails on the CI and fix that then...
This commit is contained in:
Jaroslav Tulach 2024-07-16 16:30:23 +02:00 committed by GitHub
parent 9e553397b6
commit c367e76e44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 70 additions and 59 deletions

View File

@ -3,8 +3,10 @@
#### Enso Language & Runtime
- [Enforce conversion method return type][10468]
- [Renaming launcher executable to ensoup][10535]
[10468]: https://github.com/enso-org/enso/pull/10468
[10535]: https://github.com/enso-org/enso/pull/10535
#### Enso IDE

View File

@ -2738,7 +2738,9 @@ lazy val launcher = project
.in(file("engine/launcher"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
commands += WithDebugCommand.withDebug,
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
@ -2751,7 +2753,7 @@ lazy val launcher = project
NativeImage.additionalCp := Seq.empty,
rebuildNativeImage := NativeImage
.buildNativeImage(
"enso",
"ensoup",
staticOnLinux = true,
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
@ -2766,7 +2768,7 @@ lazy val launcher = project
buildNativeImage := NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"enso"
"ensoup"
)
.value,
assembly / test := {},

View File

@ -175,7 +175,7 @@ In order to build and run Enso you will need the following tools:
should be installed by default on most distributions.
- On Windows, the `run` command must be run in the latest version of
`Powershell` or in `cmd`.
- If you want to be able to build the Launcher Native Image, you will need a
- If you want to be able to build the `ensoup` Native Image, you will need a
native C compiler for your platform as described in the
[Native Image Prerequisites](https://www.graalvm.org/reference-manual/native-image/#prerequisites).
On Linux that will be `gcc`, on macOS you may need `xcode` and on Windows you
@ -294,17 +294,9 @@ shell will execute the appropriate thing. Furthermore we have `testOnly` and
`benchOnly` that accept a glob pattern that delineates some subset of the tests
or benchmarks to run (e.g. `testOnly *FunctionArguments*`).
#### Building the Launcher Native Binary
#### Building the Updater Native Binary
If you want to build the native launcher binary, you need to ensure that the
Native Image component is installed in your GraalVM distribution. To install it,
run:
```bash
<path-to-graal-home>/bin/gu install native-image
```
Then, you can build the launcher using:
Then, you can build the updater/launcher using:
```bash
sbt launcher/buildNativeImage

View File

@ -15,7 +15,7 @@ any additional dependencies.
<!-- MarkdownTOC levels="2,3" autolink="true" -->
- [Project Manager Bundle](#project-manager-bundle)
- [Launcher Bundles](#launcher-bundles)
- [`ensoup` Bundles](#ensoup-bundles)
<!-- /MarkdownTOC -->
@ -59,12 +59,12 @@ the case for example if the Project Manager bundle is packaged as part of IDE's
AppImage package). In such situation, it will be impossible to uninstall the
bundled components and a relevant error message will be returned.
## Launcher Bundles
## `ensoup` Bundles
Bundles are also distributed for the launcher, but these are implemented using a
different mechanism.
Bundles are also distributed for the `ensoup` updater, but these are implemented
using a different mechanism.
Since the launcher can run in
Since the `ensoup` can run in
[portable mode](distribution.md#portable-enso-distribution-layout), the bundled
engine and runtime are simply included within its portable package. They can
then be used from within this portable package or

View File

@ -32,12 +32,14 @@ run, or use the default version if none specified. It should also be able to
launch other Enso components, provided as
[plugins](./launcher.md#running-plugins).
<!--
> This launcher is under development. Until it is in a ready-to-use state, the
> Enso version packages provide simple launcher scripts in the `bin` directory
> of that package. They are a temporary replacement for the launcher
> functionality, so once the universal launcher matures, they will be removed.
> The universal launcher will not call the components through these scripts, as
> it must have full control over which JVM is chosen and its parameters.
-->
## Enso Distribution Layout
@ -55,7 +57,7 @@ The directory structure is as follows:
```
extraction-location
├── bin
│ └── enso # The universal launcher, responsible for choosing the appropriate compiler version.
│ └── ensoup # The universal launcher, responsible for choosing the appropriate compiler version.
├── config
│ └── global-config.yaml # Global user configuration.
├── dist # Per-compiler-version distribution directories.
@ -112,7 +114,7 @@ ENSO_CONFIG_DIRECTORY
└── global-config.yaml # Global user configuration.
ENSO_BIN_DIRECTORY
└── enso # The universal launcher, responsible for choosing the appropriate compiler version.
└── ensoup # The universal launcher, responsible for choosing the appropriate compiler version.
```
Where `ENSO_DATA_DIRECTORY`, `ENSO_CONFIG_DIRECTORY` and `ENSO_BIN_DIRECTORY`

View File

@ -6,7 +6,7 @@ tags: [distribution, launcher]
order: 4
---
# Enso Launcher
# Enso Updater/Launcher
The launcher is used to run Enso commands (like the REPL, language server etc.)
and seamlessly manage Enso versions. This document describes it's features. Its

View File

@ -14,10 +14,10 @@ Each release has an "Assets" section at the bottom. You can click on this to
view the list of artifacts from which you can download the most appropriate
version.
These assets contain bundles that include the Enso launcher, an engine version,
and GraalVM, allowing you to get up and running immediately. Alternatively, you
can download just the launcher, which will handle downloading and installing the
required components for you.
These assets contain bundles that include the `ensoup` updater, an engine
version, and GraalVM, allowing you to get up and running immediately.
Alternatively, you can download just the updater, which will handle downloading
and installing the required components for you.
<!-- MarkdownTOC levels="2,3" autolink="true" -->

View File

@ -14,7 +14,7 @@ up as follows:
- [**sbt:**](sbt.md) The build tools that are used for building the project.
- [**Native Image:**](native-image.md) Description of the Native Image build
used for building the launcher native binary.
used for building the `ensoup` native binary.
- [**Rust:**](rust.md) Description of integration of the Scala project with the
Rust components.
- [**Upgrading GraalVM:**](upgrading-graalvm.md) Description of steps that have

View File

@ -140,8 +140,8 @@ environmental variable but it depends on which component we are executing.
server that collects logs (as defined in `logging-service.server` config key)
and the logs output can be overwritten by `ENSO_LOGSERVER_APPENDER` env
variable
- `launcher` or `runner` - the default log output can be overwritten by defining
the `ENSO_APPENDER_DEFAULT` env variable
- `ensoup` or `enso` - the default log output can be overwritten by defining the
`ENSO_APPENDER_DEFAULT` env variable
For example, for the project manager to output to `console` one simply executes

View File

@ -21,7 +21,7 @@ Native Image is used for building the Launcher.
- [Static Builds](#static-builds)
- [No Cross-Compilation](#no-cross-compilation)
- [Configuration](#configuration)
- [Launcher Configuration](#launcher-configuration)
- [`ensoup` Configuration](#ensoup-configuration)
- [Project Manager Configuration](#project-manager-configuration)
<!-- /MarkdownTOC -->
@ -63,7 +63,7 @@ replaced with absolute paths to the bundle location.
The task is parametrized with `staticOnLinux` parameter which if set to `true`,
will statically link the built binary, to ensure portability between Linux
distributions. For Windows and MacOS, the binaries should generally be portable,
as described in [Launcher Portability](../distribution/launcher.md#portability).
as described in [`ensoup` Portability](../distribution/launcher.md#portability).
## No Cross-Compilation
@ -105,7 +105,7 @@ java \
<application arguments>
```
For example, to update settings for the Launcher:
For example, to update settings for the Launcher project:
```bash
java -agentlib:native-image-agent=config-merge-dir=engine/launcher/src/main/resources/META-INF/native-image/org/enso/launcher -jar launcher.jar <arguments>
@ -139,7 +139,7 @@ After updating the Native Image configuration, make sure to clean it by running
cd tools/native-image-config-cleanup && npm install && npm start
```
### Launcher Configuration
### `ensoup` Configuration
In case of the launcher, to gather the relevant reflective accesses one wants to
test as many execution paths as possible, especially the ones that are likely to

View File

@ -18,13 +18,6 @@ take the following actions to be able to continue development after the upgrade:
updating, removing `engine/runtime/build-cache` directory may help).
3. Do a full clean (it may not _always_ be required, but not doing it often
leads to problems so it is much safer to do it) by running `enso/clean`.
4. To be able to build or run tests for the `launcher` project, Native Image for
the new GraalVM version has to be installed, as it is not included by
default. This can be done with
`<path-to-graal-home>/bin/gu install native-image`.
- If there are problems building the Native Image, removing
`engine/launcher/build-cache` (which contains the downloaded `musl`
package) may help.
## Upgrading the Build

View File

@ -0,0 +1 @@
package org.enso.launcher;

View File

@ -4,6 +4,9 @@ import org.enso.semver.SemVer
object Constants {
/** Base name of the launcher executable */
val name = "ensoup"
/** The engine version in which the uploads command has been introduced.
*
* It is used to check by the launcher if the engine can handle this command

View File

@ -729,9 +729,9 @@ object LauncherApplication {
val application: Application[Config] =
Application(
"enso",
"ensoup",
"Enso",
"Enso Launcher",
"Enso Updater",
topLevelOpts,
commands,
PluginManager

View File

@ -21,6 +21,7 @@ import org.enso.launcher.distribution.{DefaultManagers, LauncherResourceManager}
import java.nio.file.{Files, Path}
import scala.util.control.NonFatal
import org.enso.launcher.Constants
/** Allows to [[uninstall]] an installed distribution.
*
@ -318,7 +319,8 @@ class DistributionUninstaller(
private def partiallyUninstallExecutableWindows(): Path = {
val currentPath = manager.env.getPathToRunningExecutable
val newPath = currentPath.getParent.resolve(OS.executableName("enso.old"))
val newPath =
currentPath.getParent.resolve(OS.executableName(Constants.name + ".old"))
Files.move(currentPath, newPath)
newPath
}
@ -338,7 +340,9 @@ class DistributionUninstaller(
parentToRemove: Option[Path]
): Nothing = {
val temporaryLauncher =
Files.createTempDirectory("enso-uninstall") / OS.executableName("enso")
Files.createTempDirectory("enso-uninstall") / OS.executableName(
Constants.name
)
val oldLauncher = myNewPath
Files.copy(oldLauncher, temporaryLauncher)
InternalOpts

View File

@ -255,7 +255,7 @@ class LauncherUpgrader(
.iterateArchive(archivePath) { entry =>
if (
entry.relativePath.endsWith(
Path.of("bin") / OS.executableName("enso")
Path.of("bin") / OS.executableName(org.enso.launcher.Constants.name)
)
) {
entryFound = true

View File

@ -0,0 +1 @@
package org.enso.launcher;

View File

@ -113,7 +113,7 @@ trait NativeTest
* functionality.
*/
def baseLauncherLocation: Path =
rootDirectory.resolve(OS.executableName("enso"))
rootDirectory.resolve(OS.executableName(Constants.name))
/** Creates a copy of the tested launcher binary at the specified location.
*

View File

@ -11,7 +11,7 @@ import org.enso.testkit.WithTemporaryDirectory
class InstallerSpec extends NativeTest with WithTemporaryDirectory {
def portableRoot = getTestDirectory / "portable"
def portableLauncher =
portableRoot / "bin" / OS.executableName("enso")
portableRoot / "bin" / OS.executableName(Constants.name)
def preparePortableDistribution(): Unit = {
copyLauncherTo(portableLauncher)
@ -66,9 +66,13 @@ class InstallerSpec extends NativeTest with WithTemporaryDirectory {
env
)
(installedRoot / "bin" / OS.executableName("enso")).toFile should exist
(installedRoot / "bin" / OS.executableName(
Constants.name
)).toFile should exist
assert(
Files.isExecutable(installedRoot / "bin" / OS.executableName("enso")),
Files.isExecutable(
installedRoot / "bin" / OS.executableName(Constants.name)
),
"The installed file should be executable."
)
@ -97,7 +101,9 @@ class InstallerSpec extends NativeTest with WithTemporaryDirectory {
env
)
(installedRoot / "bin" / OS.executableName("enso")).toFile should exist
(installedRoot / "bin" / OS.executableName(
Constants.name
)).toFile should exist
portableLauncher.toFile should exist
}

View File

@ -30,10 +30,11 @@ class UninstallerSpec extends NativeTest with WithTemporaryDirectory {
val configDirectory =
if (everythingInsideData) installedRoot / "config"
else getTestDirectory / "enso-config"
val dataDirectory = installedRoot
val runDirectory = installedRoot
val logDirectory = installedRoot / "log"
val portableLauncher = binDirectory / OS.executableName("enso")
val dataDirectory = installedRoot
val runDirectory = installedRoot
val logDirectory = installedRoot / "log"
val portableLauncher =
binDirectory / OS.executableName(org.enso.launcher.Constants.name)
copyLauncherTo(portableLauncher)
Files.createDirectories(dataDirectory / "dist")
Files.createDirectories(configDirectory)

View File

@ -36,7 +36,11 @@ class UpgradeSpec
/** Location of the actual launcher executable that is wrapped by the shims.
*/
private val realLauncherLocation =
Path.of(".").resolve(OS.executableName("enso")).toAbsolutePath.normalize
Path
.of(".")
.resolve(OS.executableName(Constants.name))
.toAbsolutePath
.normalize
/** Path to a launcher shim that pretends to be `version`.
*/
@ -57,7 +61,7 @@ class UpgradeSpec
Files.createDirectories(destinationDirectory)
Files.copy(
builtLauncherBinary(version),
destinationDirectory / OS.executableName("enso"),
destinationDirectory / OS.executableName(Constants.name),
StandardCopyOption.REPLACE_EXISTING
)
}
@ -103,7 +107,7 @@ class UpgradeSpec
/** Path to the launcher executable in the temporary distribution.
*/
private def launcherPath =
getTestDirectory / "enso" / "bin" / OS.executableName("enso")
getTestDirectory / "enso" / "bin" / OS.executableName(Constants.name)
/** Runs `enso version` to inspect the version reported by the launcher.
* @return the reported version
@ -274,7 +278,7 @@ class UpgradeSpec
.listDirectory(binDirectory)
.map(_.getFileName.toString)
.filter(_.startsWith("enso"))
leftOverExecutables shouldEqual Seq(OS.executableName("enso"))
leftOverExecutables shouldEqual Seq(OS.executableName(Constants.name))
}
} finally {
if (process.isAlive) {

View File

@ -411,7 +411,7 @@ class DistributionManager(val env: Environment) {
def irCacheDirectory: Path = this.cacheDirectory / "ir"
private def executableName: String =
OS.executableName("enso")
OS.executableName("ensoup")
/** The path where the binary executable of the installed distribution
* should be placed by default.

View File

@ -414,7 +414,7 @@ object DistributionPackage {
)
copyFilesIncremental(
Seq(file(executableName("enso"))),
Seq(file(executableName("ensoup"))),
distributionRoot / "bin",
cacheFactory.make("launcher-exe")
)