From 6039f7140caa5a54e2e1a9c4ab29a004382bb9db Mon Sep 17 00:00:00 2001 From: Aleksander Boruch-Gruszecki Date: Tue, 22 Sep 2020 17:50:41 +0200 Subject: [PATCH 1/3] Move community build projects to normal sources --- .../scala/dotty/communitybuild/projects.scala | 320 +++++++++++++++++ .../communitybuild/CommunityBuildTest.scala | 328 +----------------- 2 files changed, 326 insertions(+), 322 deletions(-) create mode 100644 community-build/src/scala/dotty/communitybuild/projects.scala diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala new file mode 100644 index 000000000000..fb1b2123af45 --- /dev/null +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -0,0 +1,320 @@ +package dotty.communitybuild + +import java.nio.file._ +import java.io.{PrintWriter, File} +import java.nio.charset.StandardCharsets.UTF_8 + +lazy val communitybuildDir: Path = Paths.get(sys.props("user.dir")) + +lazy val compilerVersion: String = + val file = communitybuildDir.resolve("dotty-bootstrapped.version") + new String(Files.readAllBytes(file), UTF_8) + +lazy val sbtPluginFilePath: String = + // Workaround for https://github.com/sbt/sbt/issues/4395 + new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs() + communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString() + +def log(msg: String) = println(Console.GREEN + msg + Console.RESET) + +/** Executes shell command, returns false in case of error. */ +def exec(projectDir: Path, binary: String, arguments: String*): Int = + val command = binary +: arguments + log(command.mkString(" ")) + val builder = new ProcessBuilder(command: _*).directory(projectDir.toFile).inheritIO() + val process = builder.start() + val exitCode = process.waitFor() + exitCode + + +sealed trait CommunityProject: + private var published = false + + val project: String + val testCommand: String + val publishCommand: String + val dependencies: List[CommunityProject] + val binaryName: String + val runCommandsArgs: List[String] = Nil + + final val projectDir = communitybuildDir.resolve("community-projects").resolve(project) + + /** Publish this project to the local Maven repository */ + final def publish(): Unit = + if !published then + dependencies.foreach(_.publish()) + log(s"Publishing $project") + if publishCommand eq null then + throw RuntimeException(s"Publish command is not specified for $project. Project details:\n$this") + val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _*) + if exitCode != 0 then + throw RuntimeException(s"Publish command exited with code $exitCode for project $project. Project details:\n$this") + published = true +end CommunityProject + +final case class MillCommunityProject( + project: String, + baseCommand: String, + dependencies: List[CommunityProject] = Nil) extends CommunityProject: + override val binaryName: String = "./mill" + override val testCommand = s"$baseCommand.test" + override val publishCommand = s"$baseCommand.publishLocal" + override val runCommandsArgs = List("-i", "-D", s"dottyVersion=$compilerVersion") + +final case class SbtCommunityProject( + project: String, + sbtTestCommand: String, + extraSbtArgs: List[String] = Nil, + dependencies: List[CommunityProject] = Nil, + sbtPublishCommand: String = null) extends CommunityProject: + override val binaryName: String = "sbt" + private val baseCommand = s";clean ;set logLevel in Global := Level.Error ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! " + override val testCommand = s"$baseCommand$sbtTestCommand" + override val publishCommand = s"$baseCommand$sbtPublishCommand" + + override val runCommandsArgs: List[String] = + // Run the sbt command with the compiler version and sbt plugin set in the build + val sbtProps = Option(System.getProperty("sbt.ivy.home")) match + case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome") + case _ => Nil + extraSbtArgs ++ sbtProps ++ List( + "-sbt-version", "1.3.8", + "-Dsbt.supershell=false", + s"--addPluginSbtFile=$sbtPluginFilePath") + +object projects: + lazy val utest = MillCommunityProject( + project = "utest", + baseCommand = s"utest.jvm[$compilerVersion]", + ) + + lazy val sourcecode = MillCommunityProject( + project = "sourcecode", + baseCommand = s"sourcecode.jvm[$compilerVersion]", + ) + + lazy val oslib = MillCommunityProject( + project = "os-lib", + baseCommand = s"os[$compilerVersion]", + dependencies = List(utest, sourcecode) + ) + + lazy val oslibWatch = MillCommunityProject( + project = "os-lib", + baseCommand = s"os.watch[$compilerVersion]", + dependencies = List(utest, sourcecode) + ) + + lazy val ujson = MillCommunityProject( + project = "upickle", + baseCommand = s"ujson.jvm[$compilerVersion]", + dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny) + ) + + lazy val upickle = MillCommunityProject( + project = "upickle", + baseCommand = s"upickle.jvm[$compilerVersion]", + dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) + ) + + lazy val upickleCore = MillCommunityProject( + project = "upickle", + baseCommand = s"core.jvm[$compilerVersion]", + dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) + ) + + lazy val geny = MillCommunityProject( + project = "geny", + baseCommand = s"geny.jvm[$compilerVersion]", + dependencies = List(utest) + ) + + lazy val fansi = MillCommunityProject( + project = "fansi", + baseCommand = s"fansi.jvm[$compilerVersion]", + dependencies = List(utest, sourcecode) + ) + + lazy val pprint = MillCommunityProject( + project = "PPrint", + baseCommand = s"pprint.jvm[$compilerVersion]", + dependencies = List(fansi) + ) + + lazy val requests = MillCommunityProject( + project = "requests-scala", + baseCommand = s"requests[$compilerVersion]", + dependencies = List(geny, utest, ujson, upickleCore) + ) + + lazy val scas = MillCommunityProject( + project = "scas", + baseCommand = "scas.application" + ) + + lazy val intent = SbtCommunityProject( + project = "intent", + sbtTestCommand = "test", + ) + + lazy val algebra = SbtCommunityProject( + project = "algebra", + sbtTestCommand = "coreJVM/compile", + ) + + lazy val scalacheck = SbtCommunityProject( + project = "scalacheck", + sbtTestCommand = "jvm/test", + sbtPublishCommand = ";set jvm/publishArtifact in (Compile, packageDoc) := false ;jvm/publishLocal" + ) + + lazy val scalatest = SbtCommunityProject( + project = "scalatest", + sbtTestCommand = ";scalacticDotty/clean;scalacticTestDotty/test;scalatestTestDotty/test", + sbtPublishCommand = ";scalacticDotty/publishLocal; scalatestDotty/publishLocal" + ) + + lazy val scalatestplusScalacheck = SbtCommunityProject( + project = "scalatestplus-scalacheck", + sbtTestCommand = "scalatestPlusScalaCheckJVM/test", + sbtPublishCommand = "scalatestPlusScalaCheckJVM/publishLocal", + dependencies = List(scalatest, scalacheck) + ) + + lazy val scalaXml = SbtCommunityProject( + project = "scala-xml", + sbtTestCommand = "xml/test", + ) + + lazy val scopt = SbtCommunityProject( + project = "scopt", + sbtTestCommand = "scoptJVM/compile", + ) + + lazy val scalap = SbtCommunityProject( + project = "scalap", + sbtTestCommand = "scalap/compile", + ) + + lazy val squants = SbtCommunityProject( + project = "squants", + sbtTestCommand = "squantsJVM/compile", + ) + + lazy val betterfiles = SbtCommunityProject( + project = "betterfiles", + sbtTestCommand = "dotty-community-build/compile", + ) + + lazy val ScalaPB = SbtCommunityProject( + project = "ScalaPB", + sbtTestCommand = "dotty-community-build/compile", + ) + + lazy val minitest = SbtCommunityProject( + project = "minitest", + sbtTestCommand = "dotty-community-build/compile", + ) + + lazy val fastparse = SbtCommunityProject( + project = "fastparse", + sbtTestCommand = "dotty-community-build/compile;dotty-community-build/test:compile", + ) + + lazy val stdLib213 = SbtCommunityProject( + project = "stdLib213", + sbtTestCommand = """;set scalacOptions in Global += "-Yerased-terms" ;library/compile""", + extraSbtArgs = List("-Dscala.build.compileWithDotty=true") + ) + + lazy val shapeless = SbtCommunityProject( + project = "shapeless", + sbtTestCommand = "test", + ) + + lazy val xmlInterpolator = SbtCommunityProject( + project = "xml-interpolator", + sbtTestCommand = "test", + ) + + lazy val effpi = SbtCommunityProject( + 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 + // checker mcrl2), however we do compile the compiler plugin. + + // We have to drop the plugin and some akka tests for now, the plugin depends on github.com/bmc/scalasti which + // has not been updated since 2018, so no 2.13 compat. Some akka tests are dropped due to MutableBehaviour being + // dropped in the 2.13 compatible release + + // sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile", + + sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile", + ) + + // TODO @odersky? It got broken by #5458 + // val pdbp = test( + // project = "pdbp", + // sbtTestCommand = "compile", + // ) + + lazy val sconfig = SbtCommunityProject( + project = "sconfig", + sbtTestCommand = "sconfigJVM/test", + ) + + lazy val zio = SbtCommunityProject( + project = "zio", + sbtTestCommand = "testJVMDotty", + ) + + lazy val munit = SbtCommunityProject( + project = "munit", + sbtTestCommand = "testsJVM/test", + ) + + lazy val scodecBits = SbtCommunityProject( + project = "scodec-bits", + sbtTestCommand = "coreJVM/test", + sbtPublishCommand = "coreJVM/publishLocal", + dependencies = List(scalatest, scalacheck, scalatestplusScalacheck) + ) + + lazy val scodec = SbtCommunityProject( + project = "scodec", + sbtTestCommand = "unitTests/test", + dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, scodecBits) + ) + + lazy val scalaParserCombinators = SbtCommunityProject( + project = "scala-parser-combinators", + sbtTestCommand = "parserCombinators/test", + ) + + lazy val dottyCpsAsync = SbtCommunityProject( + project = "dotty-cps-async", + sbtTestCommand = "test", + ) + + lazy val scalaz = SbtCommunityProject( + project = "scalaz", + sbtTestCommand = "rootJVM/test", + dependencies = List(scalacheck) + ) + + lazy val endpoints4s = SbtCommunityProject( + project = "endpoints4s", + sbtTestCommand = ";json-schemaJVM/compile;algebraJVM/compile;openapiJVM/compile;http4s-server/compile;http4s-client/compile;play-server/compile;play-client/compile;akka-http-server/compile;akka-http-client/compile" + ) + + lazy val catsEffect2 = SbtCommunityProject( + project = "cats-effect-2", + sbtTestCommand = "test" + ) + + lazy val catsEffect3 = SbtCommunityProject( + project = "cats-effect-3", + sbtTestCommand = "testIfRelevant" + ) + +end projects diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 914ffb26c447..5bae0f258e30 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -7,41 +7,9 @@ import org.junit.{Ignore, Test} import org.junit.Assert.{assertEquals, fail} import org.junit.experimental.categories.Category - -lazy val communitybuildDir: Path = Paths.get(sys.props("user.dir")) - -lazy val compilerVersion: String = - val file = communitybuildDir.resolve("dotty-bootstrapped.version") - new String(Files.readAllBytes(file), UTF_8) - -lazy val sbtPluginFilePath: String = - // Workaround for https://github.com/sbt/sbt/issues/4395 - new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs() - communitybuildDir.resolve("sbt-dotty-sbt").toAbsolutePath().toString() - -def log(msg: String) = println(Console.GREEN + msg + Console.RESET) - -/** Executes shell command, returns false in case of error. */ -def exec(projectDir: Path, binary: String, arguments: String*): Int = - val command = binary +: arguments - log(command.mkString(" ")) - val builder = new ProcessBuilder(command: _*).directory(projectDir.toFile).inheritIO() - val process = builder.start() - val exitCode = process.waitFor() - exitCode - - -sealed trait CommunityProject: - private var published = false - - val project: String - val testCommand: String - val publishCommand: String - val dependencies: List[CommunityProject] - val binaryName: String - val runCommandsArgs: List[String] = Nil - - final val projectDir = communitybuildDir.resolve("community-projects").resolve(project) +@Category(Array(classOf[TestCategory])) +class CommunityBuildTest: + given CommunityBuildTest = this /** Depending on the mode of operation, either * runs the test or updates the project. Updating @@ -53,293 +21,9 @@ sealed trait CommunityProject: * and avoid network overhead. See https://github.com/lampepfl/dotty-drone * for more infrastructural details. */ - final def run()(using suite: CommunityBuildTest) = - dependencies.foreach(_.publish()) - suite.test(project, binaryName, runCommandsArgs :+ testCommand) - - /** Publish this project to the local Maven repository */ - final def publish(): Unit = - if !published then - dependencies.foreach(_.publish()) - log(s"Publishing $project") - if publishCommand eq null then - throw RuntimeException(s"Publish command is not specified for $project. Project details:\n$this") - val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _*) - if exitCode != 0 then - throw RuntimeException(s"Publish command exited with code $exitCode for project $project. Project details:\n$this") - published = true -end CommunityProject - -final case class MillCommunityProject( - project: String, - baseCommand: String, - dependencies: List[CommunityProject] = Nil) extends CommunityProject: - override val binaryName: String = "./mill" - override val testCommand = s"$baseCommand.test" - override val publishCommand = s"$baseCommand.publishLocal" - override val runCommandsArgs = List("-i", "-D", s"dottyVersion=$compilerVersion") - -final case class SbtCommunityProject( - project: String, - sbtTestCommand: String, - extraSbtArgs: List[String] = Nil, - dependencies: List[CommunityProject] = Nil, - sbtPublishCommand: String = null) extends CommunityProject: - override val binaryName: String = "sbt" - private val baseCommand = s";clean ;set logLevel in Global := Level.Error ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! " - override val testCommand = s"$baseCommand$sbtTestCommand" - override val publishCommand = s"$baseCommand$sbtPublishCommand" - - override val runCommandsArgs: List[String] = - // Run the sbt command with the compiler version and sbt plugin set in the build - val sbtProps = Option(System.getProperty("sbt.ivy.home")) match - case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome") - case _ => Nil - extraSbtArgs ++ sbtProps ++ List( - "-sbt-version", "1.3.8", - "-Dsbt.supershell=false", - s"--addPluginSbtFile=$sbtPluginFilePath") - -object projects: - lazy val utest = MillCommunityProject( - project = "utest", - baseCommand = s"utest.jvm[$compilerVersion]", - ) - - lazy val sourcecode = MillCommunityProject( - project = "sourcecode", - baseCommand = s"sourcecode.jvm[$compilerVersion]", - ) - - lazy val oslib = MillCommunityProject( - project = "os-lib", - baseCommand = s"os[$compilerVersion]", - dependencies = List(utest, sourcecode) - ) - - lazy val oslibWatch = MillCommunityProject( - project = "os-lib", - baseCommand = s"os.watch[$compilerVersion]", - dependencies = List(utest, sourcecode) - ) - - lazy val ujson = MillCommunityProject( - project = "upickle", - baseCommand = s"ujson.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny) - ) - - lazy val upickle = MillCommunityProject( - project = "upickle", - baseCommand = s"upickle.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) - ) - - lazy val upickleCore = MillCommunityProject( - project = "upickle", - baseCommand = s"core.jvm[$compilerVersion]", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, geny, utest) - ) - - lazy val geny = MillCommunityProject( - project = "geny", - baseCommand = s"geny.jvm[$compilerVersion]", - dependencies = List(utest) - ) - - lazy val fansi = MillCommunityProject( - project = "fansi", - baseCommand = s"fansi.jvm[$compilerVersion]", - dependencies = List(utest, sourcecode) - ) - - lazy val pprint = MillCommunityProject( - project = "PPrint", - baseCommand = s"pprint.jvm[$compilerVersion]", - dependencies = List(fansi) - ) - - lazy val requests = MillCommunityProject( - project = "requests-scala", - baseCommand = s"requests[$compilerVersion]", - dependencies = List(geny, utest, ujson, upickleCore) - ) - - lazy val scas = MillCommunityProject( - project = "scas", - baseCommand = "scas.application" - ) - - lazy val intent = SbtCommunityProject( - project = "intent", - sbtTestCommand = "test", - ) - - lazy val algebra = SbtCommunityProject( - project = "algebra", - sbtTestCommand = "coreJVM/compile", - ) - - lazy val scalacheck = SbtCommunityProject( - project = "scalacheck", - sbtTestCommand = "jvm/test", - sbtPublishCommand = ";set jvm/publishArtifact in (Compile, packageDoc) := false ;jvm/publishLocal" - ) - - lazy val scalatest = SbtCommunityProject( - project = "scalatest", - sbtTestCommand = ";scalacticDotty/clean;scalacticTestDotty/test;scalatestTestDotty/test", - sbtPublishCommand = ";scalacticDotty/publishLocal; scalatestDotty/publishLocal" - ) - - lazy val scalatestplusScalacheck = SbtCommunityProject( - project = "scalatestplus-scalacheck", - sbtTestCommand = "scalatestPlusScalaCheckJVM/test", - sbtPublishCommand = "scalatestPlusScalaCheckJVM/publishLocal", - dependencies = List(scalatest, scalacheck) - ) - - lazy val scalaXml = SbtCommunityProject( - project = "scala-xml", - sbtTestCommand = "xml/test", - ) - - lazy val scopt = SbtCommunityProject( - project = "scopt", - sbtTestCommand = "scoptJVM/compile", - ) - - lazy val scalap = SbtCommunityProject( - project = "scalap", - sbtTestCommand = "scalap/compile", - ) - - lazy val squants = SbtCommunityProject( - project = "squants", - sbtTestCommand = "squantsJVM/compile", - ) - - lazy val betterfiles = SbtCommunityProject( - project = "betterfiles", - sbtTestCommand = "dotty-community-build/compile", - ) - - lazy val ScalaPB = SbtCommunityProject( - project = "ScalaPB", - sbtTestCommand = "dotty-community-build/compile", - ) - - lazy val minitest = SbtCommunityProject( - project = "minitest", - sbtTestCommand = "dotty-community-build/compile", - ) - - lazy val fastparse = SbtCommunityProject( - project = "fastparse", - sbtTestCommand = "dotty-community-build/compile;dotty-community-build/test:compile", - ) - - lazy val stdLib213 = SbtCommunityProject( - project = "stdLib213", - sbtTestCommand = """;set scalacOptions in Global += "-Yerased-terms" ;library/compile""", - extraSbtArgs = List("-Dscala.build.compileWithDotty=true") - ) - - lazy val shapeless = SbtCommunityProject( - project = "shapeless", - sbtTestCommand = "test", - ) - - lazy val xmlInterpolator = SbtCommunityProject( - project = "xml-interpolator", - sbtTestCommand = "test", - ) - - lazy val effpi = SbtCommunityProject( - 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 - // checker mcrl2), however we do compile the compiler plugin. - - // We have to drop the plugin and some akka tests for now, the plugin depends on github.com/bmc/scalasti which - // has not been updated since 2018, so no 2.13 compat. Some akka tests are dropped due to MutableBehaviour being - // dropped in the 2.13 compatible release - - // sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile", - - sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile", - ) - - // TODO @odersky? It got broken by #5458 - // val pdbp = test( - // project = "pdbp", - // sbtTestCommand = "compile", - // ) - - lazy val sconfig = SbtCommunityProject( - project = "sconfig", - sbtTestCommand = "sconfigJVM/test", - ) - - lazy val zio = SbtCommunityProject( - project = "zio", - sbtTestCommand = "testJVMDotty", - ) - - lazy val munit = SbtCommunityProject( - project = "munit", - sbtTestCommand = "testsJVM/test", - ) - - lazy val scodecBits = SbtCommunityProject( - project = "scodec-bits", - sbtTestCommand = "coreJVM/test", - sbtPublishCommand = "coreJVM/publishLocal", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck) - ) - - lazy val scodec = SbtCommunityProject( - project = "scodec", - sbtTestCommand = "unitTests/test", - dependencies = List(scalatest, scalacheck, scalatestplusScalacheck, scodecBits) - ) - - lazy val scalaParserCombinators = SbtCommunityProject( - project = "scala-parser-combinators", - sbtTestCommand = "parserCombinators/test", - ) - - lazy val dottyCpsAsync = SbtCommunityProject( - project = "dotty-cps-async", - sbtTestCommand = "test", - ) - - lazy val scalaz = SbtCommunityProject( - project = "scalaz", - sbtTestCommand = "rootJVM/test", - dependencies = List(scalacheck) - ) - - lazy val endpoints4s = SbtCommunityProject( - project = "endpoints4s", - sbtTestCommand = ";json-schemaJVM/compile;algebraJVM/compile;openapiJVM/compile;http4s-server/compile;http4s-client/compile;play-server/compile;play-client/compile;akka-http-server/compile;akka-http-client/compile" - ) - - lazy val catsEffect2 = SbtCommunityProject( - project = "cats-effect-2", - sbtTestCommand = "test" - ) - - lazy val catsEffect3 = SbtCommunityProject( - project = "cats-effect-3", - sbtTestCommand = "testIfRelevant" - ) - -end projects - -@Category(Array(classOf[TestCategory])) -class CommunityBuildTest: - given CommunityBuildTest = this + extension (self: CommunityProject) def run()(using suite: CommunityBuildTest) = + self.dependencies.foreach(_.publish()) + suite.test(self.project, self.binaryName, self.runCommandsArgs :+ self.testCommand) /** Build the given project with the published local compiler and sbt plugin. * From 42c3662e1b8a993ca487217d3b3b325679851bd6 Mon Sep 17 00:00:00 2001 From: Aleksander Boruch-Gruszecki Date: Tue, 22 Sep 2020 17:40:39 +0200 Subject: [PATCH 2/3] Allow compiling stdLib213 with community-build/run --- .../dotty/communitybuild/readme.md => README.md} | 1 + .../src/scala/dotty/communitybuild/Main.scala | 13 +++++++++++++ .../src/scala/dotty/communitybuild/projects.scala | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) rename community-build/{test/scala/dotty/communitybuild/readme.md => README.md} (88%) create mode 100644 community-build/src/scala/dotty/communitybuild/Main.scala diff --git a/community-build/test/scala/dotty/communitybuild/readme.md b/community-build/README.md similarity index 88% rename from community-build/test/scala/dotty/communitybuild/readme.md rename to community-build/README.md index 4752badbb001..a042f13b94ac 100644 --- a/community-build/test/scala/dotty/communitybuild/readme.md +++ b/community-build/README.md @@ -14,4 +14,5 @@ To add your project to the community build you can follow these steps: 2. Open a PR against this repo that: - Adds your project as a new git submodule - `git submodule add https://github.com/lampepfl/XYZ.git community-build/community-projects/XYZ` + - Add the project to [projects.scala](https://github.com/lampepfl/dotty/blob/master/community-build/src/scala/dotty/communitybuild/projects.scala) - Adds a test in [CommunityBuildTest.scala](https://github.com/lampepfl/dotty/blob/master/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala) diff --git a/community-build/src/scala/dotty/communitybuild/Main.scala b/community-build/src/scala/dotty/communitybuild/Main.scala new file mode 100644 index 000000000000..62f1b8a29159 --- /dev/null +++ b/community-build/src/scala/dotty/communitybuild/Main.scala @@ -0,0 +1,13 @@ +package dotty.communitybuild + +object Main { + /** Builds stdlib. + * + * Output is available in build/pack/lib directory in stdlib project. + * + * In the future, we allow building different projects based on arguments, + * but for now stdlib is the only usecase. + */ + def main(args: Array[String]): Unit = + projects.stdLib213.publish() +} diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index fb1b2123af45..5d32d6d20029 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -223,8 +223,9 @@ object projects: lazy val stdLib213 = SbtCommunityProject( project = "stdLib213", + extraSbtArgs = List("-Dscala.build.compileWithDotty=true"), sbtTestCommand = """;set scalacOptions in Global += "-Yerased-terms" ;library/compile""", - extraSbtArgs = List("-Dscala.build.compileWithDotty=true") + sbtPublishCommand = """;set scalacOptions in Global += "-Yerased-terms" ;set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""", ) lazy val shapeless = SbtCommunityProject( From 2625f03ed10dbd22256e98f2922bea824beaa028 Mon Sep 17 00:00:00 2001 From: Aleksander Boruch-Gruszecki Date: Fri, 2 Oct 2020 17:33:31 +0200 Subject: [PATCH 3/3] Remove -Yerased-terms from stdlib community build opts --- community-build/src/scala/dotty/communitybuild/projects.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index 5d32d6d20029..bb6c99d29898 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -224,8 +224,8 @@ object projects: lazy val stdLib213 = SbtCommunityProject( project = "stdLib213", extraSbtArgs = List("-Dscala.build.compileWithDotty=true"), - sbtTestCommand = """;set scalacOptions in Global += "-Yerased-terms" ;library/compile""", - sbtPublishCommand = """;set scalacOptions in Global += "-Yerased-terms" ;set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""", + sbtTestCommand = """library/compile""", + sbtPublishCommand = """;set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""", ) lazy val shapeless = SbtCommunityProject(