Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled per-project JVM mode configuration #12550

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

hubertp
Copy link
Collaborator

@hubertp hubertp commented Mar 19, 2025

Pull Request Description

package.yaml now supports jvm field that takes a Boolean. If set to true, the project will be run in JVM mode even if Language Server's Native Image is available.
Closes #12529.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

`package.yaml` now supports `jvm` field that takes a Boolean. If
set to true, the project will be run in JVM mode even if Language
Server's Native Image is available.
@hubertp hubertp added the CI: No changelog needed Do not require a changelog entry for this PR. label Mar 19, 2025
@hubertp hubertp marked this pull request as ready for review March 19, 2025 15:07
Copy link
Member

@Akirathan Akirathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance we could do a simple test for this? Add a dummy project with jvm = true in the package descriptor, launch it via native engine, and look for "Started in JVM" in stdout? Something like that?

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • unless I am mistaken jvm: true has no effect on CLI execution
  • we need CLI execution to behave the same as IDE execution (thus requesting changes)
  • e.g. enso launcher needs to honor the jvm: value in package.yaml
  • having a test to ensure that would be great
  • other than that OK
  • I just left few inline comments/opinions about tri-state and binary state

@@ -628,6 +628,7 @@ private void createNew(
authors,
nil(),
"",
Option$.MODULE$.empty(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change in engine/runner. Is that sufficient to switch to JVM mode when there is a project with jvm: true and one does:

enso --run the_project

? I am afraid that it is not sufficient.

@@ -280,7 +280,8 @@ object ComponentGroupsResolverSpec {
maintainers = Nil,
edition = None,
preferLocalLibraries = true,
componentGroups = Some(componentGroups)
componentGroups = Some(componentGroups),
jvm = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it important to have a tri-state value for jvm? Isn't binary Boolean enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not enough if we want to be backwards compatible with configs that don't have that field.

@@ -307,7 +308,8 @@ class PackageManager[F](implicit val fileSystem: FileSystem[F]) {
authors: List[Contact] = List(),
maintainers: List[Contact] = List(),
license: String = "",
componentGroups: Option[ComponentGroups] = None
componentGroups: Option[ComponentGroups] = None,
jvm: Option[Boolean] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tri-state value. Shouldn't we use just Boolean - e.g. binary state here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so, no.

@@ -4,3 +4,4 @@ enso-version: default
version: "0.0.1"
author: "Enso Team <[email protected]>"
maintainer: "Enso Team <[email protected]>"
jvm: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need jvm: false here? Isn't false the default when there is no jvm:?

engineVersion = engineVersion,
jvmSettings = distributionConfiguration.defaultJVMSettings,
jvmModeEnabled =
processConfig.jvmMode || project.jvmModeEnabled.getOrElse(false),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the tri-state gets converted to binary state, right? Is LanguageServerController the right place to encode the default value? Shouldn't there be project.isJvmMode(): Boolean?

@hubertp
Copy link
Collaborator Author

hubertp commented Mar 21, 2025

  • unless I am mistaken jvm: true has no effect on CLI execution

That is a valid point indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow per-project JVM mode
3 participants