@@ -45,23 +45,37 @@ sealed trait CommunityProject:
4545 val project : String
4646 val testCommand : String
4747 val publishCommand : String
48+ val docCommand : String
4849 val dependencies : List [CommunityProject ]
4950 val binaryName : String
5051 val runCommandsArgs : List [String ] = Nil
5152
5253 final val projectDir = communitybuildDir.resolve(" community-projects" ).resolve(project)
5354
55+ final def publishDependencies (): Unit =
56+ dependencies.foreach(_.publish())
57+
5458 /** Publish this project to the local Maven repository */
5559 final def publish (): Unit =
5660 if ! published then
57- dependencies.foreach(_.publish() )
61+ publishDependencies( )
5862 log(s " Publishing $project" )
5963 if publishCommand eq null then
6064 throw RuntimeException (s " Publish command is not specified for $project. Project details: \n $this" )
6165 val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ publishCommand): _* )
6266 if exitCode != 0 then
6367 throw RuntimeException (s " Publish command exited with code $exitCode for project $project. Project details: \n $this" )
6468 published = true
69+
70+ final def doc (): Unit =
71+ publishDependencies()
72+ log(s " Documenting $project" )
73+ if docCommand eq null then
74+ throw RuntimeException (s " Doc command is not specified for $project. Project details: \n $this" )
75+ val exitCode = exec(projectDir, binaryName, (runCommandsArgs :+ docCommand): _* )
76+ if exitCode != 0 then
77+ throw RuntimeException (s " Doc command exited with code $exitCode for project $project. Project details: \n $this" )
78+
6579end CommunityProject
6680
6781final case class MillCommunityProject (
@@ -71,14 +85,17 @@ final case class MillCommunityProject(
7185 override val binaryName : String = " ./mill"
7286 override val testCommand = s " $baseCommand.test "
7387 override val publishCommand = s " $baseCommand.publishLocal "
88+ override val docCommand = null
7489 override val runCommandsArgs = List (" -i" , " -D" , s " dottyVersion= $compilerVersion" )
7590
7691final case class SbtCommunityProject (
7792 project : String ,
7893 sbtTestCommand : String ,
7994 extraSbtArgs : List [String ] = Nil ,
8095 dependencies : List [CommunityProject ] = Nil ,
81- sbtPublishCommand : String = null ) extends CommunityProject :
96+ sbtPublishCommand : String = null ,
97+ sbtDocCommand : String = null
98+ ) extends CommunityProject :
8299 override val binaryName : String = " sbt"
83100
84101 // A project in the community build can depend on an arbitrary version of
@@ -105,7 +122,10 @@ final case class SbtCommunityProject(
105122 ++ s " ++ $compilerVersion!; "
106123
107124 override val testCommand = s " $baseCommand$sbtTestCommand"
108- override val publishCommand = s " $baseCommand$sbtPublishCommand"
125+ override val publishCommand = if sbtPublishCommand eq null then null else s " $baseCommand$sbtPublishCommand"
126+ override val docCommand =
127+ if sbtDocCommand eq null then null else
128+ s " $baseCommand;set every useScala3doc := true $sbtDocCommand"
109129
110130 override val runCommandsArgs : List [String ] =
111131 // Run the sbt command with the compiler version and sbt plugin set in the build
@@ -119,6 +139,7 @@ final case class SbtCommunityProject(
119139 )
120140
121141object projects :
142+
122143 lazy val utest = MillCommunityProject (
123144 project = " utest" ,
124145 baseCommand = s " utest.jvm[ $compilerVersion] " ,
@@ -230,6 +251,7 @@ object projects:
230251 lazy val betterfiles = SbtCommunityProject (
231252 project = " betterfiles" ,
232253 sbtTestCommand = " dotty-community-build/compile" ,
254+ sbtDocCommand = " ;core/doc ;akka/doc ;shapelessScanner/doc"
233255 )
234256
235257 lazy val ScalaPB = SbtCommunityProject (
@@ -331,6 +353,7 @@ object projects:
331353 lazy val scalaz = SbtCommunityProject (
332354 project = " scalaz" ,
333355 sbtTestCommand = " rootJVM/test" ,
356+ // has doc/sources set to Nil
334357 dependencies = List (scalacheck)
335358 )
336359
@@ -364,5 +387,50 @@ object projects:
364387 project = " verify" ,
365388 sbtTestCommand = " verifyJVM/test" ,
366389 )
390+
391+ val projectMap = Map (
392+ " utest" -> utest,
393+ " sourcecode" -> sourcecode,
394+ " oslib" -> oslib,
395+ " oslibWatch" -> oslibWatch,
396+ " ujson" -> ujson,
397+ " upickle" -> upickle,
398+ " upickleCore" -> upickleCore,
399+ " geny" -> geny,
400+ " fansi" -> fansi,
401+ " pprint" -> pprint,
402+ " requests" -> requests,
403+ " scas" -> scas,
404+ " intent" -> intent,
405+ " algebra" -> algebra,
406+ " scalacheck" -> scalacheck,
407+ " scalatest" -> scalatest,
408+ " scalatestplusScalacheck" -> scalatestplusScalacheck,
409+ " scalaXml" -> scalaXml,
410+ " scopt" -> scopt,
411+ " scalap" -> scalap,
412+ " squants" -> squants,
413+ " betterfiles" -> betterfiles,
414+ " ScalaPB" -> ScalaPB ,
415+ " minitest" -> minitest,
416+ " fastparse" -> fastparse,
417+ " stdLib213" -> stdLib213,
418+ " shapeless" -> shapeless,
419+ " xmlInterpolator" -> xmlInterpolator,
420+ " effpi" -> effpi,
421+ " sconfig" -> sconfig,
422+ " zio" -> zio,
423+ " munit" -> munit,
424+ " scodecBits" -> scodecBits,
425+ " scodec" -> scodec,
426+ " scalaParserCombinators" -> scalaParserCombinators,
427+ " dottyCpsAsync" -> dottyCpsAsync,
428+ " scalaz" -> scalaz,
429+ " endpoints4s" -> endpoints4s,
430+ " catsEffect2" -> catsEffect2,
431+ " catsEffect3" -> catsEffect3,
432+ " scalaCollectionCompat" -> scalaCollectionCompat
433+ )
434+ def apply (key : String ) = projectMap(key)
367435
368436end projects
0 commit comments