Skip to content

Conversation

Gedochao
Copy link
Contributor

@Gedochao Gedochao commented Jul 29, 2025

Fixes #3590
Fixes #3026

Given smth.sc like this

//> using scala 3 2.13 2.12
println("Hello")

Before these changes, running with --cross would compile against all cross versions, but only run against the first one passed (with no indication via logs, either):

scala-cli smth.sc
# Compiling project (Scala 3.7.1, JVM (23))
# Compiled project (Scala 3.7.1, JVM (23))
# Hello
scala-cli clean .
scala-cli smth.sc --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 3.7.1, JVM (23))
# Compiled project (Scala 3.7.1, JVM (23))
# Compiling project (Scala 2.13.16, JVM (23))
# Compiled project (Scala 2.13.16, JVM (23))
# Compiling project (Scala 2.12.20, JVM (23))
# Compiled project (Scala 2.12.20, JVM (23))
# Hello

Now it actually gets run for each configuration, as it should (and there're some logs for sanity's sake):

scala-cli smth.sc 
# Compiling project (Scala 3.7.1, JVM (23))
# Compiled project (Scala 3.7.1, JVM (23))
# Cross-building is disabled, ignoring 2 builds:
#   Scala 2.13, JVM
#   Scala 2.12, JVM
# Cross builds are only available when the --cross option is passed.
# Defaulting to Scala 3.7.1, JVM
# Hello
scala-cli clean .
scala-cli smth.sc --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 3.7.1, JVM (23))
# Compiled project (Scala 3.7.1, JVM (23))
# Compiling project (Scala 2.13.16, JVM (23))
# Compiled project (Scala 2.13.16, JVM (23))
# Compiling project (Scala 2.12.20, JVM (23))
# Compiled project (Scala 2.12.20, JVM (23))
# Hello
# Hello
# Hello

@Gedochao Gedochao force-pushed the feature/cross-tweaks branch 3 times, most recently from 6ec51be to 782f14a Compare September 2, 2025 07:49
@Gedochao Gedochao force-pushed the feature/cross-tweaks branch from 782f14a to 7b2fcab Compare September 8, 2025 11:51
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.

run should actually run each of the cross-compiled configurations with --cross Add extra logging for --cross
1 participant