Skip to content

Upgrade to sbt 1.3.6, release sbt-dotty 0.4.0 #7953

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

Merged
merged 11 commits into from
Jan 16, 2020
20 changes: 10 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ steps:

- name: test
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on: [ clone ]
commands:
- cp -R . /tmp/1/ && cd /tmp/1/
Expand All @@ -36,16 +36,16 @@ steps:

- name: test_bootstrapped
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on: [ clone ]
commands:
- cp -R . /tmp/2/ && cd /tmp/2/
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test ;dotty-staging/test ;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test"
- ./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test ;dotty-staging/test ;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test ;configureIDE"
- ./project/scripts/bootstrapCmdTests

- name: community_build
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on: [ clone ]
commands:
- cp -R . /tmp/3/ && cd /tmp/3/
Expand All @@ -55,7 +55,7 @@ steps:

- name: test_sbt
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on: [ clone ]
commands:
- cp -R . /tmp/4/ && cd /tmp/4/
Expand All @@ -67,7 +67,7 @@ steps:

- name: test_java11
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on: [ clone ]
commands:
- export PATH="/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH"
Expand All @@ -80,7 +80,7 @@ steps:

- name: documentation
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on:
- test
- test_bootstrapped
Expand All @@ -99,7 +99,7 @@ steps:

- name: publish_nightly
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on:
- test
- test_bootstrapped
Expand All @@ -126,7 +126,7 @@ steps:

- name: publish_release
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on:
- test
- test_bootstrapped
Expand Down Expand Up @@ -169,7 +169,7 @@ steps:

