Skip to content

Conversation

@vitvakatu
Copy link
Contributor

@vitvakatu vitvakatu commented Nov 25, 2025

Pull Request Description

Another step towards fully-functional Electron package in Bazel.

bazel build //:sbt_build_native_engine_distribution is working on Mac and Linux and produces practically identical distribution comparing to a regular sbt run. CI action is modified to check native distribution on Linux.

Important Notes

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.

@vitvakatu vitvakatu self-assigned this Nov 25, 2025
@vitvakatu vitvakatu added CI: No changelog needed Do not require a changelog entry for this PR. -ci labels Nov 26, 2025
@vitvakatu vitvakatu changed the title Wip/vitvakatu/bazel native image Building native engine distribution with Bazel Nov 26, 2025
@vitvakatu vitvakatu marked this pull request as ready for review November 26, 2025 10:59
args = [
"buildEngineDistribution",
],
env = NATIVE_IMAGE_ENV,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we want fast,-ls by default, do we?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Akirathan please help 🙏🏻

Copy link
Member

Choose a reason for hiding this comment

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

As @JaroslavTulach mentioned in #14351 (comment), I have originally introduced fast,-ls on purpose, so that it will build faster. For release NI build, however, the ENSO_LAUNCHER env variable needs to be native. Alternatively, just unset the ENSO_LAUNCHER env var. That will ensure that the NI will be build for production.

),
"_linux_constraint": attr.label(
default = Label("@platforms//os:linux"),
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing macos/darwin? if linux & macos are treated in the same way then maybe just rename the constraint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Linux is treated differently, because it requires zlib during native build. Mac does not need any special actions, so it is treated as “default”.

exit 1
fi
$PWD/$binary_path --version
$PWD/$binary_path --version | grep Substrate > /dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not use something like file --mime-encoding rather than this weird version check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair, I guess I will change it.

Copy link
Member

Choose a reason for hiding this comment

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

file --mime-encoding sounds easier on Linux and MacOS. But note that it is possible that the file command is not present in the sandboxed Bazel environment. Moreover, this whole _ensure_native_enso_impl was meant just as a sanity check.

BUILD.bazel Outdated

NATIVE_IMAGE_ENV = dict(
ENV,
ENSO_LAUNCHER = "native,fast,-ls",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ENSO_LAUNCHER = "native,fast,-ls",
ENSO_LAUNCHER = "native",

Copy link
Member

@JaroslavTulach JaroslavTulach Dec 2, 2025

Choose a reason for hiding this comment

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

Production build should run just with native:

Alternatively one should completely remove ENSO_LAUNCHER definition.

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.

Wow, what a black bazel magic. But it works! Congratulations. I can see that the latest Run bazel Engine build correctly builds native image, and executes few tests with it. I have also tried to download the uploaded artifact, and everything seems fine.

@vitvakatu vitvakatu requested review from hubertp and removed request for Frizi December 3, 2025 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

-ci 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.

5 participants