From 6688d4725bed9043e6ed37311945ab55817efb19 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 8 Nov 2019 14:20:45 +0100 Subject: [PATCH 1/5] Add utest submodule to community projects --- .gitmodules | 3 +++ community-build/community-projects/utest | 1 + 2 files changed, 4 insertions(+) create mode 160000 community-build/community-projects/utest diff --git a/.gitmodules b/.gitmodules index 2d6b98c97962..4982e6d0ba8a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -56,3 +56,6 @@ [submodule "community-build/community-projects/intent"] path = community-build/community-projects/intent url = https://github.com/dotty-staging/intent +[submodule "community-build/community-projects/utest"] + path = community-build/community-projects/utest + url = https://github.com/dotty-staging/utest.git diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest new file mode 160000 index 000000000000..aad562689a24 --- /dev/null +++ b/community-build/community-projects/utest @@ -0,0 +1 @@ +Subproject commit aad562689a24b02999ef3df2107975df042f173d From 63cddfb81c9bd48818c7c521e91f56c9adeceae9 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 8 Nov 2019 14:21:35 +0100 Subject: [PATCH 2/5] Abstract SBT-specific logic from community build tests --- .../communitybuild/CommunityBuildTest.scala | 95 ++++++++++--------- 1 file changed, 51 insertions(+), 44 deletions(-) diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 8ea077a8603f..6ad888562b53 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -16,6 +16,32 @@ class CommunityBuildTest { new String(Files.readAllBytes(file), UTF_8) } + def testSbt(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String] = Nil) = { + // Workaround for https://github.com/sbt/sbt/issues/4395 + new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs() + val pluginFilePath = communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString() + + // Run the sbt command with the compiler version and sbt plugin set in the build + val arguments = { + val sbtProps = Option(System.getProperty("sbt.ivy.home")) match { + case Some(ivyHome) => + Seq(s"-Dsbt.ivy.home=$ivyHome") + case _ => + Seq() + } + extraSbtArgs ++ sbtProps ++ Seq( + "-sbt-version", "1.2.7", + s"--addPluginSbtFile=$pluginFilePath", + s";clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! $testCommand" + ) + } + + test(project, "sbt", arguments) + } + + def testMill(project: String, testCommand: String, extraMillArgs: Seq[String] = Nil) = + test(project, "./mill", extraMillArgs :+ testCommand) + /** Build the given project with the published local compiler and sbt plugin. * * This test reads the compiler version from community-build/dotty-bootstrapped.version @@ -26,7 +52,7 @@ class CommunityBuildTest { * @param updateCommand The sbt command used to update the project * @param extraSbtArgs Extra arguments to pass to sbt */ - def test(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String] = Nil): Unit = { + def test(project: String, command: String, arguments: Seq[String]): Unit = { def log(msg: String) = println(Console.GREEN + msg + Console.RESET) log(s"Building $project with dotty-bootstrapped $compilerVersion...") @@ -53,37 +79,18 @@ class CommunityBuildTest { exitCode } - // Workaround for https://github.com/sbt/sbt/issues/4395 - new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs() - val pluginFilePath = communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString() - - // Run the sbt command with the compiler version and sbt plugin set in the build - val arguments = { - val sbtProps = Option(System.getProperty("sbt.ivy.home")) match { - case Some(ivyHome) => - Seq(s"-Dsbt.ivy.home=$ivyHome") - case _ => - Seq() - } - extraSbtArgs ++ sbtProps ++ Seq( - "-sbt-version", "1.2.7", - s"--addPluginSbtFile=$pluginFilePath", - s";clean ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! $testCommand" - ) - } - - val exitCode = exec("sbt", arguments: _*) + val exitCode = exec(command, arguments: _*) if (exitCode != 0) { fail(s""" | - |sbt exited with an error code. To reproduce without JUnit, use: + |$command exited with an error code. To reproduce without JUnit, use: | | sbt community-build/prepareCommunityBuild | cd community-build/community-projects/$project - | sbt ${arguments.init.mkString(" ")} "${arguments.last}" + | $command ${arguments.init.mkString(" ")} "${arguments.last}" | - |For a faster feedback loop, one can try to extract a direct call to dotc + |For a faster feedback loop on SBT projects, one can try to extract a direct call to dotc |using the sbt export command. For instance, for scalacheck, use | sbt export jvm/test:compileIncremental | @@ -91,111 +98,111 @@ class CommunityBuildTest { } } - @Test def intent = test( + @Test def intent = testSbt( project = "intent", testCommand = "test", updateCommand = "update" ) - @Test def algebra = test( + @Test def algebra = testSbt( project = "algebra", testCommand = "coreJVM/compile", updateCommand = "coreJVM/update" ) - @Test def scalacheck = test( + @Test def scalacheck = testSbt( project = "scalacheck", testCommand = "jvm/test:compile", updateCommand = "jvm/test:update" ) - @Test def scalatest = test( + @Test def scalatest = testSbt( project = "scalatest", testCommand = ";scalacticDotty/clean;scalacticTestDotty/test;scalatestTestDotty/test", updateCommand = "scalatest/update" ) - @Test def scalaXml = test( + @Test def scalaXml = testSbt( project = "scala-xml", testCommand = "xml/test", updateCommand = "xml/update" ) - @Test def scopt = test( + @Test def scopt = testSbt( project = "scopt", testCommand = "scoptJVM/compile", updateCommand = "scoptJVM/update" ) - @Test def scalap = test( + @Test def scalap = testSbt( project = "scalap", testCommand = "scalap/compile", updateCommand = "scalap/update" ) - @Test def squants = test( + @Test def squants = testSbt( project = "squants", testCommand = "squantsJVM/compile", updateCommand = "squantsJVM/update" ) - @Test def betterfiles = test( + @Test def betterfiles = testSbt( project = "betterfiles", testCommand = "dotty-community-build/compile", updateCommand = "dotty-community-build/update" ) - @Test def ScalaPB = test( + @Test def ScalaPB = testSbt( project = "ScalaPB", testCommand = "dotty-community-build/compile", updateCommand = "dotty-community-build/update" ) - @Test def minitest = test( + @Test def minitest = testSbt( project = "minitest", testCommand = "dotty-community-build/compile", updateCommand = "dotty-community-build/update" ) - @Test def fastparse = test( + @Test def fastparse = testSbt( project = "fastparse", testCommand = "dotty-community-build/compile;dotty-community-build/test:compile", updateCommand = "dotty-community-build/update" ) // TODO: revert to sourcecodeJVM/test - @Test def sourcecode = test( + @Test def sourcecode = testSbt( project = "sourcecode", testCommand = "sourcecode/compile;sourcecode/test:compile", updateCommand = "sourcecode/update" ) - @Test def stdLib213 = test( + @Test def stdLib213 = testSbt( project = "stdLib213", testCommand = "library/compile", updateCommand = "library/update", extraSbtArgs = Seq("-Dscala.build.compileWithDotty=true") ) - @Test def shapeless = test( + @Test def shapeless = testSbt( project = "shapeless", testCommand = "test", updateCommand = "update" ) - @Test def xmlInterpolator = test( + @Test def xmlInterpolator = testSbt( project = "xml-interpolator", testCommand = "test", updateCommand = "update" ) - @Test def semanticdb = test( + @Test def semanticdb = testSbt( project = "semanticdb", testCommand = "test:compile", updateCommand = "update" ) - @Test def effpi = test( + @Test def effpi = testSbt( project = "effpi", // We set `useEffpiPlugin := false` because we don't want to run their // compiler plugin since it relies on external binaries (from the model @@ -225,6 +232,6 @@ class UpdateCategory @Category(Array(classOf[UpdateCategory])) class CommunityBuildUpdate extends CommunityBuildTest { - override def test(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String]): Unit = - super.test(project, updateCommand, null, extraSbtArgs) + override def testSbt(project: String, testCommand: String, updateCommand: String, extraSbtArgs: Seq[String]): Unit = + super.testSbt(project, updateCommand, null, extraSbtArgs) } From c121b1f917854e0ee27fb6a4d0258bc8a6661f23 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 8 Nov 2019 15:02:42 +0100 Subject: [PATCH 3/5] Add utest to the community build --- community-build/community-projects/utest | 2 +- .../scala/dotty/communitybuild/CommunityBuildTest.scala | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest index aad562689a24..c8a2b7093318 160000 --- a/community-build/community-projects/utest +++ b/community-build/community-projects/utest @@ -1 +1 @@ -Subproject commit aad562689a24b02999ef3df2107975df042f173d +Subproject commit c8a2b709331869dfbf319ac296b0ffdd2a2aa0b8 diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 6ad888562b53..6405cbc932ad 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -98,6 +98,12 @@ class CommunityBuildTest { } } + @Test def utest = testMill( + project = "utest", + testCommand = "__.__.test", + extraMillArgs = List("-i", "-D", s"dottyVersion=$compilerVersion") + ) + @Test def intent = testSbt( project = "intent", testCommand = "test", From 8c1e9a89e787337d31b4120a2b666f51846007e4 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Fri, 8 Nov 2019 15:39:32 +0100 Subject: [PATCH 4/5] Add dotty-staging to prepareCommunityBuild --- .../test/scala/dotty/communitybuild/CommunityBuildTest.scala | 2 +- project/Build.scala | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 6405cbc932ad..45f4e3646af5 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -100,7 +100,7 @@ class CommunityBuildTest { @Test def utest = testMill( project = "utest", - testCommand = "__.__.test", + testCommand = s"utest.jvm[$compilerVersion].test", extraMillArgs = List("-i", "-D", s"dottyVersion=$compilerVersion") ) diff --git a/project/Build.scala b/project/Build.scala index 7e51b575ced1..2e62b0970168 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1130,6 +1130,7 @@ object Build { (publishLocal in `dotty-compiler-bootstrapped`).value (publishLocal in `sbt-dotty`).value (publishLocal in `dotty-bootstrapped`).value + (publishLocal in `dotty-staging`).value val pluginText = s"""updateOptions in Global ~= (_.withLatestSnapshots(false)) |addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion")""".stripMargin From f85c5100675b53652d9268acb8f862c67bfc03f5 Mon Sep 17 00:00:00 2001 From: Anatolii Date: Tue, 19 Nov 2019 14:19:44 +0100 Subject: [PATCH 5/5] Update uTest to match the latest Dotty version --- community-build/community-projects/utest | 2 +- project/Build.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/community-build/community-projects/utest b/community-build/community-projects/utest index c8a2b7093318..0fe508a5be98 160000 --- a/community-build/community-projects/utest +++ b/community-build/community-projects/utest @@ -1 +1 @@ -Subproject commit c8a2b709331869dfbf319ac296b0ffdd2a2aa0b8 +Subproject commit 0fe508a5be98854c9ac1fd317b62434cb24dfbe5 diff --git a/project/Build.scala b/project/Build.scala index 2e62b0970168..9c4b29bffdce 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1130,7 +1130,7 @@ object Build { (publishLocal in `dotty-compiler-bootstrapped`).value (publishLocal in `sbt-dotty`).value (publishLocal in `dotty-bootstrapped`).value - (publishLocal in `dotty-staging`).value + // (publishLocal in `dotty-staging`).value val pluginText = s"""updateOptions in Global ~= (_.withLatestSnapshots(false)) |addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "$sbtDottyVersion")""".stripMargin