Skip to content

Commit 1200b81

Browse files
committed
chore: update the build to use the new stdlib
1 parent 82ebe49 commit 1200b81

File tree

1 file changed

+21
-63
lines changed

1 file changed

+21
-63
lines changed

project/Build.scala

Lines changed: 21 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,7 +3116,7 @@ object Build {
31163116
}.value,
31173117

31183118
generateScalaDocumentation := Def.inputTaskDyn {
3119-
val majorVersion = (LocalProject("scala3-library-bootstrapped") / scalaBinaryVersion).value
3119+
val majorVersion = (`scala-library-bootstrapped` / scalaBinaryVersion).value
31203120

31213121
val extraArgs = spaceDelimited("[<output-dir>] [--justAPI]").parsed
31223122
val outputDirOverride = extraArgs.headOption.fold(identity[GenerationConfig](_))(newDir => {
@@ -3733,25 +3733,12 @@ object ScaladocConfigs {
37333733

37343734
def dottyExternalMapping = ".*scala/.*::scaladoc3::https://dotty.epfl.ch/api/"
37353735
def javaExternalMapping = ".*java/.*::javadoc::https://docs.oracle.com/javase/8/docs/api/"
3736-
def scalaSrcLink(v: String, s: String) = s"${s}github://scala/scala/v$v#src/library"
3737-
def dottySrcLink(v: String, sourcesPrefix: String = "", outputPrefix: String = "") =
3738-
sys.env.get("GITHUB_SHA") match {
3739-
case Some(sha) =>
3740-
s"${sourcesPrefix}github://${sys.env("GITHUB_REPOSITORY")}/$sha$outputPrefix"
3741-
case None => s"${sourcesPrefix}github://scala/scala3/$v$outputPrefix"
3736+
def defaultSourceLinks(version: String) = {
3737+
def dottySrcLink(v: String) = sys.env.get("GITHUB_SHA") match {
3738+
case Some(sha) => s"github://scala/scala3/$sha"
3739+
case None => s"github://scala/scala3/$v"
37423740
}
3743-
3744-
def defaultSourceLinks(version: String = dottyNonBootstrappedVersion, refVersion: String = dottyVersion) = Def.task {
3745-
def stdLibVersion = stdlibVersion(NonBootstrapped)
3746-
def srcManaged(v: String, s: String) = s"out/bootstrap/scala2-library-bootstrapped/scala-$v/src_managed/main/$s-library-src"
3747-
SourceLinks(
3748-
List(
3749-
scalaSrcLink(stdLibVersion, srcManaged(version, "scala") + "="),
3750-
dottySrcLink(refVersion, "library/src=", "#library/src"),
3751-
dottySrcLink(refVersion),
3752-
"docs=github://scala/scala3/main#docs"
3753-
)
3754-
)
3741+
SourceLinks(List(dottySrcLink(version), "docs=github://scala/scala3/main#docs"))
37553742
}
37563743

37573744
lazy val DefaultGenerationSettings = Def.task {
@@ -3766,17 +3753,14 @@ object ScaladocConfigs {
37663753
def skipById = SkipById(List(
37673754
"scala.runtime.stdLibPatches",
37683755
"scala.runtime.MatchCase",
3769-
"dotty.tools.tasty",
3770-
"dotty.tools.tasty.util",
3771-
"dotty.tools.tasty.besteffort"
37723756
))
37733757
def projectFooter = ProjectFooter(s"Copyright (c) 2002-$currentYear, LAMP/EPFL")
37743758
def defaultTemplate = DefaultTemplate("static-site-main")
37753759
GenerationConfig(
37763760
List(),
37773761
ProjectVersion(projectVersion),
37783762
GenerateInkuire(true),
3779-
defaultSourceLinks().value,
3763+
defaultSourceLinks(version = dottyVersion),
37803764
skipByRegex,
37813765
skipById,
37823766
projectLogo,
@@ -3798,13 +3782,8 @@ object ScaladocConfigs {
37983782
)
37993783
}
38003784

3801-
lazy val DefaultGenerationConfig = Def.task {
3802-
def distLocation = (dist / Universal / stage).value
3803-
DefaultGenerationSettings.value
3804-
}
3805-
38063785
lazy val Scaladoc = Def.task {
3807-
DefaultGenerationConfig.value
3786+
DefaultGenerationSettings.value
38083787
.add(UseJavacp(true))
38093788
.add(ProjectName("scaladoc"))
38103789
.add(OutputDir("scaladoc/output/self"))
@@ -3815,7 +3794,7 @@ object ScaladocConfigs {
38153794

38163795
lazy val Testcases = Def.task {
38173796
val tastyRoots = (Test / Build.testcasesOutputDir).value
3818-
DefaultGenerationConfig.value
3797+
DefaultGenerationSettings.value
38193798
.add(UseJavacp(true))
38203799
.add(OutputDir("scaladoc/output/testcases"))
38213800
.add(ProjectName("scaladoc testcases"))
@@ -3831,56 +3810,35 @@ object ScaladocConfigs {
38313810
}
38323811

38333812
lazy val Scala3 = Def.task {
3834-
val dottyJars: Seq[java.io.File] = Seq(
3835-
(`scala2-library-bootstrapped`/Compile/products).value,
3836-
(`scala3-library-bootstrapped`/Compile/products).value,
3837-
(`scala3-interfaces`/Compile/products).value,
3838-
(`tasty-core-bootstrapped`/Compile/products).value,
3839-
).flatten
3840-
3841-
val roots = dottyJars.map(_.getAbsolutePath)
3842-
3843-
val managedSources =
3844-
(`scala2-library-bootstrapped`/Compile/sourceManaged).value / "scala-library-src"
3845-
val projectRoot = (ThisBuild/baseDirectory).value.toPath
3846-
val stdLibRoot = projectRoot.relativize(managedSources.toPath.normalize())
3847-
val docRootFile = stdLibRoot.resolve("rootdoc.txt")
3848-
3849-
val dottyManagesSources = (`scala3-library-bootstrapped`/Compile/baseDirectory).value
3850-
3851-
val tastyCoreSources = projectRoot.relativize((`tasty-core-bootstrapped`/Compile/scalaSource).value.toPath().normalize())
3852-
3853-
val dottyLibRoot = projectRoot.relativize(dottyManagesSources.toPath.normalize())
3854-
DefaultGenerationConfig.value
3813+
DefaultGenerationSettings.value
38553814
.add(ProjectName("Scala 3"))
38563815
.add(OutputDir(file("scaladoc/output/scala3").getAbsoluteFile.getAbsolutePath))
38573816
.add(Revision("main"))
38583817
.add(ExternalMappings(List(javaExternalMapping)))
3859-
.add(DocRootContent(docRootFile.toString))
3818+
.add(DocRootContent(((`scala-library-bootstrapped` / baseDirectory).value / "src" / "rootdoc.txt").toString))
38603819
.add(CommentSyntax(List(
3861-
s"${dottyLibRoot}=markdown",
3862-
s"${stdLibRoot}=wiki",
3863-
s"${tastyCoreSources}=markdown",
3820+
//s"${dottyLibRoot}=markdown",
3821+
//s"${stdLibRoot}=wiki",
38643822
"wiki"
38653823
)))
38663824
.add(VersionsDictionaryUrl("https://scala-lang.org/api/versions.json"))
38673825
.add(DocumentSyntheticTypes(true))
3868-
.add(SnippetCompiler(List(
3869-
s"$dottyLibRoot/src/scala=compile",
3870-
s"$dottyLibRoot/src/scala/compiletime=compile",
3871-
s"$dottyLibRoot/src/scala/util=compile",
3872-
s"$dottyLibRoot/src/scala/util/control=compile"
3873-
)))
3826+
//.add(SnippetCompiler(List(
3827+
//s"$dottyLibRoot/src/scala=compile",
3828+
//s"$dottyLibRoot/src/scala/compiletime=compile",
3829+
//s"$dottyLibRoot/src/scala/util=compile",
3830+
//s"$dottyLibRoot/src/scala/util/control=compile"
3831+
//)))
38743832
.add(SiteRoot("docs"))
38753833
.add(ApiSubdirectory(true))
3876-
.withTargets(roots)
3834+
.withTargets((`scala-library-bootstrapped` / Compile / products).value.map(_.getAbsolutePath))
38773835
}
38783836

38793837
def stableScala3(version: String) = Def.task {
38803838
val scalaLibrarySrc = s"out/bootstrap/scala2-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
38813839
val dottyLibrarySrc = "library/src"
38823840
Scala3.value
3883-
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
3841+
.add(defaultSourceLinks(version = version))
38843842
.add(ProjectVersion(version))
38853843
.add(SnippetCompiler(
38863844
List(

0 commit comments

Comments
 (0)