Skip to content

Conversation

@SethTisue
Copy link
Member

@SethTisue SethTisue commented Jan 10, 2018

wippity wip wip. let's get the ball rolling, at least

UPDATE: this is nearing completion.

@scala-jenkins scala-jenkins added this to the 2.13.0-M4 milestone Jan 10, 2018
@SethTisue SethTisue added the WIP label Jan 10, 2018
@SethTisue
Copy link
Member Author

SethTisue commented Jan 10, 2018

@dwijnand @eed3si9n Load is now in sbt.internal and is inaccessible, so the setup method in project/ScriptCommands.scala fails to compile with "not found: value Load". can you advise on how this method should now be defined...?

  private[this] def setup(name: String)(f: Seq[String] => Seq[Setting[_]]) = Command.args(name, name) { case (state, seq) =>
    // `Project.extract(state).append(f(seq) ++ resetLogLevels, state)` would be simpler, but it
    // takes the project's initial state and discards all changes that were made in the sbt console.
    val session = Project.session(state)
    val extracted = Project.extract(state)
    val settings = f(seq) ++ resetLogLevels
    val appendSettings = Load.transformSettings(Load.projectScope(extracted.currentRef), extracted.currentRef.build, extracted.rootProject, settings)
    val newStructure = Load.reapply(session.mergeSettings ++ appendSettings, extracted.structure)(extracted.showKey)
    Project.setProject(session, newStructure, state)
  }

@dwijnand
Copy link
Member

There is no migration path, outside of requesting an API be made public.

In this case I think what we should do is fix Extracted#append, or add another method. We can try and do that for sbt 1.1.1, both Martynas and Justin (of Jetbrains) have run into the same problem in the last 10 days.

@dwijnand
Copy link
Member

sbt/sbt#3865

@SethTisue
Copy link
Member Author

sbt 1.1.1 is out and includes sbt/sbt#3865

@dwijnand
Copy link
Member

dwijnand commented Feb 9, 2018

eh. I meant 1.1.1. we'll fix it when we squash later

@SethTisue SethTisue changed the title wip: upgrade build from sbt 0.13 -> 1.1 upgrade build from sbt 0.13 -> sbt 1 Feb 14, 2018
@SethTisue SethTisue removed the WIP label Feb 14, 2018
@SethTisue
Copy link
Member Author

SethTisue commented Feb 14, 2018

thanks Dale for taking this over! I've squashed/rebased and made you author of the resulting commit

Copy link
Member Author

@SethTisue SethTisue left a comment

Choose a reason for hiding this comment

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

LGTM, except possibly the removal of antStyle — team (@retronym?), I think I might recall that actually still being used sometimes...? if so, maybe we could give it a better name.

also Dale, you commented out -Xlint in project/plugins.sbt, would leaving it enabled present some special difficulty...?

@dwijnand
Copy link
Member

LGTM, except possibly the removal of antStyle — team (@retronym?), I think I might recall that actually still being used sometimes...? if so, maybe we could give it a better name.

antStyle was torn out of the incremental compiler, I'm not sure when (or what commit).

also Dale, you commented out -Xlint in project/plugins.sbt, would leaving it enabled present some special difficulty...?

it could stay but it would need to be tweaked, for instance make it not tell you about every import that sbt injects into build.sbt but that build doesn't use. stuff like that. I took the easy way out, but I can be more diligent if you'd like.

@SethTisue
Copy link
Member Author

-Xlint:-unused,_ makes it manageable.

