-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add fix command for extracting using directives into project.scala
file
#2309
Conversation
db07f80
to
c737202
Compare
c0b5672
to
6f5bd19
Compare
Where are the requirements of this defined? I'm not really seeing anything in the original issue. You're adding a new subcommand called "fix"? |
The requirements for this were discussed internally by the Scala CLI team. I can list them in the description since they are quite simple.
Yes, the proposal right now is to add this functionaility in a |
103cb07
to
92e2f09
Compare
modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala
Outdated
Show resolved
Hide resolved
modules/build/src/main/scala/scala/build/preprocessing/UsingDirectivesOps.scala
Outdated
Show resolved
Hide resolved
modules/cli/src/main/scala/scala/cli/commands/fix/FixOptions.scala
Outdated
Show resolved
Hide resolved
modules/cli/src/main/scala/scala/cli/commands/fix/FixOptions.scala
Outdated
Show resolved
Hide resolved
modules/integration/src/test/scala/scala/cli/integration/FixTests.scala
Outdated
Show resolved
Hide resolved
024fed6
to
e261683
Compare
4f1d06f
to
9aadf65
Compare
modules/build/src/main/scala/scala/build/preprocessing/DirectivesPreprocessor.scala
Outdated
Show resolved
Hide resolved
modules/directives/src/main/scala/scala/build/preprocessing/directives/DirectiveHandler.scala
Outdated
Show resolved
Hide resolved
modules/build/src/main/scala/scala/build/preprocessing/UsingDirectivesOps.scala
Outdated
Show resolved
Hide resolved
modules/build/src/main/scala/scala/build/preprocessing/UsingDirectivesOps.scala
Outdated
Show resolved
Hide resolved
050f8d8
to
608fe6c
Compare
fcd8df9
to
72612a5
Compare
72612a5
to
f1108b9
Compare
modules/build/src/main/scala/scala/build/preprocessing/SheBang.scala
Outdated
Show resolved
Hide resolved
-Add logging to Fix command -Format the copied directives in project.scala -Add support for test. directives in main scope -Add support for sources with shebang -Move removing directives as the last operation in Fix command -Remove ordering via hardcoded names -Apply review fixes
f1108b9
to
a88b572
Compare
Fixes #2104
Introduces a new subcommand
fix
that extracts allusing directives
that exist througout the project sources (not only files on disk but everything that's linked to the project build). Those extracted directives are then written toproject.scala
file.This process can be split into two parts (their order is not exactly 1. -> 2. in code):
project.scala
Rules regarding the 1. part:
target using directive
then it's directives are not extracted, since it's a correct way to create projects with cross-configuration (the warning about using directives in multiple files has been modified accordingly)project.scala
using theirtest.
equivalents (using dep -> using test.dep) if possible, if not possible they are not written toproject.scala
Rules regarding the 2. part:
test.
equivalents they are kept in this source and are not moved toproject.scala
, all the others extractedusing directives
are removed from the source if rule above applies