Skip to content

Commit 44265eb

Browse files
committed
Make community build docs experiment-aware
1 parent a90ce46 commit 44265eb

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

community-build/src/scala/dotty/communitybuild/Main.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ object Main:
5454
Seq("rm", "-rf", destStr).!
5555
Files.createDirectory(dest)
5656
val (toRun, ignored) =
57-
allProjects.partition(_.docCommand != null)
57+
allProjects.partition( p =>
58+
p.docCommand != null
59+
&& (!p.requiresExperimental || compilerSupportExperimental)
60+
)
5861

5962
val paths = toRun.map { project =>
6063
val name = project.project

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ sealed trait CommunityProject:
4040
val dependencies: List[CommunityProject]
4141
val binaryName: String
4242
val runCommandsArgs: List[String] = Nil
43+
val requiresExperimental: Boolean
4344

4445
final val projectDir = communitybuildDir.resolve("community-projects").resolve(project)
4546

@@ -48,6 +49,7 @@ sealed trait CommunityProject:
4849

4950
/** Publish this project to the local Maven repository */
5051
final def publish(): Unit =
52+
// TODO what should this do with .requiresExperimental?
5153
if !published then
5254
publishDependencies()
5355
log(s"Publishing $project")
@@ -59,6 +61,11 @@ sealed trait CommunityProject:
5961
published = true
6062

6163
final def doc(): Unit =
64+
if this.requiresExperimental && !compilerSupportExperimental then
65+
log(
66+
s"Skipping ${this.project} - it needs experimental features unsupported in this build."
67+
)
68+
return
6269
publishDependencies()
6370
log(s"Documenting $project")
6471
if docCommand eq null then
@@ -78,6 +85,7 @@ final case class MillCommunityProject(
7885
baseCommand: String,
7986
dependencies: List[CommunityProject] = Nil,
8087
ignoreDocs: Boolean = false,
88+
requiresExperimental: Boolean = false,
8189
) extends CommunityProject:
8290
override val binaryName: String = "./mill"
8391
override val testCommand = s"$baseCommand.test"
@@ -94,7 +102,8 @@ final case class SbtCommunityProject(
94102
dependencies: List[CommunityProject] = Nil,
95103
sbtPublishCommand: String = null,
96104
sbtDocCommand: String = null,
97-
scalacOptions: List[String] = SbtCommunityProject.scalacOptions
105+
scalacOptions: List[String] = SbtCommunityProject.scalacOptions,
106+
requiresExperimental: Boolean = false,
98107
) extends CommunityProject:
99108
override val binaryName: String = "sbt"
100109

@@ -237,13 +246,15 @@ object projects:
237246

238247
lazy val scas = MillCommunityProject(
239248
project = "scas",
240-
baseCommand = "scas.application"
249+
baseCommand = "scas.application",
250+
requiresExperimental = true
241251
)
242252

243253
lazy val intent = SbtCommunityProject(
244254
project = "intent",
245255
sbtTestCommand = "test",
246-
sbtDocCommand = "doc"
256+
sbtDocCommand = "doc",
257+
requiresExperimental = true,
247258
)
248259

249260
lazy val algebra = SbtCommunityProject(
@@ -398,15 +409,17 @@ object projects:
398409
sbtTestCommand = "coreJVM/test;coreJS/test",
399410
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
400411
sbtDocCommand = "coreJVM/doc",
401-
dependencies = List(munit)
412+
dependencies = List(munit),
413+
requiresExperimental = true,
402414
)
403415

404416
lazy val scodec = SbtCommunityProject(
405417
project = "scodec",
406418
sbtTestCommand = "unitTests/test",
407419
// Adds <empty> package
408420
sbtDocCommand = "coreJVM/doc",
409-
dependencies = List(munit, scodecBits)
421+
dependencies = List(munit, scodecBits),
422+
requiresExperimental = true,
410423
)
411424

412425
lazy val scalaParserCombinators = SbtCommunityProject(

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ abstract class CommunityBuildTest:
2020
* and avoid network overhead. See https://github.com/lampepfl/dotty-drone
2121
* for more infrastructural details.
2222
*/
23-
extension (self: CommunityProject) def run()(using suite: CommunityBuildTest) =
23+
extension (self: CommunityProject) def run()(using suite: CommunityBuildTest): Unit =
24+
if self.requiresExperimental && !compilerSupportExperimental then
25+
println(
26+
s"Skipping ${self.project} - it needs experimental features unsupported in this build."
27+
)
28+
return
2429
self.dependencies.foreach(_.publish())
2530
suite.test(self)
2631

@@ -116,8 +121,8 @@ class CommunityBuildTestB extends CommunityBuildTest:
116121
@Test def disciplineSpecs2 = projects.disciplineSpecs2.run()
117122
@Test def munit = projects.munit.run()
118123
@Test def perspective = projects.perspective.run()
119-
@Test def scodec = if compilerSupportExperimental then projects.scodec.run()
120-
@Test def scodecBits = if compilerSupportExperimental then projects.scodecBits.run()
124+
@Test def scodec = projects.scodec.run()
125+
@Test def scodecBits = projects.scodecBits.run()
121126
@Test def simulacrumScalafixAnnotations = projects.simulacrumScalafixAnnotations.run()
122127
end CommunityBuildTestB
123128

@@ -134,7 +139,7 @@ class CommunityBuildTestC extends CommunityBuildTest:
134139
@Test def fansi = projects.fansi.run()
135140
@Test def fastparse = projects.fastparse.run()
136141
@Test def geny = projects.geny.run()
137-
@Test def intent = if compilerSupportExperimental then projects.intent.run()
142+
@Test def intent = projects.intent.run()
138143
@Test def minitest = projects.minitest.run()
139144
@Test def onnxScala = projects.onnxScala.run()
140145
@Test def oslib = projects.oslib.run()

0 commit comments

Comments
 (0)