Skip to content

package should actually package each of the cross-compiled configurations with --cross #3591

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

Open
Gedochao opened this issue Mar 26, 2025 · 0 comments
Labels
--cross Issues tied to cross compilation/the --cross option. experimental Tickets tied to experimental features. missing feature Something should have been implemented, but wasn't.

Comments

@Gedochao
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, passing --cross with package cross-compiles against all configured Scala versions, but only packages the first one.

//> using scala 2.13.16 2.13.15 2.13.14
object Main extends App {
  println(util.Properties.versionNumberString)
}
scala-cli package . --cross --power
# The `--cross` option is experimental
# Please bear in mind that non-ideal user experience should be expected.
# If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli
# Compiling project (Scala 2.13.16, JVM (23))
# Compiled project (Scala 2.13.16, JVM (23))
# Compiling project (Scala 2.13.15, JVM (23))
# Compiled project (Scala 2.13.15, JVM (23))
# Compiling project (Scala 2.13.14, JVM (23))
# Compiled project (Scala 2.13.14, JVM (23))
# Wrote ~/Main, run it with
#  ./Main
./Main
# 2.13.16

Describe the solution you'd like
I would expect to not just cross-compile against each version, but also package each of them.
So I'd expect:

scala-cli package . --cross --power
# The `--cross` option is experimental
# Please bear in mind that non-ideal user experience should be expected.
# If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli
# Compiling project (Scala 2.13.16, JVM (23))
# Compiled project (Scala 2.13.16, JVM (23))
# Compiling project (Scala 2.13.15, JVM (23))
# Compiled project (Scala 2.13.15, JVM (23))
# Compiling project (Scala 2.13.14, JVM (23))
# Compiled project (Scala 2.13.14, JVM (23))
# Wrote ~/Main_2.13.16, ~/Main_2.13.15, ~/Main_2.13.14 
# Run them with
#  ./Main_x
./Main_2.13.16
# 2.13.16
./Main_2.13.15
# 2.13.15
./Main_2.13.14
# 2.13.14

Describe alternatives you've considered
The current behaviour is counter-intuitive (and inconsistent with how test or publish behave, where they respectively test or publish against all cross-compiled versions), but if we were to skip on running each option, we should at least log an explanation on what and why, as per:

Additional context

@Gedochao Gedochao added --cross Issues tied to cross compilation/the --cross option. experimental Tickets tied to experimental features. missing feature Something should have been implemented, but wasn't. labels Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--cross Issues tied to cross compilation/the --cross option. experimental Tickets tied to experimental features. missing feature Something should have been implemented, but wasn't.
Projects
None yet
Development

No branches or pull requests

1 participant