Skip to content

Commit ecfc869

Browse files
committed
update Build.scala and build.sbt to support nonbootstrapped compiler, remove unused methods
1 parent 5dcbb2b commit ecfc869

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ val dist = Build.dist
2929
val `community-build` = Build.`community-build`
3030
val `sbt-community-build` = Build.`sbt-community-build`
3131
val `scala3-presentation-compiler` = Build.`scala3-presentation-compiler`
32+
val `scala3-presentation-compiler-bootstrapped` = Build.`scala3-presentation-compiler-bootstrapped`
3233

3334
val sjsSandbox = Build.sjsSandbox
3435
val sjsJUnitTests = Build.sjsJUnitTests

presentation-compiler/src/main/dotty/tools/pc/utils/MtagsEnrichments.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,4 @@ object MtagsEnrichments extends CommonMtagsEnrichments:
275275
AppliedType(tycon, params.map(_.metalsDealias))
276276
case dealised => dealised
277277

278-
extension (query: WorkspaceSymbolQuery)
279-
def matches(info: SymbolInformation) =
280-
info.kind.isRelevantKind && query.matches(info.symbol)
281-
282-
extension (kind: Kind)
283-
def isRelevantKind: Boolean =
284-
kind match
285-
case Kind.OBJECT | Kind.PACKAGE_OBJECT | Kind.CLASS | Kind.TRAIT |
286-
Kind.INTERFACE | Kind.METHOD | Kind.TYPE =>
287-
true
288-
case _ => false
289-
290278
end MtagsEnrichments

presentation-compiler/test/dotty/tools/pc/utils/TestingWorkspaceSearch.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ class TestingWorkspaceSearch(classpath: Seq[String]):
5959
.map(symbol => semanticSymbolBuilder.symbolName(symbol._1))
6060
.map(
6161
visitor.visitWorkspaceSymbol(Paths.get(""), _, null, null)
62-
) // adjust it
62+
)
6363
}
6464
case _ =>

project/Build.scala

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,21 +1066,30 @@ object Build {
10661066
libraryDependencies += ("org.scala-sbt" %% "zinc-apiinfo" % "1.8.0" % Test).cross(CrossVersion.for3Use2_13)
10671067
)
10681068

1069-
lazy val `scala3-presentation-compiler` = project.in(file("presentation-compiler")).
1070-
dependsOn(dottyCompiler(Bootstrapped)).
1071-
settings(commonBootstrappedSettings).
1072-
settings(
1073-
bspEnabled := true,
1069+
lazy val `scala3-presentation-compiler` = project.in(file("presentation-compiler"))
1070+
.asScala3PresentationCompiler(NonBootstrapped)
1071+
lazy val `scala3-presentation-compiler-bootstrapped` = project.in(file("presentation-compiler"))
1072+
.asScala3PresentationCompiler(Bootstrapped)
1073+
1074+
def scala3PresentationCompiler(implicit mode: Mode): Project = mode match {
1075+
case NonBootstrapped => `scala3-presentation-compiler`
1076+
case Bootstrapped => `scala3-presentation-compiler-bootstrapped`
1077+
}
1078+
1079+
lazy val presentationCompilerSettings = {
1080+
val mtagsVersion = "0.11.13-SNAPSHOT"
1081+
1082+
Seq(
10741083
moduleName := "scala3-presentation-compiler",
10751084
libraryDependencies ++= Seq(
10761085
"org.lz4" % "lz4-java" % "1.8.0",
10771086
"io.get-coursier" % "interface" % "1.0.13",
1078-
"org.scalameta" % "mtags-interfaces" % "0.11.13-SNAPSHOT"
1087+
"org.scalameta" % "mtags-interfaces" % mtagsVersion,
10791088
),
10801089
ivyConfigurations += SourceDeps.hide,
10811090
transitiveClassifiers := Seq("sources"),
10821091
resolvers += Resolver.defaultLocal,
1083-
libraryDependencies += ("org.scalameta" %% "mtags-shared" % "0.11.13-SNAPSHOT" % "sourcedeps")
1092+
libraryDependencies += ("org.scalameta" %% "mtags-shared" % mtagsVersion % "sourcedeps")
10841093
.cross(CrossVersion.for3Use2_13),
10851094
(Compile / sourceGenerators) += Def.task {
10861095
val s = streams.value
@@ -1112,13 +1121,15 @@ object Build {
11121121
} (Set(mtagsSharedSourceJar)).toSeq
11131122
}.taskValue,
11141123
ideTestsDependencyClasspath := {
1115-
Seq((`stdlib-bootstrapped` / Compile / classDirectory).value.toPath.normalize.toFile)
1124+
(`stdlib-bootstrapped` / Compile / products).value
11161125
},
1117-
Compile / buildInfoKeys := Seq[BuildInfoKey](scalaVersion, ideTestsDependencyClasspath),
11181126
Compile / buildInfoPackage := "dotty.tools.pc.util",
1119-
BuildInfoPlugin.buildInfoScopedSettings(Compile),
1127+
Compile / buildInfoKeys := Seq(scalaVersion),
1128+
Test / buildInfoKeys := Seq(scalaVersion, ideTestsDependencyClasspath)
1129+
) ++ BuildInfoPlugin.buildInfoScopedSettings(Compile) ++
1130+
BuildInfoPlugin.buildInfoScopedSettings(Test) ++
11201131
BuildInfoPlugin.buildInfoDefaultSettings
1121-
)
1132+
}
11221133

11231134
lazy val `scala3-language-server` = project.in(file("language-server")).
11241135
dependsOn(dottyCompiler(Bootstrapped)).
@@ -1842,8 +1853,8 @@ object Build {
18421853

18431854
// FIXME: we do not aggregate `bin` because its tests delete jars, thus breaking other tests
18441855
def asDottyRoot(implicit mode: Mode): Project = project.withCommonSettings.
1845-
aggregate(`scala3-interfaces`, dottyLibrary, dottyCompiler, tastyCore, `scala3-sbt-bridge`).
1846-
bootstrappedAggregate(`scala3-language-server`, `scala3-presentation-compiler`, `scala3-staging`,
1856+
aggregate(`scala3-interfaces`, dottyLibrary, dottyCompiler, tastyCore, `scala3-sbt-bridge`, scala3PresentationCompiler).
1857+
bootstrappedAggregate(`scala3-language-server`, `scala3-staging`,
18471858
`scala3-tasty-inspector`, `scala3-library-bootstrappedJS`, scaladoc).
18481859
dependsOn(tastyCore).
18491860
dependsOn(dottyCompiler).
@@ -1918,6 +1929,10 @@ object Build {
19181929
settings(commonBenchmarkSettings).
19191930
enablePlugins(JmhPlugin)
19201931

1932+
def asScala3PresentationCompiler(implicit mode: Mode): Project = project.withCommonSettings.
1933+
dependsOn(dottyCompiler).
1934+
settings(presentationCompilerSettings)
1935+
19211936
def asDist(implicit mode: Mode): Project = project.
19221937
enablePlugins(PackPlugin).
19231938
withCommonSettings.

0 commit comments

Comments
 (0)