Skip to content

Commit 03fcf5c

Browse files
committed
Support Scala 3 on Scala.js
1 parent 891bcb9 commit 03fcf5c

File tree

5 files changed

+17
-33
lines changed

5 files changed

+17
-33
lines changed

build.sc

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ val scalaVersions = "2.11.12" :: "2.12.13" :: "2.13.4" :: "3.0.0-RC1" :: dottyVe
66
val scala2Versions = scalaVersions.filter(_.startsWith("2."))
77

88
val scalaJSVersions = for {
9-
scalaV <- scala2Versions
9+
scalaV <- scalaVersions
1010
scalaJSV <- Seq("0.6.33", "1.4.0")
11+
if scalaV.startsWith("2.") || scalaJSV.startsWith("1.")
1112
} yield (scalaV, scalaJSV)
1213

1314
val scalaNativeVersions = for {
@@ -34,7 +35,7 @@ trait SourcecodeModule extends PublishModule {
3435
)
3536
)
3637
}
37-
trait SourcecodeMainModule extends CrossScalaModule {
38+
abstract class SourcecodeMainModule(crossScalaVersion: String) extends CrossScalaModule {
3839
def millSourcePath = super.millSourcePath / offset
3940

4041
def offset: os.RelPath = os.rel
@@ -55,6 +56,15 @@ trait SourcecodeMainModule extends CrossScalaModule {
5556
)
5657
)
5758
)
59+
60+
override def docJar =
61+
if (crossScalaVersion.startsWith("2")) super.docJar
62+
else T {
63+
val outDir = T.ctx().dest
64+
val javadocDir = outDir / 'javadoc
65+
os.makeDir.all(javadocDir)
66+
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
67+
}
5868
}
5969

6070

@@ -81,27 +91,18 @@ object sourcecode extends Module {
8191
val dottyVersion = sys.props.get("dottyVersion")
8292
object jvm extends Cross[JvmSourcecodeModule](scalaVersions: _*)
8393
class JvmSourcecodeModule(val crossScalaVersion: String)
84-
extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
94+
extends SourcecodeMainModule(crossScalaVersion) with ScalaModule with SourcecodeModule {
8595

8696
object test extends SourcecodeTestModule{
8797
def scalaVersion = crossScalaVersion
8898
def moduleDeps = Seq(JvmSourcecodeModule.this)
8999
val crossScalaVersion = JvmSourcecodeModule.this.crossScalaVersion
90100
}
91-
92-
override def docJar =
93-
if (crossScalaVersion.startsWith("2")) super.docJar
94-
else T {
95-
val outDir = T.ctx().dest
96-
val javadocDir = outDir / 'javadoc
97-
os.makeDir.all(javadocDir)
98-
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
99-
}
100101
}
101102

102103
object js extends Cross[JsSourcecodeModule](scalaJSVersions: _*)
103104
class JsSourcecodeModule(val crossScalaVersion: String, crossJSVersion: String)
104-
extends SourcecodeMainModule with ScalaJSModule with SourcecodeModule {
105+
extends SourcecodeMainModule(crossScalaVersion) with ScalaJSModule with SourcecodeModule {
105106
def offset = os.up
106107

107108
def scalaJSVersion = crossJSVersion
@@ -116,7 +117,7 @@ object sourcecode extends Module {
116117

117118
object native extends Cross[NativeSourcecodeModule](scalaNativeVersions: _*)
118119
class NativeSourcecodeModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
119-
extends SourcecodeMainModule with ScalaNativeModule with SourcecodeModule {
120+
extends SourcecodeMainModule(crossScalaVersion) with ScalaNativeModule with SourcecodeModule {
120121
def offset = os.up
121122

122123
def scalaNativeVersion = crossScalaNativeVersion

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This is a wrapper script, that automatically download mill from GitHub release pages
44
# You can give the required mill version with MILL_VERSION env variable
55
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
6-
DEFAULT_MILL_VERSION=0.9.5
6+
DEFAULT_MILL_VERSION=0.9.5-46-c500ca
77

88
set -e
99

sourcecode/jvm/src/test/scala/sourcecode/TestUtil.scala

Lines changed: 0 additions & 17 deletions
This file was deleted.

sourcecode/native/src/test/scala/sourcecode/TestUtil.scala renamed to sourcecode/test/src-3/sourcecode/TestUtil.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ package sourcecode
22

33
object TestUtil {
44

5-
val isDotty = false
5+
val isDotty = true
66

77
}

0 commit comments

Comments
 (0)