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

[WIP] Build binaries for Mill Client using Graal VM native-image #4044

Merged
merged 62 commits into from
Jan 9, 2025

Conversation

ajaychandran
Copy link
Contributor

@ajaychandran ajaychandran commented Nov 28, 2024

This PR builds binaries for Mill using Graal VM native-image and adds Java/Scala/Kotlin examples for building native images.

Execution time for mill --version, with server running, shows over 5x improvement.

$ time ./mill --version
Mill Build Tool version 0.12.3
Java version: 11.0.25, vendor: Eclipse Adoptium, runtime: ~/.sdkman/candidates/java/11.0.25-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "Linux", version: 6.8.0-49-generic, arch: amd64

real	0m0.113s
user	0m0.171s
sys	0m0.037s

$ time ./out/dist/native.dest/mill --version
Mill Build Tool version 0.12.3-14-b0feea
Java version: 11.0.25, vendor: Eclipse Adoptium, runtime: ~/.sdkman/candidates/java/11.0.25-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "Linux", version: 6.8.0-49-generic, arch: amd64

real	0m0.021s
user	0m0.005s
sys	0m0.016s

Resolves #4007.

@ajaychandran
Copy link
Contributor Author

TBD:

  • Add Github actions for building and uploading binaries for different platforms.
  • Update bootstrap script to download platform specific binary.

@lihaoyi
Should the existing distribution assembly be retained?

@ajaychandran ajaychandran changed the title [WIP] Added binaries for Mill using Graal VM native-image [WIP] Build binaries for Mill using Graal VM native-image Nov 28, 2024
@ajaychandran ajaychandran changed the title [WIP] Build binaries for Mill using Graal VM native-image [WIP] Build binaries for Mill Client using Graal VM native-image Nov 28, 2024
@lihaoyi
Copy link
Member

lihaoyi commented Nov 28, 2024

@ajaychandran lets retain the existing assembly for now; we'll likely want to offer both runners for a while until we have confidence in the robustness of the nee one, and even then it would be nice to have a fallback (e.g. in OS/architectures the new one doesnt support)

@ajaychandran ajaychandran force-pushed the native branch 2 times, most recently from e936737 to 191f88f Compare December 1, 2024 21:30
@lefou
Copy link
Member

lefou commented Dec 4, 2024

Maybe, we should just use the mill.javalib package for the new modules and avoid any new type re-exports from scalalib and kotlinlib. @lihaoyi WDYT?

@lihaoyi
Copy link
Member

lihaoyi commented Dec 5, 2024

@lefou I think for now following the re-export convention is probably best, once we decide what to do in #3570 we may need to break compatibility in 0.13.0 anyway, but until then we should at least keep things consistent

@lihaoyi
Copy link
Member

lihaoyi commented Jan 9, 2025

Going to leave out windows support and cross-platform mill artifact publishing jobs to a follow up PR, but the main user-land native image workflows and Mill native image construction seems to work

@lihaoyi lihaoyi merged commit 64b0856 into com-lihaoyi:main Jan 9, 2025
28 of 29 checks passed
@lihaoyi
Copy link
Member

lihaoyi commented Jan 9, 2025

Merged this; thanks for the contribution @ajaychandran, I'll pay out 1/3 of the bounty (500USD) for the work you did. Will open up follow up tickets for the other parts (publishing Mill artifacts, windows, etc.)

@lefou lefou added this to the 0.12.6 milestone Jan 9, 2025
@ajaychandran ajaychandran deleted the native branch January 23, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use GraalVM Native Image for Mill Client (1500USD Bounty)
3 participants