Skip to content

Commit 8b88918

Browse files
authored
Merge pull request #11758 from adpi2/sbt-dotty
Make sbt-dotty compatible with sbt 1.5
2 parents a9e74e7 + 3341f32 commit 8b88918

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,12 @@ jobs:
282282
- name: Add SBT proxy repositories
283283
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
284284

285-
- name: Test
285+
- name: Test sbt 1.4.x
286286
run: ./project/scripts/sbt "sbt-dotty/scripted; sbt-community-build/scripted"
287287

288+
- name: Test sbt 1.5.x
289+
run: ./project/scripts/sbt "set \`sbt-dotty\`/scriptedSbt := \"1.5.0-RC1\"; sbt-dotty/scripted sbt-dotty/*"
290+
288291
test_java8:
289292
runs-on: [self-hosted, Linux]
290293
container:
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
scalaVersion := sys.props("plugin.scalaVersion")
22

3-
lazy val assertUsingScaladoc = taskKey[Unit]("")
4-
5-
assertUsingScaladoc := {
3+
TaskKey[Unit]("assertUsingScaladoc") := {
64
assert(useScaladoc.value)
75
}
6+
7+
TaskKey[Unit]("checkScaladocOptions") := {
8+
val options = (Compile / doc / scalacOptions).value
9+
assert(options.count(_ == "-project") == 1)
10+
}
11+
12+
TaskKey[Unit]("checkHtmlFiles") := {
13+
val helloHtml = (Compile / doc / target).value / "api" / "hello.html"
14+
assert(helloHtml.exists)
15+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
> assertUsingScaladoc
2+
> checkScaladocOptions
23
> doc
3-
4+
> checkHtmlFiles

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,10 @@ object DottyPlugin extends AutoPlugin {
464464
else Def.task { originalSources }
465465
}.value,
466466
scalacOptions ++= {
467-
if (isDotty.value) {
467+
// From sbt 1.5 scaladoc is natively supported, and so the scalacOptions are already set.
468+
val isSbt15 = VersionNumber(sbtVersion.value)
469+
.matchesSemVer(SemanticSelector(">=1.5.0-M1"))
470+
if (isDotty.value && !isSbt15) {
468471
val projectName =
469472
if (configuration.value == Compile)
470473
name.value

0 commit comments

Comments
 (0)