Skip to content

Commit 8b35b67

Browse files
authored
Merge pull request #11935 from dotty-staging/make-doc-commbuild-aware-of-experiments
Make community build docs experiment-aware
2 parents 63fb4e7 + 3e2483d commit 8b35b67

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-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: 17 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,14 @@ object projects:
237246

238247
lazy val scas = MillCommunityProject(
239248
project = "scas",
240-
baseCommand = "scas.application"
249+
baseCommand = "scas.application",
241250
)
242251

243252
lazy val intent = SbtCommunityProject(
244253
project = "intent",
245254
sbtTestCommand = "test",
246-
sbtDocCommand = "doc"
255+
sbtDocCommand = "doc",
256+
requiresExperimental = true,
247257
)
248258

249259
lazy val algebra = SbtCommunityProject(
@@ -398,15 +408,17 @@ object projects:
398408
sbtTestCommand = "coreJVM/test;coreJS/test",
399409
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
400410
sbtDocCommand = "coreJVM/doc",
401-
dependencies = List(munit)
411+
dependencies = List(munit),
412+
requiresExperimental = true,
402413
)
403414

404415
lazy val scodec = SbtCommunityProject(
405416
project = "scodec",
406417
sbtTestCommand = "unitTests/test",
407418
// Adds <empty> package
408419
sbtDocCommand = "coreJVM/doc",
409-
dependencies = List(munit, scodecBits)
420+
dependencies = List(munit, scodecBits),
421+
requiresExperimental = true,
410422
)
411423

412424
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)