@SethTisue SethTisue requested a review from retronym February 16, 2018 01:55
//
// https://github.com/scala/scala-dev/issues/100
def silenceScalaBinaryVersionWarning = ivyConfiguration := {
ivyConfiguration.value match {
Copy link
Member

Choose a reason for hiding this comment

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

The warnings we're trying to suppress are still emitted by SBT 1.1, so we'll have to figure out how to port this, or otherwise have a plan to make the warning suppressable in SBT itself.

sbt:root> test:compile
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-library;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scala-reflect;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-library;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-reflect;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scalap;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scala-compiler-interactive;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#repl;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[warn] Binary version (2.13.0-pre-SNAPSHOT) for dependency org.scala-lang#scala-compiler;2.13.0-pre-SNAPSHOT
[warn] 	in org.scala-lang#scala-compiler-doc;2.13.0-pre-SNAPSHOT differs from Scala binary version in project (2.13.0-M3).
[info] Running scala.tools.docutil.ManMaker fsc, scala, scalac, scaladoc, scalap /Users/jz/code/scala-sbt-1/target/scala-dist/resource_managed/main/doc/tools /Users/jz/code/scala-sbt-1/target/scala-dist/resource_managed/main/genman
[info] Compiling 526 Scala sources and 120 Java sources to /Users/jz/code/scala-sbt-1/build/quick/classes/library ...

@retronym
Copy link
Member

We can act on a new incremental compiler warning by deleting the file that contains only comments:

[warn] /Users/jz/code/scala-sbt-1/src/reflect/scala/reflect/io/IOStats.scala:1:1:
[warn] Found names but no class, trait or object is defined in the compilation unit.
[warn] The incremental compiler cannot record the dependency information in such case.
[warn] Some errors like unused import referring to a non-existent class might not be reported.
[warn]
[warn] package scala
[warn] ^

@SethTisue
Copy link
Member Author

I took care of removing IOStats.scala. @dwijnand can you help with the suppress-binary-warnings stuff? I remember the noise level on that being really high before Jason managed to suppress them

@retronym
Copy link
Member

retronym commented Feb 16, 2018

The performance of a clean build (in a well-warmed up JVM) has gone from 84s up to 101s.
Oops, my "before" test was running on my iMac through an SSH session, not my laptop!
BUT: performance on my laptop in 0.13 is about 87s, so there is a perf regression worth chasing down.
UPDATE 2: In a later session, SBT 1.x managed a 91s recompile. So there isn't obviously a problem here, run-to-run variation might be a big factor.

To measure, I use a cleanClasses task, defined in ~/.sbt/{1.0,0.13}/plugins/Clean.scala:

package io.github.retronym

import sbt._
import Keys._

object CleanClasses extends AutoPlugin {
  override def trigger = allRequirements
  override def requires = sbt.plugins.JvmPlugin
  val cleanClasses = taskKey[Unit]("clean the classes directory")
  
  override lazy val projectSettings = List(Compile, Test).flatMap(c => inConfig(c)(Seq(
    cleanClasses := IO.delete(classDirectory.value)
  )))

}

Then run the following repeatedly in both the 2.13.x branch (using SBT 0.13) and this PR:

sbt:root> ;cleanClasses;test:cleanClasses
...
sbt:root> test:compile
...
[success] Total time: 101 s, completed 16/02/2018 2:33:41 PM

Zinc uses a finer granularity for its metadata tracking now (class based vs file based), which might be relevant.

I previously benchmarked SBT 1.x as being about 8% slower than 0.13 for clean builds, the experience in the Scala build seems even worse than that.

/cc @jvican

@retronym
Copy link
Member

retronym commented Feb 16, 2018

I repeated the compilation/clean cycle a few times, the attached FlightRecorder to collect a profile.

During that time, this error was issued:

[info] Compiling 14 Scala sources and 1 Java source to /Users/jz/code/scala-sbt-1/build/quick/classes/partest-extras ...
[info] Done compiling.
[error] ## Exception when compiling 0 sources to /Users/jz/code/scala-sbt-1/target/partest-extras/test-classes
[error] Could not create directory /Users/jz/code/scala-sbt-1/target/scala-2.13.0-M3/classes.bak
[error] scala.sys.package$.error(package.scala:27)
[error] sbt.io.IO$.createDirectory(IO.scala:227)
[error] sbt.internal.inc.ClassFileManager$TransactionalClassFileManager.<init>(ClassFileManager.scala:73)
[error] sbt.internal.inc.ClassFileManager$.transactional(ClassFileManager.scala:67)
[error] sbt.internal.inc.ClassFileManager$.getDefaultClassFileManager(ClassFileManager.scala:32)
[error] sbt.internal.inc.ClassFileManager$.getClassFileManager(ClassFileManager.scala:39)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:128)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1429)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1403)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] sbt.std.Transform$$anon$4.work(System.scala:66)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] sbt.Execute.work(Execute.scala:271)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] java.lang.Thread.run(Thread.java:748)
[error]
[info] Compiling 161 Scala sources and 2 Java sources to /Users/jz/code/scala-sbt-1/target/junit/test-classes ...

