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

refactor: Use Scala Native instead of native image #4738

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Jan 24, 2025

Fixes #4729

@tgodzik tgodzik force-pushed the build-scala-native branch 4 times, most recently from 1bf9105 to 006a710 Compare January 24, 2025 18:54
@tgodzik tgodzik force-pushed the build-scala-native branch from 006a710 to edcfb8e Compare January 24, 2025 19:15
@tgodzik tgodzik requested a review from kitbellew January 24, 2025 19:15
@tgodzik tgodzik marked this pull request as ready for review January 24, 2025 19:15
@tgodzik
Copy link
Contributor Author

tgodzik commented Jan 24, 2025

Looks like it's simpler than I thought. I also added windows and macos runners.

@tgodzik
Copy link
Contributor Author

tgodzik commented Jan 24, 2025

I wonder if we should be so strict with the version incompatibility? Maybe we should allow version of the image higher than the version in the config?

- uses: sbt/setup-sbt@v1
- run: bin/build-native-image.sh
- run: sbt scala-native
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we create a script as well, bin/build-scala-native.sh and hide all the overly specific logic pertaining to scala-2.13 or target location or current architecture (what you have under deploy.XXX)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that for sure, but it's not a lot of logic really and I would have to also deal with windows scripts 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

let me continue this comment above, under deploy.

@kitbellew
Copy link
Collaborator

I wonder if we should be so strict with the version incompatibility? Maybe we should allow version of the image higher than the version in the config?

where does this come into play?

@tgodzik
Copy link
Contributor Author

tgodzik commented Jan 24, 2025

I wonder if we should be so strict with the version incompatibility? Maybe we should allow version of the image higher than the version in the config?

where does this come into play?

We have a check for scala native that if the version of the binary is different than the one in config it will throw an exception.

- uses: sbt/setup-sbt@v1
- run: bin/build-native-image.sh
- run: sbt scala-native
Copy link
Collaborator

Choose a reason for hiding this comment

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

let me continue this comment above, under deploy.

NATIVE_IMAGE_STATIC: musl
env: ${{ matrix.env }}
deploy: [
{ os : macOS-13, name: scalafmt-x86_64-apple-darwin, path: "scalafmt-cli/native/target/scala-2.13/scalafmt-cli"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

i just thought that perhaps all these OS and architecture values can be easily deduced from the environment and don't have to be hardcoded...

also, should we just call sbt and ask for the location of the target directory, instead of hardcoding with scala-2.13?

if that can be done, then i am ok without a script.

@kitbellew
Copy link
Collaborator

I wonder if we should be so strict with the version incompatibility? Maybe we should allow version of the image higher than the version in the config?

where does this come into play?

We have a check for scala native that if the version of the binary is different than the one in config it will throw an exception.

I wouldn't do that. we must use the version specified in the config file, that's the contract. how is "higher version" better than "lower version"? both can produce a slightly different formatting, even if higher likely won't fail on newer configuration parameters.

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.

Publish images using Scala native instead of Native Image
2 participants