Skip to content
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

Wrap the arguments passed to the scalac task between " #21322

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

hamzaremmal
Copy link
Member

When running scalac in the sbt shell, the following task will invoke the compiler's main method and forward the arguments as a single string.

If we do the following:

sbt:scala3> scalac "test.scala" "-Wconf:msg=Given search preference:silent"

The compiiler will not correctly parse the provided arguments, resulting in the following behaviour:

[info] running (fork) dotty.tools.dotc.Main -d <redacted>/scala3/compiler/../out/default-last-scalac-out.jar -classpath <redacted>/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar:<redacted>/scala3/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.6.0-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.6.0-RC1-bin-SNAPSHOT.jar test.scala -Wconf:msg=Given search preference:silent
source file not found: test.scala
source file not found: search
source file not found: preference:silent

This PR fixes the following discribed issue by wrapping each argument between " before calling the compiler's main method.

@hamzaremmal hamzaremmal requested a review from bracevac August 2, 2024 16:37
@hamzaremmal hamzaremmal enabled auto-merge August 2, 2024 16:37
@hamzaremmal hamzaremmal changed the title Wrap the arguments passed to test scalac task between " Wrap the arguments passed to the scalac task between " Aug 2, 2024
Copy link
Contributor

@bracevac bracevac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@hamzaremmal hamzaremmal merged commit 8e1e229 into scala:main Aug 6, 2024
28 checks passed
@hamzaremmal hamzaremmal deleted the fix-scalac-task branch August 6, 2024 17:10
WojciechMazur added a commit that referenced this pull request Aug 28, 2024
…3.5.2 (#21482)

Backports #21322 to the 3.5.2 branch.

PR submitted by the release tooling.
[skip ci]
@WojciechMazur WojciechMazur added this to the 3.5.2 milestone Oct 8, 2024
WojciechMazur added a commit that referenced this pull request Dec 3, 2024
…LTS (#22090)

Backports #21322 to the 3.3.5.

PR submitted by the release tooling.
[skip ci]
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.

3 participants