Skip to content

Use sbt makeScalaInstance #12771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions project/Bootstrap.scala

This file was deleted.

31 changes: 18 additions & 13 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,14 @@ object Build {
val scala3Compiler = (`scala3-compiler` / Compile / packageBin).value

val libraryJars = Array(scala3Library) ++ externalLibraryDeps
val compilerJars = Array(tastyCore, scala3Interfaces, scala3Compiler) ++ (externalCompilerDeps -- externalLibraryDeps)
val compilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ (externalCompilerDeps -- externalLibraryDeps)

// should be replaced by sbt.Defaults.makeScalaInstance when released
// See https://github.com/sbt/sbt/pull/6480
Bootstrap.makeScalaInstance(
state.value,
Defaults.makeScalaInstance(
scalaVersion.value,
libraryJars = libraryJars,
compilerJars = compilerJars,
allCompilerJars = compilerJars,
allDocJars = Seq.empty,
state.value,
scalaInstanceTopLoader.value
)
},
Expand All @@ -404,16 +403,22 @@ object Build {
// in the `scalaInstance` of the `doc` task which allows us to run
// `scala3-library-bootstrapped/doc` for example.
doc / scalaInstance := {
val externalCompilerDeps = (`scala3-compiler` / Compile / externalDependencyClasspath).value.map(_.data).toSet
val externalScaladocDeps = (LocalProject("scaladoc") / Compile / externalDependencyClasspath).value.map(_.data).toSet
val externalDeps = (LocalProject("scaladoc") / Compile / externalDependencyClasspath).value.map(_.data)
val scalaDoc = (LocalProject("scaladoc") / Compile / packageBin).value
val docJars = Array(scalaDoc) ++ (externalScaladocDeps -- externalCompilerDeps)

Bootstrap.makeDocScalaInstance(
val docJars = Array(scalaDoc) ++ externalDeps

val base = scalaInstance.value
val docScalaInstance = Defaults.makeScalaInstance(
version = base.version,
libraryJars = base.libraryJars,
allCompilerJars = base.compilerJars,
allDocJars = docJars,
state.value,
scalaInstance.value,
docJars
scalaInstanceTopLoader.value
)
// assert that sbt reuses the same compiler class loader
assert(docScalaInstance.loaderCompilerOnly == base.loaderCompilerOnly)
docScalaInstance
},
Compile / doc / scalacOptions ++= scalacOptionsDocSettings
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.2
sbt.version=1.5.3
2 changes: 1 addition & 1 deletion project/project/build.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Some dependencies are shared between the regular build and the meta-build
sources in Compile += baseDirectory.value / "../Dependencies.scala"
Compile / sources += baseDirectory.value / "../Dependencies.scala"