Skip to content

Run all cross builds when --cross is passed #3808

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

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

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