Open
Description
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
- relevant tests added in Add tests for the current behaviour of
--cross
#3589 - similar issue with the
run
command inrun
should actually run each of the cross-compiled configurations with--cross
#3590