-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use manifest on Windows #31
Conversation
This change fixes scalameta#26 Windows native-image error for large classpath, by using the manifest on Windows. Absolute paths in manifests are only supported with some JDKs on Windows, therefore I used relative paths. Relative paths may not be URL encoded, otherwise an absolute path is generated
Thank you for this contribution! I'm glad to see this finally get fixed. It's always been unsatisfying that we didn't use manifest jars on Windows. I'm happy to merge this PR once the Windows CI is green. I just noticed that Scalafmt and Scalafix haven't been added to the build. I will add them after merging this PR so don't worry about the unrelated formatting changes, they will get fixed later. |
Unfortunately the Windows build now fails with I assume this is caused by the image being built in D: while some of its dependencies are in C: In my experience people no longer use multiple drives on Windows. Therefore chaining the configuration of the windows-latest CI image/build might be an option. Maybe a config switch to change between manifest and classpath would make sense, to avoid breaking anyone's workflow in a way they cannot recover from. |
I'm not very familiar with Windows so this is a guess. It looks like the jars from the dependency classpath are living in a different drive from the manifest jar. It could be that the dependency jar is on a different drive because coursier downloads dependencies to the system cache directory, which GitHub Actions configures to be a different drive. If that's true, then I suspect this will be a common issue for sbt-native-image users who want to build/upload native-image binaries from GitHub Actions.
I don't think a config option will solve the problem here because if the application needs a manifest jar (because the classpath is too large) then it will fail with a "argument list too long" error unless it can always use a manifest jar in all environments. One possible workaround is to copy the dependency jar into the same target directory as the manifest jar. That would ensure the jars are always on the same drive. What do you think? |
Would you call an according method from
i.e.
|
We can add a try/catch to the |
In case the dependencies reside on a different drive then the manifest, i.e. C:\Coursier\Cache and D:\myapp\target Copy the dependency next to the manifest. This only ever happens on Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM will merge once ci is green :)
Just published https://github.com/scalameta/sbt-native-image/releases/tag/v0.3.1 it may take a few hours until it's available on Maven Central |
Great, thank you Ólafur |
This change fixes #26 Windows native-image error for large classpath, by using the manifest on Windows.
Absolute paths in manifests are only supported with some JDKs on Windows, therefore I used relative paths.
Relative paths may not be URL encoded, otherwise an absolute path is generated