Skip to content

Make community build docs experiment-aware #11935

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion community-build/src/scala/dotty/communitybuild/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 17 additions & 5 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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")
Expand All @@ -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
Expand All @@ -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"
Expand All @@ -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"

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -398,15 +408,17 @@ 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(
project = "scodec",
sbtTestCommand = "unitTests/test",
// Adds <empty> package
sbtDocCommand = "coreJVM/doc",
dependencies = List(munit, scodecBits)
dependencies = List(munit, scodecBits),
requiresExperimental = true,
)

lazy val scalaParserCombinators = SbtCommunityProject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand All @@ -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()
Expand Down