IO.createDirectory discusses and attempts to work around a race condition in File.mkDirs. I wonder if java.nio.file.Files.createDirectories has the same problem?

Or maybe there are multiple TransactionalFileManager-s being created and they are stepping on each others toes in:

https://github.com/sbt/zinc/blob/127d6d3778bbad97e858b0d2132872e17530e172/internal/zinc-core/src/main/scala/sbt/internal/inc/ClassFileManager.scala#L72-L73

UPDATE

I actually got the same error on 0.13:

[warn] 14 warnings found
[trace] Stack trace suppressed: run last scalap/test:compileIncremental for the full output.
[error] (scalap/test:compileIncremental) Could not create directory /Users/jz/code/scala/target/scala-2.13.0-M3/classes.bak

UPDATE 2
Oh, I'll bet the problem is the fact we're setting baseDirectory in the submodules to the root project's baseDirectory. SBT creates the incremental compiler's cache relative to that directory. We probably instead should customize ForkOptions.workingDirectory.

scala/build.sbt

Lines 196 to 199 in 7dd6daf

// When we fork subprocesses, use the base directory as the working directory.
// This enables `sbt> partest test/files/run/t1.scala` or `sbt> scalac sandbox/test.scala`
baseDirectory in Compile := (baseDirectory in ThisBuild).value,
baseDirectory in Test := (baseDirectory in ThisBuild).value,

@smarter
Copy link
Member

smarter commented Feb 16, 2018

Back when it was first introduced, I noted that class-based dependency tracking introduced a big overhead for scalac : sbt/sbt#1104 (comment), this is probably still the case. At the time, this overhead didn't seem to affect dotty, I can't test dotty with sbt 1 right now but we'll probably be done with porting dotty to sbt 1 sometimes in the next century or two (current progress at scala/scala3#3872, but this has been ongoing for over a year). once this is done I'll try to run some comparison benchmarks too.

@smarter
Copy link
Member

smarter commented Feb 16, 2018

Oh, I'll bet the problem is the fact we're setting baseDirectory in the submodules to the root project's baseDirectory. SBT creates the incremental compiler's cache relative to that directory. We probably instead should customize ForkOptions.workingDirectory.

In dotty we do:

baseDirectory in (Compile, run) := baseDirectory.value / "..",
baseDirectory in Test := baseDirectory.value / ".."

and haven't run into problem yet (and I don't see anything suspicious in the root target directory)

@retronym
Copy link
Member

@dwijnand can you help with the suppress-binary-warnings stuff? I remember the noise level on that being really high before Jason managed to suppress them

Looks like we can suppress the check with scalaModuleInfo := scalaModuleInfo.value.withCheckExplicit(false) configured at the right places.

@retronym
Copy link
Member

consoleProject appears to have an incompatibility with Scala 2.13. Not a deal breaker, but we need to get it fixed as it will end up affecting end users.

sbt:root> consoleProject
[info] Non-compiled module 'compiler-bridge_2.13.0-M2' for Scala 2.12.4. Compiling...
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/Compat.scala:13: error: object shell is not a member of package scala.tools.nsc.interpreter
import scala.tools.nsc.interpreter.shell.ReplReporterImpl
                                   ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/Compat.scala:22: error: not found: type ReplReporterImpl
    new ReplReporterImpl(settings, writer)
        ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:12: error: object shell is not a member of package scala.tools.nsc.interpreter
