@@ -29,30 +29,43 @@ def exec(projectDir: Path, binary: String, arguments: String*): Int =
29
29
val exitCode = process.waitFor()
30
30
exitCode
31
31
32
-
33
32
sealed trait CommunityProject :
34
33
private var published = false
35
34
36
35
val project : String
37
36
val testCommand : String
38
37
val publishCommand : String
38
+ val docCommand : String
39
39
val dependencies : List [CommunityProject ]
40
40
val binaryName : String
41
41
val runCommandsArgs : List [String ] = Nil
42
42
43
43
final val projectDir = communitybuildDir.resolve(" community-projects" ).resolve(project)
44
44
45
+ final def publishDependencies (): Unit =
46
+ dependencies.foreach(_.publish())
47
+
45
48
/** Publish this project to the local Maven repository */
46
49
final def publish (): Unit =
47
50
if ! published then
48
- dependencies.foreach(_.publish() )
51
+ publishDependencies( )
49
52
log(s " Publishing $project" )
50
53
if publishCommand eq null then
51
54
throw RuntimeException (s " Publish command is not specified for $project. Project details: \n $this" )
52
55
val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _* )
53
56
if exitCode != 0 then
54
57
throw RuntimeException (s " Publish command exited with code $exitCode for project $project. Project details: \n $this" )
55
58
published = true
59
+
60
+ final def doc (): Unit =
61
+ publishDependencies()
62
+ log(s " Documenting $project" )
63
+ if docCommand eq null then
64
+ throw RuntimeException (s " Doc command is not specified for $project. Project details: \n $this" )
65
+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand): _* )
66
+ if exitCode != 0 then
67
+ throw RuntimeException (s " Doc command exited with code $exitCode for project $project. Project details: \n $this" )
68
+
56
69
end CommunityProject
57
70
58
71
final case class MillCommunityProject (
@@ -62,6 +75,7 @@ final case class MillCommunityProject(
62
75
override val binaryName : String = " ./mill"
63
76
override val testCommand = s " $baseCommand.test "
64
77
override val publishCommand = s " $baseCommand.publishLocal "
78
+ override val docCommand = null
65
79
override val runCommandsArgs = List (" -i" , " -D" , s " dottyVersion= $compilerVersion" )
66
80
67
81
final case class SbtCommunityProject (
@@ -70,11 +84,16 @@ final case class SbtCommunityProject(
70
84
extraSbtArgs : List [String ] = Nil ,
71
85
forceUpgradeSbtScalajsPlugin : Boolean = false ,
72
86
dependencies : List [CommunityProject ] = Nil ,
73
- sbtPublishCommand : String = null ) extends CommunityProject :
87
+ sbtPublishCommand : String = null ,
88
+ sbtDocCommand : String = null
89
+ ) extends CommunityProject :
74
90
override val binaryName : String = " sbt"
75
91
private val baseCommand = s " ;clean ;set logLevel in Global := Level.Error ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++ $compilerVersion! "
76
92
override val testCommand = s " $baseCommand$sbtTestCommand"
77
- override val publishCommand = s " $baseCommand$sbtPublishCommand"
93
+ override val publishCommand = if sbtPublishCommand eq null then null else s " $baseCommand$sbtPublishCommand"
94
+ override val docCommand =
95
+ if sbtDocCommand eq null then null else
96
+ s " $baseCommand;set every useScala3doc := true $sbtDocCommand"
78
97
79
98
override val runCommandsArgs : List [String ] =
80
99
// Run the sbt command with the compiler version and sbt plugin set in the build
@@ -86,11 +105,12 @@ final case class SbtCommunityProject(
86
105
else Nil
87
106
extraSbtArgs ++ sbtProps ++ List (
88
107
" -sbt-version" , " 1.3.8" ,
89
- " -Dsbt.supershell=false" ,
108
+ " -Dsbt.supershell=false" ,
90
109
s " --addPluginSbtFile= $sbtPluginFilePath"
91
110
) ++ scalaJSPluginArgs
92
111
93
112
object projects :
113
+
94
114
lazy val utest = MillCommunityProject (
95
115
project = " utest" ,
96
116
baseCommand = s " utest.jvm[ $compilerVersion] " ,
@@ -212,6 +232,7 @@ object projects:
212
232
lazy val betterfiles = SbtCommunityProject (
213
233
project = " betterfiles" ,
214
234
sbtTestCommand = " dotty-community-build/compile" ,
235
+ sbtDocCommand = " ;core/doc ;akka/doc ;shapelessScanner/doc"
215
236
)
216
237
217
238
lazy val ScalaPB = SbtCommunityProject (
@@ -308,6 +329,7 @@ object projects:
308
329
lazy val scalaz = SbtCommunityProject (
309
330
project = " scalaz" ,
310
331
sbtTestCommand = " rootJVM/test" ,
332
+ // has doc/sources set to Nil
311
333
dependencies = List (scalacheck)
312
334
)
313
335
@@ -324,7 +346,51 @@ object projects:
324
346
325
347
lazy val catsEffect3 = SbtCommunityProject (
326
348
project = " cats-effect-3" ,
327
- sbtTestCommand = " testIfRelevant"
328
- )
329
-
349
+ sbtTestCommand = " testIfRelevant" ,
350
+ // has doc/sources disabled by SpiewakPlugin
351
+ )
352
+
353
+ val projectMap = Map (
354
+ " utest" -> utest,
355
+ " sourcecode" -> sourcecode,
356
+ " oslib" -> oslib,
357
+ " oslibWatch" -> oslibWatch,
358
+ " ujson" -> ujson,
359
+ " upickle" -> upickle,
360
+ " upickleCore" -> upickleCore,
361
+ " geny" -> geny,
362
+ " fansi" -> fansi,
363
+ " pprint" -> pprint,
364
+ " requests" -> requests,
365
+ " scas" -> scas,
366
+ " intent" -> intent,
367
+ " algebra" -> algebra,
368
+ " scalacheck" -> scalacheck,
369
+ " scalatest" -> scalatest,
370
+ " scalatestplusScalacheck" -> scalatestplusScalacheck,
371
+ " scalaXml" -> scalaXml,
372
+ " scopt" -> scopt,
373
+ " scalap" -> scalap,
374
+ " squants" -> squants,
375
+ " betterfiles" -> betterfiles,
376
+ " ScalaPB" -> ScalaPB ,
377
+ " minitest" -> minitest,
378
+ " fastparse" -> fastparse,
379
+ " stdLib213" -> stdLib213,
380
+ " shapeless" -> shapeless,
381
+ " xmlInterpolator" -> xmlInterpolator,
382
+ " effpi" -> effpi,
383
+ " sconfig" -> sconfig,
384
+ " zio" -> zio,
385
+ " munit" -> munit,
386
+ " scodecBits" -> scodecBits,
387
+ " scodec" -> scodec,
388
+ " scalaParserCombinators" -> scalaParserCombinators,
389
+ " dottyCpsAsync" -> dottyCpsAsync,
390
+ " scalaz" -> scalaz,
391
+ " endpoints4s" -> endpoints4s,
392
+ " catsEffect2" -> catsEffect2,
393
+ " catsEffect3" -> catsEffect3,
394
+ )
395
+ def apply (key : String ) = projectMap(key)
330
396
end projects
0 commit comments