diff --git a/community-build/src/scala/dotty/communitybuild/Main.scala b/community-build/src/scala/dotty/communitybuild/Main.scala index 9709c22493dd..d135de12bdb0 100644 --- a/community-build/src/scala/dotty/communitybuild/Main.scala +++ b/community-build/src/scala/dotty/communitybuild/Main.scala @@ -54,7 +54,10 @@ object Main: Seq("rm", "-rf", destStr).! Files.createDirectory(dest) val (toRun, ignored) = - allProjects.partition(_.docCommand != null) + allProjects.partition( p => + p.docCommand != null + && (!p.requiresExperimental || compilerSupportExperimental) + ) val paths = toRun.map { project => val name = project.project diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index a44b44d6085f..0f59a529546b 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -40,6 +40,7 @@ sealed trait CommunityProject: val dependencies: List[CommunityProject] val binaryName: String val runCommandsArgs: List[String] = Nil + val requiresExperimental: Boolean final val projectDir = communitybuildDir.resolve("community-projects").resolve(project) @@ -48,6 +49,7 @@ sealed trait CommunityProject: /** Publish this project to the local Maven repository */ final def publish(): Unit = + // TODO what should this do with .requiresExperimental? if !published then publishDependencies() log(s"Publishing $project") @@ -59,6 +61,11 @@ sealed trait CommunityProject: published = true final def doc(): Unit = + if this.requiresExperimental && !compilerSupportExperimental then + log( + s"Skipping ${this.project} - it needs experimental features unsupported in this build." + ) + return publishDependencies() log(s"Documenting $project") if docCommand eq null then @@ -78,6 +85,7 @@ final case class MillCommunityProject( baseCommand: String, dependencies: List[CommunityProject] = Nil, ignoreDocs: Boolean = false, + requiresExperimental: Boolean = false, ) extends CommunityProject: override val binaryName: String = "./mill" override val testCommand = s"$baseCommand.test" @@ -94,7 +102,8 @@ final case class SbtCommunityProject( dependencies: List[CommunityProject] = Nil, sbtPublishCommand: String = null, sbtDocCommand: String = null, - scalacOptions: List[String] = SbtCommunityProject.scalacOptions + scalacOptions: List[String] = SbtCommunityProject.scalacOptions, + requiresExperimental: Boolean = false, ) extends CommunityProject: override val binaryName: String = "sbt" @@ -237,13 +246,14 @@ object projects: lazy val scas = MillCommunityProject( project = "scas", - baseCommand = "scas.application" + baseCommand = "scas.application", ) lazy val intent = SbtCommunityProject( project = "intent", sbtTestCommand = "test", - sbtDocCommand = "doc" + sbtDocCommand = "doc", + requiresExperimental = true, ) lazy val algebra = SbtCommunityProject( @@ -398,7 +408,8 @@ object projects: sbtTestCommand = "coreJVM/test;coreJS/test", sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal", sbtDocCommand = "coreJVM/doc", - dependencies = List(munit) + dependencies = List(munit), + requiresExperimental = true, ) lazy val scodec = SbtCommunityProject( @@ -406,7 +417,8 @@ object projects: sbtTestCommand = "unitTests/test", // Adds package sbtDocCommand = "coreJVM/doc", - dependencies = List(munit, scodecBits) + dependencies = List(munit, scodecBits), + requiresExperimental = true, ) lazy val scalaParserCombinators = SbtCommunityProject( diff --git a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala index 82f635ffa508..8b169385ddf1 100644 --- a/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala +++ b/community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala @@ -20,7 +20,12 @@ abstract class CommunityBuildTest: * and avoid network overhead. See https://github.com/lampepfl/dotty-drone * for more infrastructural details. */ - extension (self: CommunityProject) def run()(using suite: CommunityBuildTest) = + extension (self: CommunityProject) def run()(using suite: CommunityBuildTest): Unit = + if self.requiresExperimental && !compilerSupportExperimental then + println( + s"Skipping ${self.project} - it needs experimental features unsupported in this build." + ) + return self.dependencies.foreach(_.publish()) suite.test(self) @@ -116,8 +121,8 @@ class CommunityBuildTestB extends CommunityBuildTest: @Test def disciplineSpecs2 = projects.disciplineSpecs2.run() @Test def munit = projects.munit.run() @Test def perspective = projects.perspective.run() - @Test def scodec = if compilerSupportExperimental then projects.scodec.run() - @Test def scodecBits = if compilerSupportExperimental then projects.scodecBits.run() + @Test def scodec = projects.scodec.run() + @Test def scodecBits = projects.scodecBits.run() @Test def simulacrumScalafixAnnotations = projects.simulacrumScalafixAnnotations.run() end CommunityBuildTestB @@ -134,7 +139,7 @@ class CommunityBuildTestC extends CommunityBuildTest: @Test def fansi = projects.fansi.run() @Test def fastparse = projects.fastparse.run() @Test def geny = projects.geny.run() - @Test def intent = if compilerSupportExperimental then projects.intent.run() + @Test def intent = projects.intent.run() @Test def minitest = projects.minitest.run() @Test def onnxScala = projects.onnxScala.run() @Test def oslib = projects.oslib.run()