"sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0#453
"sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0#453
Conversation
* add new compiler bridge
7010eb7 to
d2cdccb
Compare
| case (2, y) if y >= 11 => new File(scalaSource.value.getPath + "_2.11+") | ||
| case (2, y) if y == 10 => new File(scalaSource.value.getPath + "_2.10") | ||
| case (2, y) if y == 11 || y == 12 => new File(scalaSource.value.getPath + "_2.11-12") | ||
| case (2, y) if y >= 13 => new File(scalaSource.value.getPath + "_2.13") |
There was a problem hiding this comment.
For consistency either the match should be y == 13 or the directory should end in "_2.13+".
| }, | ||
| publishLocal := publishLocal.dependsOn(cleanSbtBridge).value, | ||
| altPublishSettings, | ||
| mimaSettings, |
There was a problem hiding this comment.
Please could you leave a comment in code explaining why this isn't MiMa-enforced?
| super.createInterpreter() | ||
|
|
||
| for ((id, value) <- bindNames zip bindValues) | ||
| intp.quietBind(NamedParam.clazz(id, value)) |
There was a problem hiding this comment.
Due to the regressions we had I'd rather we use
NamedParamClass(id, value.asInstanceOf[AnyRef].getClass.getName, value)rather than NamedParam.clazz.
There was a problem hiding this comment.
Could you link to the regressions?
FWIW, this file was copy-pasted straight from src/main/xsbt/ConsoleInterface.scala because ConsoleInterface.scala is now split into three Scala specific pieces. For the sake of keeping this PR simple, any changes to 2.12 I think should go into another PR.
There was a problem hiding this comment.
My mistake. What you have is the right implementation.
I was reading 1.x ConsoleInterface: https://github.com/sbt/zinc/blob/1.x/internal/compiler-bridge/src/main/scala/xsbt/ConsoleInterface.scala#L57
which doesn't include my fixes, that are in 1.0.x ConsoleInterface: https://github.com/sbt/zinc/blob/1.0.x/internal/compiler-bridge/src/main/scala/xsbt/ConsoleInterface.scala#L57
We should really merge 1.0.x into 1.x to avoid this confusion.
Anyways these are the relevant commits:
d2cdccb to
0a281a3
Compare
|
|
||
| // Compiler-side interface to compiler that is compiled against the compiler being used either in advance or on the fly. | ||
| // Includes API and Analyzer phases that extract source API and relationships. | ||
| /** |
jvican
left a comment
There was a problem hiding this comment.
It generally looks good. I've added several comments and I've only looked through the build changes because the PR has to be rebased on the open PRs that change the build and have been ready for review in a while: #428, #429. I'll have a closer look when they are.
Also, can you give a high-level explanation of these changes and why you make them? I don't understand some of the design decisions taken here. The PR message doesn't contain a descriptive explanation.
Otherwise, good job!
build.sbt
Outdated
| /** | ||
| * Tests for the compiler bridge. | ||
| * This is split into a separate subproject because testing introduces more dependencies, | ||
| * which is not always available. |
| } | ||
|
|
||
| object Compat { | ||
| // IR is renanmed to Results |
| ): Array[String] = | ||
| MakeSettings.sync(args, bootClasspathString, classpathString, log).recreateArgs.toArray[String] | ||
|
|
||
| def run( |
There was a problem hiding this comment.
I trust you've made sure that both consoles work!
There was a problem hiding this comment.
2.11-12 bridge is the same as what we had before. In any case, here's the log of console tasks on locally built sbt:
https://gist.github.com/eed3si9n/8b1b074e62093377ad4881154f29a20b
script/bridge213.sh
Outdated
|
|
||
| mkdir -p target/compiler-bridge/ | ||
|
|
||
| /usr/local/Cellar/scala@2.13/2.13.0-M2/bin/scalac \ |
There was a problem hiding this comment.
This path for sure doesn't work in my computer.
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
Why this script? It honestly looks a little bit ugly. Isn't is possible to do all this from within sbt?
My problems with this:
- No documentation why this is required
- Lots of assumptions about the underlying OS
- Too fragile, lots of assumptions about the bridge (what happens if I add a new file to the bridge? I have to update this script for 2.13 to work?)
I think this is not mergeable as it is...
There was a problem hiding this comment.
I added more context in the commit message 0fd57e5.
This shell script was only used as a way of confirming that the compiler bridge compiles without using sbt. This was needed because sbt 1.0.3 is unable to compile 2.13 code. To clarify, the script is not used as part of the build process to build Zinc. But in the future, if we need to bootstrap again, for 2.13.x changes etc the script might come in handy.
There was a problem hiding this comment.
Why don't you add it to the bin folder and document it saying that it shouldn't be used by normal people, only by you? Also, I'd appreciate if the script is OS cross-compatible.
0a281a3 to
c9e2176
Compare
Duhemm
left a comment
There was a problem hiding this comment.
I would personally prefer if we had stable names for the source directories, and avoided using names such as scala_2.13+. When work on 2.14 starts, we'll likely need to rename that directory to scala_2.13, which will make browsing the history harder for no good reason.
| def internalPath = file("internal") | ||
|
|
||
| lazy val compilerBridgeScalaVersions = List(scala212, scala211, scala210) | ||
| lazy val compilerBridgeScalaVersions = List(scala212, scala213, scala211, scala210) |
There was a problem hiding this comment.
Nitpick: Could we keep that in order? 😄
|
|
||
| lazy val compilerBridgeScalaVersions = List(scala212, scala211, scala210) | ||
| lazy val compilerBridgeScalaVersions = List(scala212, scala213, scala211, scala210) | ||
| lazy val compilerBridgeTestScalaVersions = List(scala212, scala211, scala210) |
There was a problem hiding this comment.
Some dependencies are not available for Scala 2.13.0-M2.
In retrospect, and given the recent tickets in https://github.com/scala/scala-dev/milestone/18 and the fact that 2.14 will be a compiler-focussed release, I agree with you - it's fairly likely we'd need to tweak our compiler bridge for 2.14. Good shout. 👍 |
Fixes sbt#395, sbt/sbt#3427 In scala/scala#5903 Scala compiler's REPL-related classes went through some changes, including move to a different package. This implements a new compiler bridge tracking the changes. To verify that the new bridge compiles under 2.13, we need to compile it using sbt 1.0.3, which in turn requires a bridge compatible with Scala 2.13.0-M2. To work around this chicken-egg, I've manually created a bridge and published it to Maven Central as "org.scala-sbt" % "compiler-bridge_2.13.0-M2" % "1.1.0-M1-bootstrap2".
Splitting compiler bridge tests to another subproject because while the bridge itself can be compiled with just compiler-interface, util-interface, and Scala Compiler as dependencies, the testing introduces more (such as IO). This creates problem for new Scala versions where IO or test libraries do not exist yet (e.g. Scala 2.13.0-M2). This also removes the Mima test due to the lack of 2.13 bridge for Zinc 1.0.0. Compiler bridge just needs to compile itself against the interface and Scala compiler, so there's no need to run Mima test.
c9e2176 to
91cb532
Compare
| @@ -0,0 +1,33 @@ | |||
| /* | |||
|
|
||
| # $ export SCALA_X_HOME=/usr/local/Cellar/scala@2.13/2.13.0-M2 | ||
|
|
||
| if [[ -z "$SCALA_X_HOME" ]]; then |
There was a problem hiding this comment.
@jvican Script is now moved to bin/. I added $SCALA_X_HOME so ppl can set it to whatever path they want for the development version of Scala.
| @@ -0,0 +1,43 @@ | |||
| #!/bin/bash | |||
|
|
|||
| # This is a hack to validate the compilation of 2.13 compiler bridge without using sbt, | |||
|
Let's merge this when the changes to the build I mentioned in my previous comments are, and this PR is then rebased. |
|
If a bug fix patch against 1.0.x is ready to go, I don't think pending PRs should block it. This particular bug fix has been going on for a really long time, and it's not a super high priority one, but as a general matter, we should be able to patch bugs at relatively short turnaround. That's the point of having 1.0.x branch. As per the build improvement PRs, I haven't paid too much attention to them since there's been review activities already, but if there are unresolved issues, let's discuss in weekly meeting. |
|
... Eugene, I disagree and I've commented on the PR why #428. There has been a lot of work into those PRs, and the fact that they haven't been reviewed in a long time and this PR now wants to override it is not nice. As I say in the other thread, that policy has been created by you and at any point has been discussed with me. On top of it, it's not consistent with the past -- we've merged not only bug fixes into 1.0.x. |
|
|
||
| abstract class Compat | ||
| object Compat { | ||
| // IR is renanmed to Results |
* 1.0.x: (28 commits) Split compiler bridge tests to another subproject Implement compiler bridge for 2.13.0-M2 Add yourkit acknoledgement in the README "sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0 Add header to cached hashing spec Add headers to missing files Fix sbt#332: Add sbt-header back to the build Update sbt-scalafmt to 1.12 Make classpath hashing more lightweight Fix sbt#442: Name hash of value class should include underlying type source-dependencies/value-class-underlying: fix test Ignore null in generic lambda tparams Improve and make scripted parallel Fix sbt#436: Remove annoying log4j scripted exception Fix sbt#127: Use `unexpanded` name instead of `name` Add pending test case for issue/127 source-dependencies / patMat-scope workaround Fixes undercompilation on inheritance on same source Add real reproduction case for sbt#417 Add trait-trait-212 for Scala 2.12.3 ... Conflicts: internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala project/build.properties zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala The ClassToAPI conflict is due to: * sbt#393 (a 1.x PR), conflicting with * sbt#446 (a 1.0.x PR). The build.properties conflict is due to different PRs bumping sbt.version from 1.0.0 to 1.0.2 to 1.0.3. (sbt#413, sbt#418, sbt#453). The MixedAnalyzingCompiler conflict is due to: * sbt#427 (a 1.x PR), conflicting with * sbt#452 (a 1.0.x PR).
| case sc if (sc startsWith "2.10.") => "compiler-bridge_2.10" | ||
| case sc if (sc startsWith "2.11.") => "compiler-bridge_2.11" | ||
| case sc if (sc startsWith "2.12.") => "compiler-bridge_2.12" | ||
| case sc if (sc startsWith "2.13.0-M") => "compiler-bridge_2.13.0-M2" |
There was a problem hiding this comment.
Should we add follows before this line?
case sc if (sc startsWith "2.13.0-M1") => "compiler-bridge_2.12"There was a problem hiding this comment.
I'll accept a PR, but I am sort of ok if it didn't work with old M1.
This is a rework of #445
Fixes #395, sbt/sbt#3427
To verify that the new bridge compiles, it needs to compile using sbt 1.0.3, which is unable to compile 2.13 code until this fix goes in. To work around this chicken-egg, I've manually created a bridge and published it to Maven Central as
"org.scala-sbt" % "compiler-bridge_2.13.0-M2" % "1.1.0-M1-bootstrap2".I kept the original commit from #445, but it didn't compile when I hooked it up with my bridge.
This also splits up the tests into a separate subproject since the test requires more dependencies than the actual bridge, which only relies on compiler|util-interface.
/cc @cunei