import scala.tools.nsc.interpreter.shell.{ ILoop, ShellConfig, ReplReporterImpl }
                                   ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:42: error: not found: type ILoop
    val loop = new ILoop(ShellConfig(interpreterSettings)) {
                   ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:45: error: not found: type ReplReporterImpl
          val reporter = new ReplReporterImpl(interpreterSettings)
                             ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:46: error: not found: value intp
          intp = new IMain(interpreterSettings, reporter) {
          ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:51: error: not found: value intp
          intp.setContextClassLoader()
          ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:53: error: value createInterpreter is not a member of AnyRef
          super.createInterpreter(interpreterSettings)
                ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:56: error: not found: value intp
          intp.beQuietDuring(intp.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value))
          ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:56: error: not found: value intp
          intp.beQuietDuring(intp.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value))
                             ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:59: error: not found: value intp
          intp.interpret(initialCommands)
          ^
/var/folders/tz/p8vd07wn7wxck3b9v54grlzw0000gp/T/sbt_d61bd5d9/xsbt/ConsoleInterface.scala:66: error: not found: value intp
          intp.interpret(cleanupCommands)
          ^
12 errors found
[info] Attempting to fetch org.scala-sbt:compiler-bridge_2.13.0-M2:1.1.1.
[error] (run-main-2) Error compiling the sbt component 'compiler-bridge_2.13.0-M2'
[error] Error compiling the sbt component 'compiler-bridge_2.13.0-M2'
[error] 	at sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:331)
[error] 	at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4(AnalyzingCompiler.scala:346)
[error] 	at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4$adapted(AnalyzingCompiler.scala:341)
[error] 	at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] 	at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)

@retronym
Copy link
Member

I profiled the warm, clean compile.

I noticed something unusual with busy-waiting from a LMAX disruptor thread involved in async logging, details in sbt/util#68

The new logging implementation also seems to spend an inordinate amount of time in Scala reflection to evaluate type tags to add to log messages, I've raised https://github.com/sbt/util/issues/151 with an initial diagnosis.

Of time taken to compile, the profile suggests around 40% is spent in Zinc's API phase.

image

@adriaanm
Copy link
Contributor

Rebased.

@adriaanm
Copy link
Contributor

Hmm, while running under -Dstarr.version=2.13.0-local-ae43506d, running into some weird issues. We're on sbt 1.2.3, but the bridge is 1.2.2, and binary version 2.13 (closest published artifact is at https://mvnrepository.com/artifact/org.scala-sbt/compiler-bridge_2.13.0-M2/1.2.2)

[info] Attempting to fetch org.scala-sbt:compiler-bridge_2.13:1.2.2.
[warn] 	module not found: org.scala-sbt#compiler-bridge_2.13;1.2.2
[warn] ==== local: tried
[warn]   /Users/adriaan/.ivy2/local/org.scala-sbt/compiler-bridge_2.13/1.2.2/ivys/ivy.xml
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/scala-sbt/compiler-bridge_2.13/1.2.2/compiler-bridge_2.13-1.2.2.pom
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/adriaan/.sbt/preloaded/org.scala-sbt/compiler-bridge_2.13/1.2.2/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/adriaan/.sbt/preloaded/org/scala-sbt/compiler-bridge_2.13/1.2.2/compiler-bridge_2.13-1.2.2.pom
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.scala-sbt#compiler-bridge_2.13;1.2.2: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[error] ## Exception when compiling 524 sources to /Users/adriaan/git/scala/build/quick/classes/library
[error] The compiler bridge sources org.scala-sbt:compiler-bridge_2.13:1.2.2:compile could not be retrieved.
[error] 

@eed3si9n
Copy link
Member

@retronym
Copy link
Member

retronym commented Sep 25, 2018

The artifact name 2.13.0-local-ae43506d is the problem.

From internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala:

  private[sbt] def getDefaultBridgeModule(scalaVersion: String): ModuleID = {
    def compilerBridgeId(scalaVersion: String) = {
      scalaVersion match {
        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 "2.13.0-M1"                         => "compiler-bridge_2.12"
        case sc if (sc startsWith "2.13.0-pre-") => "compiler-bridge_2.13.0-M2"
        case sc if (sc startsWith "2.13.0-M")    => "compiler-bridge_2.13.0-M2"
        case sc if (sc startsWith "2.13.0-RC")   => "compiler-bridge_2.13.0-M2"
        case _                                   => "compiler-bridge_2.13"
      }
    }

sbt setupPublishCore publishLocal would instead generate a version number starting with 2.13.0-pre-, which should use the compiler bridge sources published under 2.13.0-M2.

@adriaanm
Copy link
Contributor

adriaanm commented Sep 26, 2018

Thanks, that fixed it. My local.sbt now has:

// skip docs for local publishing
publishArtifact in (Compile, packageDoc) in ThisBuild := false

// set version based on current sha, so that you can easily consume this build from another sbt project
baseVersionSuffix := {
  val sha = scala.sys.process.Process("git rev-parse --short HEAD").!!.take(7)
  if (scalaVersion.value.startsWith("2.13")) s"pre-$sha-local"
  else s"bin-$sha-local"
}

@adriaanm
Copy link
Contributor

I'll redo the stability check on the current build and sbt 1.2.3. If I don't get any discrepancies, I assume this PR is ready to go?

@adriaanm
Copy link
Contributor

adriaanm commented Sep 26, 2018

Looks like we're good re: stability. Transcript of my due diligence:

g commit -a --allow-empty -m"opt stability test sbt" ; sbt clean enableOptimizer publishLocal ; 
g commit -a --allow-empty -m"opt stability test 2" ; sbt clean enableOptimizer publishLocal

g log

commit 815d29e (HEAD -> 2.13.x)
Author: Adriaan Moors <[email protected]>
Date:   5 minutes ago

    opt stability test 2

commit eb3e081
Author: Adriaan Moors <[email protected]>
Date:   10 minutes ago

    opt stability test

commit 2e82444 (scala/2.13.x)
cd /tmp/jd

for j in /Users/adriaan/.ivy2/local/org.scala-lang/scala-library/2.13.0-pre-eb3e081-local/jars/scala-library.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-reflect/2.13.0-pre-eb3e081-local/jars/scala-reflect.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-compiler/2.13.0-pre-eb3e081-local/jars/scala-compiler.jar; do unzip -o $j ; done

g init .
g add -A .
g commit -m"eb3e081"

for j in /Users/adriaan/.ivy2/local/org.scala-lang/scala-library/2.13.0-pre-815d29e-local/jars/scala-library.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-reflect/2.13.0-pre-815d29e-local/jars/scala-reflect.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-compiler/2.13.0-pre-815d29e-local/jars/scala-compiler.jar; do unzip -o $j ; done

g commit -a -m"815d29e"
g commit -a --allow-empty -m"opt stability test sbt 1" ; sbt clean enableOptimizer publishLocal
g commit -a --allow-empty -m"opt stability test sbt 1 / 2" ; sbt clean enableOptimizer publishLocal
commit a223519 (HEAD -> 2.13.x)
Author: Adriaan Moors <[email protected]>
Date:   40 minutes ago

    opt stability test sbt 1 / 2

commit 49bb883
Author: Adriaan Moors <[email protected]>
Date:   49 minutes ago

    opt stability test sbt 1

commit 55ea497
Merge: 815d29e 21439bf
Author: Adriaan Moors <[email protected]>
Date:   49 minutes ago

    Merge remote-tracking branch 'SethTisue/sbt-1' into 2.13.x
cd /tmp/jd

for j in /Users/adriaan/.ivy2/local/org.scala-lang/scala-library/2.13.0-pre-49bb883-local/jars/scala-library.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-reflect/2.13.0-pre-49bb883-local/jars/scala-reflect.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-compiler/2.13.0-pre-49bb883-local/jars/scala-compiler.jar; do unzip -o $j ; done

g commit -a -m"49bb883"

for j in /Users/adriaan/.ivy2/local/org.scala-lang/scala-library/2.13.0-pre-a223519-local/jars/scala-library.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-reflect/2.13.0-pre-a223519-local/jars/scala-reflect.jar /Users/adriaan/.ivy2/local/org.scala-lang/scala-compiler/2.13.0-pre-a223519-local/jars/scala-compiler.jar; do unzip -o $j ; done

g commit -a -m"a223519"
g log --stat

commit 2415fb0 (HEAD -> master)
Author: Adriaan Moors <[email protected]>
Date:   11 seconds ago

    a223519:

 META-INF/MANIFEST.MF            | 188 ++++++++++++++++++++--------------------
 compiler.properties             |   8 +-
 interactive.properties          |   8 +-
 library.properties              |   8 +-
 reflect.properties              |   8 +-
 repl-frontend.properties        |   8 +-
 repl.properties                 |   8 +-
 scala-buildcharacter.properties |  10 +--
 scaladoc.properties             |   8 +-
 9 files changed, 127 insertions(+), 127 deletions(-)

commit ef46483
Author: Adriaan Moors <[email protected]>
Date:   62 seconds ago

    49bb883

 META-INF/MANIFEST.MF            | 188 ++++++++++++++++++++--------------------
 compiler.properties             |   8 +-
 interactive.properties          |   8 +-
 library.properties              |   8 +-
 reflect.properties              |   8 +-
 repl-frontend.properties        |   8 +-
 repl.properties                 |   8 +-
 scala-buildcharacter.properties |  10 +--
 scaladoc.properties             |   8 +-
 9 files changed, 127 insertions(+), 127 deletions(-)

commit bb783a5
Author: Adriaan Moors <[email protected]>
Date:   47 minutes ago

    815d29e

 META-INF/MANIFEST.MF            | 188 ++++++++++++++++++++--------------------
 compiler.properties             |   8 +-
 interactive.properties          |   8 +-
 library.properties              |   8 +-
 reflect.properties              |   8 +-
 repl-frontend.properties        |   8 +-
 repl.properties                 |   8 +-
 scala-buildcharacter.properties |  10 +--
 scaladoc.properties             |   8 +-
 9 files changed, 127 insertions(+), 127 deletions(-)

commit 659ff5a
Author: Adriaan Moors <[email protected]>
Date:   54 minutes ago

    eb3e081

 6518 files changed, 5118 insertions(+)

@adriaanm
Copy link
Contributor

Rebased

SethTisue and others added 3 commits September 26, 2018 14:56
1. Adapt to renaming of ivyScala

2. Be less intrusive with customization of baseDirectory

In our attempt to make forked project take on the working directory
of the root project, rather than of their module, we ended up
causing a clash in the directory used by the incremental compiler
to backup classfiles, which uses a value relative to that base.

The symptom was an intermitten error such as:

```
[error] ## Exception when compiling 0 sources to /Users/jz/code/scala-sbt-1/target/partest-extras/test-classes
[error] Could not create directory /Users/jz/code/scala-sbt-1/target/scala-2.13.0-M3/classes.bak
```

This commit adjusts ForkOptions instead to more directly
achieve our goal.

3. Heed deprecation warning in ScalaInstance tweak

4. Disable finding sources files in project base

Something has changed in SBT 1.x, and our attempt to clear the
sources for scalacheck/compile: weren't successful:

```
sbt:root> show scalacheck / Compile / unmanagedSources
[info] * /Users/jz/code/scala/test/scalacheck/array-new.scala
[info] * /Users/jz/code/scala/test/scalacheck/array-old.scala
[info] * /Users/jz/code/scala/test/scalacheck/CheckCollections.scala
[info] * /Users/jz/code/scala/test/scalacheck/CheckEither.scala
```

What changed? 4502348, earlier in this PR, removed our override
of `baseDirectory`. So sub-projects now have their own sub-directory
as the base (which is the standard SBT behaviour). If these include
source files directly, as is the case with `./test/scalacheck`, these
would be included by virtue of the long standing SBT behaviour to
let you skip the hassle of source directories for toy projects.

This commit disables that behaviour with `sourcesInBase := false`

5. Fixup OSGi test suite after baseDirectory change

6. Let SBT add api.url to the POM

Since sbt/sbt#2262, we don't need to do this.
And attempting to do it results in duplicate properties in the POM file,
which doesn't pass POM validation by artifactory.

7. Use the recommended, and working, `sbt -warn`

In favour of `--warn`, which is broken in SBT 1.x.

Early commands are ones that are run before project load, in this case,
`-warn` used to mean `-` (schedule early) and `warn` (the command to
change log level)`.

`sbt-extras` translates its `-w` option into `--warn`, or passes through
`--warn` if provided. The official SBT launcher passes through `--warn`.

`sbt -warn` still works in 1.x, but `sbt --warn` doesn't give the non-zero
error code after a failure.

```
for sbt in 0.13.17 1.1.4; do for opt in "--warn" "-warn"; do (set -x; java -jar /home/jenkins/.sbt/launchers/0.13.17/sbt-launch.jar -Dsbt.version=$sbt $opt 'eval ???'; echo $?;) done; done
+ java -jar /home/jenkins/.sbt/launchers/0.13.17/sbt-launch.jar -Dsbt.version=0.13.17 --warn 'eval ???'
scala.NotImplementedError: an implementation is missing
    at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252)
