-
Couldn't load subscription status.
- Fork 1.1k
Fix dotr -tasty #3436
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
Fix dotr -tasty #3436
Conversation
|
|
||
| if (java == "") | ||
| if (args.isEmpty) { | ||
| println("Couldn't run `dotr` without args. Use `repl` to run the repl or add args to run the dotty application") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call the repl task at this point instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried with repl.evaluated but then dotr only ran repl ignoring the nonempty args. Then I just decided to show this message as we don't really need more in the sbt project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sbt task evaluation is tricky, you probably need to use a dynamic task to get that to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what I thought, hence settled for the message. My main concerns were the factorisation of code and checking the it was executing correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should special case for empty args. We need a better solution:
If I run dotr -Xprint:typer, args is not empty, but I still want to run the REPL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can at least run repl -Xprint:typer.
project/Build.scala
Outdated
| } | ||
| ) | ||
|
|
||
| def dotDynTask(main: String) = Def.inputTaskDyn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think runCompilerMain is a better name
project/Build.scala
Outdated
| println("Couldn't find scala-library on classpath, please run using script in bin dir instead") | ||
| } else { | ||
| val dottyLib = packageAll.value("dotty-library") | ||
| s"""$java -classpath .:$dottyLib:$scalaLib ${args.mkString(" ")}""".! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're refactoring. Triple quotes is not needed here
.drone.yml
Outdated
| commands: | ||
| - cp -R . /tmp/1/ && cd /tmp/1/ | ||
| - ./project/scripts/sbt ";compile ;testAll ;dotty-bench/jmh:run 1 1 tests/pos/alias.scala" | ||
| - ./project/scripts/sbt ";compile ;testAll ;dotty-bench/jmh:run 1 1 tests/pos/alias.scala; ;dotc tests/run/arraycopy.scala ;dotr Test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/pos/alias.scala; ;dotc double semicolon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also not sure it is the best place to test an sbt task. @smarter Do you think it should be a scripted test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scripted tests are always good in my opinion :)
|
|
||
| if (java == "") | ||
| if (args.isEmpty) { | ||
| println("Couldn't run `dotr` without args. Use `repl` to run the repl or add args to run the dotty application") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should special case for empty args. We need a better solution:
If I run dotr -Xprint:typer, args is not empty, but I still want to run the REPL
6cf735e to
be81325
Compare
be81325 to
53e24a5
Compare
069c36d to
7c4d1d7
Compare
|
|
dist/bin/dotc
Outdated
| -Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;; | ||
| -repl) PROG_NAME="$ReplMain" && shift ;; | ||
| -tasty) addScala "-Yretain-trees" && PROG_NAME="$FromTasty" && shift ;; | ||
| -tasty) addScala "-Yretain-trees" && PROG_NAME="$CompilerMain" && shift ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just make -Yretain-trees default to true when -tasty is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, in the compiler itself, instead of doing it in various scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM.
d287c70 to
7b9c17f
Compare
7b9c17f to
a809cfd
Compare
a809cfd to
6706b9e
Compare
|
Last commit needs review |
project/scripts/sbtBootstrappedTests
Outdated
| # check that `dotc` compiles and `dotr` runs it | ||
| echo "testing sbt dotc and dotr" | ||
| mkdir out/scriptedtest0 | ||
| ./dist-bootstrapped/target/pack/bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use dist-bootstrapped/**/dotc instead of bin/dotc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make sure I was testing that version of the script. We could also add some tests for bin/dotc in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bin/dotc just forwards to dist-bootstrapped/target/pack/bin/dotc and calls sbt dist-bootstrapped/pack if needed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll change it.
Fix #3496: Insert classpath before other arguments
No description provided.