Skip to content

Commit a85e4ac

Browse files
authored
Merge pull request #63 from scala/backport-lts-3.3-21842
Backport "improvement: Remove workaround for Bloop and update docs" to 3.3 LTS
2 parents c491749 + befd3cf commit a85e4ac

File tree

6 files changed

+156
-174
lines changed

6 files changed

+156
-174
lines changed

compiler/src/dotty/tools/dotc/config/Settings.scala

+7-4
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,11 @@ object Settings:
293293
def BooleanSetting(name: String, descr: String, initialValue: Boolean = false, aliases: List[String] = Nil): Setting[Boolean] =
294294
publish(Setting(name, descr, initialValue, aliases = aliases))
295295

296-
def StringSetting(name: String, helpArg: String, descr: String, default: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[String] =
297-
publish(Setting(descr, default, helpArg, aliases = aliases, deprecation = deprecation, depends = depends))
296+
def StringSetting(name: String, helpArg: String, descr: String, default: String, aliases: List[String] = Nil, depends: SettingDependencies = Nil): Setting[String] =
297+
publish(Setting(name, descr, default, helpArg, aliases = aliases, depends = depends))
298+
299+
def ChoiceSetting(name: String, helpArg: String, descr: String, choices: List[String], default: String, aliases: List[String] = Nil): Setting[String] =
300+
publish(Setting(name, descr, default, helpArg, Some(choices), aliases = aliases))
298301

299302
def MultiChoiceSetting(name: String, helpArg: String, descr: String, choices: List[String], default: List[String], aliases: List[String] = Nil): Setting[List[String]] =
300303
publish(Setting(name, descr, default, helpArg, Some(choices), aliases = aliases))
@@ -320,8 +323,8 @@ object Settings:
320323
def PathSetting(name: String, descr: String, default: String, aliases: List[String] = Nil): Setting[String] =
321324
publish(Setting(name, descr, default, aliases = aliases))
322325

323-
def PhasesSetting(name: String, descr: String, default: String = "", aliases: List[String] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[List[String]] =
324-
publish(Setting(descr, if (default.isEmpty) Nil else List(default), aliases = aliases, deprecation = deprecation, depends = depends))
326+
def PhasesSetting(name: String, descr: String, default: String = "", aliases: List[String] = Nil, depends: SettingDependencies = Nil): Setting[List[String]] =
327+
publish(Setting(name, descr, if (default.isEmpty) Nil else List(default), aliases = aliases, depends = depends))
325328

326329
def PrefixSetting(name: String, pre: String, descr: String): Setting[List[String]] =
327330
publish(Setting(name, descr, Nil, prefix = pre))

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ abstract class SymbolLoader extends LazyType { self =>
337337
val sym = root.symbol
338338
def associatedFile = root.symbol.associatedFile match
339339
case file: AbstractFile => file
340-
case _ => NoAbstractFile
340+
case null => NoAbstractFile
341341
ctx.profiler.onCompletion(sym, associatedFile)(body)
342342
}
343343

docs/_docs/contributing/setting-up-your-ide.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ layout: doc-page
33
title: Setting up your IDE
44
---
55

6-
You can use either Metals with your favorite editor (VS Code, Neovim, Sublime)
7-
or [IntelliJ IDEA for
8-
Scala](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html)
6+
You can use either Metals with your favorite editor or
7+
[IntelliJ IDEA for Scala](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html)
98
to work on the Scala 3 codebase. There are however a few additional
109
considerations to take into account.
1110

1211
## Bootstrapping Projects
1312

14-
The sbt build for dotty implements bootstrapping within the same build, so each component has
15-
two projects:
13+
The sbt build for dotty implements bootstrapping within the same build, so each
14+
component has two projects:
1615

1716
```
1817
sbt:scala3> projects
@@ -32,23 +31,24 @@ Normally this is fine, but if you're working on certain modules like `scaladoc`
3231
you'll actually want these modules exported. In order to achieve this you'll
3332
want to make sure you do two things:
3433

35-
1. You'll want to find and change the following under
36-
`commonBootstrappedSettings` which is found in the
37-
[`Build.scala`](https://github.com/lampepfl/dotty/blob/main/project/Build.scala)
38-
file.
34+
1. You'll want to find and change the following above
35+
`commonBootstrappedSettings` which is found in the
36+
[`Build.scala`](https://github.com/scala/scala3/blob/main/project/Build.scala)
37+
file.
3938

4039
```diff
4140

42-
- bspEnabled := false,
43-
+ bspEnabled := true,
41+
- val enableBspAllProjects = false,
42+
+ val enableBspAllProjects = true,
4443
```
4544

46-
2. Set `sbt` as your build server instead of the default, Bloop. You can achieve
47-
this with the `Metals: Switch Build Server` command and then choosing sbt. In
48-
VSCode, this looks like this:
45+
2. Run `sbt publishLocal` to get the needed presentation compiler jars.
4946

50-
![bsp-switch](https://user-images.githubusercontent.com/777748/241986423-0724ae74-0ebd-42ef-a1b7-4d17678992b4.png)
47+
By default Metals uses Bloop build server, however you can also use sbt
48+
directly. You can achieve this with the `Metals: Switch Build Server` command
49+
and then choosing sbt. In VSCode, this looks like this:
5150

51+
![bsp-switch](https://user-images.githubusercontent.com/777748/241986423-0724ae74-0ebd-42ef-a1b7-4d17678992b4.png)
5252

5353
### IntelliJ
5454

project/Build.scala

+13-3
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,20 @@ object Build {
364364
) ++ extMap
365365
}
366366

367+
/* These projects are irrelevant from IDE point of view and do not compile with Bloop*/
368+
val fullyDisabledProjects = Set(
369+
"scala2-library-cc",
370+
"scala2-library-bootstrapped",
371+
"scala2-library-cc-tasty",
372+
"scala2-library-tasty"
373+
)
374+
375+
val enableBspAllProjects = false
376+
367377
// Settings used when compiling dotty with a non-bootstrapped dotty
368-
lazy val commonBootstrappedSettings = commonDottySettings ++ NoBloopExport.settings ++ Seq(
369-
// To enable support of scaladoc and language-server projects you need to change this to true and use sbt as your build server
370-
bspEnabled := false,
378+
lazy val commonBootstrappedSettings = commonDottySettings ++ Seq(
379+
// To enable support of scaladoc and language-server projects you need to change this to true
380+
bspEnabled := { if(fullyDisabledProjects(name.value)) false else enableBspAllProjects },
371381
(Compile / unmanagedSourceDirectories) += baseDirectory.value / "src-bootstrapped",
372382

373383
version := dottyVersion,

project/NoBloopExport.scala

-31
This file was deleted.

0 commit comments

Comments
 (0)