...
[error] scala.NotImplementedError: an implementation is missing
[error] Use 'last' for the full log.
+ echo 1
1
+ java -jar /home/jenkins/.sbt/launchers/0.13.17/sbt-launch.jar -Dsbt.version=0.13.17 -warn 'eval ???'
scala.NotImplementedError: an implementation is missing
    at scala.Predef$.$qmark$qmark$qmark(Predef.scala:252)
...
[error] scala.NotImplementedError: an implementation is missing
[error] Use 'last' for the full log.
+ echo 1
1
+ java -jar /home/jenkins/.sbt/launchers/0.13.17/sbt-launch.jar -Dsbt.version=1.1.4 --warn 'eval ???'
[warn] sbt version mismatch, current: 1.1.4, in build.properties: "0.13.17", use 'reboot' to use the new value.
[info] Loading project definition from /tmp/scratch/project
[info] Updating ProjectRef(uri("file:/tmp/scratch/project/"), "scratch-build")...
[info] Done updating.
[info] Set current project to scratch (in build file:/tmp/scratch/)
[warn] The `-` command is deprecated in favor of `onFailure` and will be removed in a later version
[error] scala.NotImplementedError: an implementation is missing
[error]     at scala.Predef$.$qmark$qmark$qmark(Predef.scala:284)
..
[error] scala.NotImplementedError: an implementation is missing
[error] Use 'last' for the full log.
+ echo 0
0
+ java -jar /home/jenkins/.sbt/launchers/0.13.17/sbt-launch.jar -Dsbt.version=1.1.4 -warn 'eval ???'
+ echo 1
1
```

This commits changes our scripts to use the recommended `-warn`. However,
I'd say that SBT 1.x should either reject `--warn` outright or be compatible
with the old behaviour.
@adriaanm
Copy link
Contributor

Rebased once more, with date ordering for github and more squashiness.

@SethTisue
Copy link
Member Author

discussed at team meeting today — nobody had objections to merging this as soon as CI is green.

@adriaanm

This comment has been minimized.

@adriaanm

This comment has been minimized.

@eed3si9n
Copy link
Member

Looks green to me.

@SethTisue SethTisue merged commit 8008069 into scala:2.13.x Sep 26, 2018
@SethTisue SethTisue deleted the sbt-1 branch September 26, 2018 16:48
@SethTisue
Copy link
Member Author

ahhhhhhhhhh that makes my day.

trait ScalaOsgiHelper {

private def allBundleFiles = {
println(new File(".").getAbsolutePath)
Copy link
Member

Choose a reason for hiding this comment

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

You may want to remove this 😄

@@ -0,0 +1 @@
sbt.version=1.1.4
Copy link
Member Author

Choose a reason for hiding this comment

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

nbd, but we should bump this one to 1.2.3 too

@xuwei-k
Copy link
Contributor

xuwei-k commented Sep 27, 2018

#7274

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.

9 participants