- name: publish_sbt_release
pull: default
image: lampepfl/dotty:2019-10-17
image: lampepfl/dotty:2020-01-09
depends_on:
- test
- test_bootstrapped
Expand Down
2 changes: 1 addition & 1 deletion community-build/community-projects/scalap
Submodule scalap updated 1 files
+0 −1 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/stdLib213
Submodule stdLib213 updated 2361 files
1 change: 0 additions & 1 deletion community-build/project/build.properties

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ final case class SbtCommunityProject(project: String, sbtTestCommand: String,
case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome")
case _ => Nil
extraSbtArgs ++ sbtProps ++ List(
"-sbt-version", "1.2.7",
"-sbt-version", "1.3.6",
s"--addPluginSbtFile=$sbtPluginFilePath")

object projects
Expand Down
43 changes: 25 additions & 18 deletions compiler/test/dotty/tools/dotc/CompilationTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.junit.Assert._
import org.junit.Assume._
import org.junit.experimental.categories.Category

import java.io.File
import java.nio.file._
import java.util.stream.{ Stream => JStream }
import scala.collection.JavaConverters._
Expand Down Expand Up @@ -197,45 +198,50 @@ class CompilationTests extends ParallelTesting {
*/
@Test def tastyBootstrap: Unit = {
implicit val testGroup: TestGroup = TestGroup("tastyBootstrap/tests")
val libGroup = TestGroup("tastyBootstrap/lib")
val tastyCoreGroup = TestGroup("tastyBootstrap/tastyCore")
val dotty1Group = TestGroup("tastyBootstrap/dotty1")
val dotty2Group = TestGroup("tastyBootstrap/dotty2")
val libGroup = TestGroup("tastyBootstrap/lib")

// Make sure that the directory is clean
dotty.tools.io.Directory(defaultOutputDir + "tastyBootstrap").deleteRecursively()

val sep = java.io.File.pathSeparator

val opt = TestFlags(
// compile with bootstrapped library on cp:
defaultOutputDir + libGroup + "/src/" + sep +
// as well as bootstrapped compiler:
defaultOutputDir + dotty1Group + "/dotty/" + sep +
// and the other compiler dependenies:
Properties.compilerInterface + sep + Properties.scalaLibrary + sep + Properties.scalaAsm + sep +
Properties.dottyInterfaces + sep + Properties.tastyCore + sep + Properties.jlineTerminal + sep +
Properties.jlineReader,
List(
// compile with bootstrapped library on cp:
defaultOutputDir + libGroup + "/lib/",
// and bootstrapped tasty-core:
defaultOutputDir + tastyCoreGroup + "/tastyCore/",
// as well as bootstrapped compiler:
defaultOutputDir + dotty1Group + "/dotty1/",
// and the other compiler dependencies:
Properties.compilerInterface, Properties.scalaLibrary, Properties.scalaAsm,
Properties.dottyInterfaces, Properties.jlineTerminal, Properties.jlineReader,
).mkString(File.pathSeparator),
Array("-Ycheck-reentrant", "-Yemit-tasty-in-class")
)

val libraryDirs = List(Paths.get("library/src"), Paths.get("library/src-bootstrapped"))
val librarySources = libraryDirs.flatMap(sources(_))

val lib =
compileList("src", librarySources,
compileList("lib", librarySources,
defaultOptions.and("-Ycheck-reentrant",
"-Yerased-terms", // support declaration of scala.compiletime.erasedValue
// "-strict", // TODO: re-enable once we allow : @unchecked in pattern definitions. Right now, lots of narrowing pattern definitions fail.
"-priorityclasspath", defaultOutputDir))(libGroup)

val tastyCoreSources = sources(Paths.get("tasty/src"))
val tastyCore = compileList("tastyCore", tastyCoreSources, opt)(tastyCoreGroup)

val compilerSources = sources(Paths.get("compiler/src"))
val compilerManagedSources = sources(Properties.dottyCompilerManagedSources)

val dotty1 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
val dotty2 = compileList("dotty", compilerSources ++ compilerManagedSources, opt)(dotty2Group)
val dotty1 = compileList("dotty1", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
val dotty2 = compileList("dotty2", compilerSources ++ compilerManagedSources, opt)(dotty2Group)

val tests = {
lib.keepOutput :: dotty1.keepOutput :: aggregateTests(
lib.keepOutput :: tastyCore.keepOutput :: dotty1.keepOutput :: aggregateTests(
dotty2,
compileShallowFilesInDir("compiler/src/dotty/tools", opt),
compileShallowFilesInDir("compiler/src/dotty/tools/dotc", opt),
Expand All @@ -255,9 +261,10 @@ class CompilationTests extends ParallelTesting {
}.map(_.checkCompile())

def assertExists(path: String) = assertTrue(Files.exists(Paths.get(path)))
assertExists(s"out/$dotty1Group/dotty/")
assertExists(s"out/$dotty2Group/dotty/")
assertExists(s"out/$libGroup/src/")
assertExists(s"out/$libGroup/lib/")
assertExists(s"out/$tastyCoreGroup/tastyCore/")
assertExists(s"out/$dotty1Group/dotty1/")
assertExists(s"out/$dotty2Group/dotty2/")
compileList("idempotency", List("tests/idempotency/BootstrapChecker.scala", "tests/idempotency/IdempotencyCheck.scala"), defaultOptions).checkRuns()

tests.foreach(_.delete())
Expand Down
28 changes: 18 additions & 10 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ object MyScalaJSPlugin extends AutoPlugin {

// Typecheck the Scala.js IR found on the classpath
scalaJSLinkerConfig ~= (_.withCheckIR(true)),

// Exclude all these projects from `configureIDE/launchIDE` since they
// take time to compile, print a bunch of warnings, and are rarely edited.
excludeFromIDE := true
)
}

object Build {
val referenceVersion = "0.21.0-RC1"
val referenceVersion = "0.22.0-bin-20200114-193f7de-NIGHTLY"

val baseVersion = "0.22.0"
val baseSbtDottyVersion = "0.3.5"
val baseSbtDottyVersion = "0.4.0"

// Versions used by the vscode extension to create a new project
// This should be the latest published releases.
Expand Down Expand Up @@ -192,6 +196,11 @@ object Build {
state
},

// Turn off the sbt supershell because it can mangle the output of some tasks
// (see https://github.com/sbt/sbt/issues/5122, https://github.com/sbt/sbt/issues/5352)
// and in general I find it more distracting than helpful anyway.
useSuperShell := false,

// Credentials to release to Sonatype
credentials ++= (
for {
Expand Down Expand Up @@ -730,16 +739,18 @@ object Build {
case Bootstrapped => `dotty-compiler-bootstrapped`
}

// Settings shared between dotty-library and dotty-library-bootstrapped
// Settings shared between dotty-library, dotty-library-bootstrapped and dotty-library-bootstrappedJS
lazy val dottyLibrarySettings = Seq(
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
scalacOptions in Compile ++= Seq("-sourcepath", (sourceDirectories in Compile).value.map(_.getAbsolutePath).distinct.mkString(File.pathSeparator)),
scalacOptions in Compile ++= Seq(
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
"-sourcepath", (sourceDirectories in Compile).value.map(_.getAbsolutePath).distinct.mkString(File.pathSeparator),
// support declaration of scala.compiletime.erasedValue
"-Yerased-terms"
),
)

lazy val `dotty-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)
lazy val `dotty-library-bootstrapped`: Project = project.in(file("library")).asDottyLibrary(Bootstrapped)
// TODO: move -Yerased-terms to dottyLibrarySettings on reference compiler update
.settings(scalacOptions in Compile += "-Yerased-terms") // support declaration of scala.compiletime.erasedValue

def dottyLibrary(implicit mode: Mode): Project = mode match {
case NonBootstrapped => `dotty-library`
Expand All @@ -761,7 +772,6 @@ object Build {
settings(
unmanagedSourceDirectories in Compile :=
(unmanagedSourceDirectories in (`dotty-library-bootstrapped`, Compile)).value,
scalacOptions += "-Yerased-terms", // support declaration of scala.compiletime.erasedValue
)

lazy val tastyCoreSettings = Seq(
Expand Down Expand Up @@ -1109,8 +1119,6 @@ object Build {
version := "0.1.17-snapshot", // Keep in sync with package.json
autoScalaLibrary := false,
publishArtifact := false,
includeFilter in unmanagedSources := NothingFilter | "*.ts" | "**.json",
watchSources in Global ++= (unmanagedSources in Compile).value,
resourceGenerators in Compile += Def.task {
// Resources that will be copied when bootstrapping a new project
val buildSbtFile = baseDirectory.value / "out" / "build.sbt"
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.2.7
sbt.version=1.3.6
5 changes: 5 additions & 0 deletions sbt-dotty/sbt-test/sbt-dotty/i7897/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scalaVersion := sys.props("plugin.scalaVersion")

libraryDependencies += "ch.epfl.lamp" %% "dotty-staging" % scalaVersion.value

fork := true
5 changes: 5 additions & 0 deletions sbt-dotty/sbt-test/sbt-dotty/i7897/changes/build-no-fork.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
scalaVersion := sys.props("plugin.scalaVersion")

libraryDependencies += "ch.epfl.lamp" %% "dotty-staging" % scalaVersion.value

fork := false
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import scala.quoted._, staging._

given Toolbox = Toolbox.make(getClass.getClassLoader)

val f: Array[Int] => Int = run {
val stagedSum: Expr[Array[Int] => Int] = '{ (arr: Array[Int]) => 6 }
println(stagedSum.show)
stagedSum
}

object Main {
def main(args: Array[String]): Unit =
f.apply(Array(1, 2, 3)) // Returns 6
}
4 changes: 4 additions & 0 deletions sbt-dotty/sbt-test/sbt-dotty/i7897/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> run
$ copy-file changes/build-no-fork.sbt build.sbt
> reload
> run

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading