Skip to content

Commit 71c26bb

Browse files
authored
Scala-Native 0.5.0 support (#154)
This required a Mill version upgrade to 0.11.x, which involved cleaning up a lot of now-unnecessary boilerplate in the `build.sc`. Same version changes as elsewhere: drop 2.11.x/3.1.x/3.2.x support, add Scala-Native 0.5.0
1 parent 99c30e1 commit 71c26bb

File tree

4 files changed

+31
-83
lines changed

4 files changed

+31
-83
lines changed

.github/workflows/actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
distribution: 'temurin'
2424
java-version: ${{ matrix.java }}
2525
- name: Run tests
26-
run: ./mill -i all __.publishArtifacts __.test
26+
run: ./mill -i __.publishArtifacts + __.test.run
2727

2828
check-binary-compatibility:
2929
runs-on: ubuntu-latest

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.12
1+
0.11.7-29-f2e220

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ in its `.toString` method.
644644
Version History
645645
===============
646646

647+
master
648+
------
649+
650+
* Support for Scala-Native 0.5.0
651+
* Minimum version of Scala 2 raised to 2.12.x
652+
* Minimum version of Scala 3 raised to 3.3.1
653+
647654
0.3.1
648655
-----
649656

build.sc

Lines changed: 22 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@ import $ivy.`com.github.lolgab::mill-mima::0.1.0`
44
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
55
import de.tobiasroeser.mill.vcs.version.VcsVersion
66
import com.github.lolgab.mill.mima._
7-
import mill.scalalib.api.Util.isScala3
7+
import mill.scalalib.api.ZincWorkerUtil.isScala3
88

99
val dottyCommunityBuildVersion = sys.props.get("dottyVersion").toList
1010

1111
val scalaVersions =
12-
"2.11.12" :: "2.12.16" :: "2.13.8" :: "3.1.3" :: dottyCommunityBuildVersion
13-
14-
val scalaJSVersions = scalaVersions.map((_, "1.10.1"))
15-
val scalaNativeVersions = scalaVersions.map((_, "0.4.5"))
12+
"2.12.16" :: "2.13.8" :: "3.3.1" :: dottyCommunityBuildVersion
1613

1714
trait MimaCheck extends Mima {
1815
def mimaPreviousVersions = Seq("0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.3.0", "0.3.1")
@@ -41,98 +38,42 @@ trait SourcecodeModule extends PublishModule with MimaCheck {
4138
)
4239
)
4340
}
44-
trait SourcecodeMainModule extends CrossScalaModule {
45-
def millSourcePath = super.millSourcePath / offset
46-
47-
def offset: os.RelPath = os.rel
48-
41+
trait SourcecodeMainModule extends CrossScalaModule with PlatformScalaModule {
4942
def compileIvyDeps =
5043
if (crossScalaVersion.startsWith("2")) Agg(
5144
ivy"org.scala-lang:scala-reflect:${crossScalaVersion}",
5245
ivy"org.scala-lang:scala-compiler:${crossScalaVersion}"
5346
)
5447
else Agg.empty[Dep]
55-
56-
def sources = T.sources(
57-
super.sources()
58-
.flatMap(source =>
59-
Seq(
60-
PathRef(source.path / os.up / source.path.last),
61-
PathRef(source.path / os.up / os.up / source.path.last)
62-
)
63-
)
64-
)
6548
}
6649

50+
object sourcecode extends Module {
51+
object jvm extends Cross[JvmSourcecodeModule](scalaVersions)
52+
trait JvmSourcecodeModule extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
6753

68-
trait SourcecodeTestModule extends ScalaModule {
69-
def crossScalaVersion: String
70-
71-
def offset: os.RelPath = os.rel
72-
def millSourcePath = super.millSourcePath / os.up
73-
74-
def sources = T.sources(
75-
super.sources()
76-
.++(CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" ))
77-
.flatMap(source =>
78-
Seq(
79-
PathRef(source.path / os.up / "test" / source.path.last),
80-
PathRef(source.path / os.up / os.up / "test" / source.path.last)
81-
)
82-
)
83-
.distinct
84-
)
85-
}
54+
object test extends ScalaTests{
8655

87-
object sourcecode extends Module {
88-
object jvm extends Cross[JvmSourcecodeModule](scalaVersions: _*)
89-
class JvmSourcecodeModule(val crossScalaVersion: String)
90-
extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
91-
92-
object test extends SourcecodeTestModule{
93-
def scalaVersion = crossScalaVersion
94-
def moduleDeps = Seq(JvmSourcecodeModule.this)
95-
val crossScalaVersion = JvmSourcecodeModule.this.crossScalaVersion
56+
def testFramework = ""
9657
}
9758
}
9859

99-
object js extends Cross[JsSourcecodeModule](scalaJSVersions: _*)
100-
class JsSourcecodeModule(val crossScalaVersion: String, crossJSVersion: String)
101-
extends SourcecodeMainModule with ScalaJSModule with SourcecodeModule {
102-
def offset = os.up
103-
104-
def scalaJSVersion = crossJSVersion
105-
object test extends SourcecodeTestModule with ScalaJSModule{
106-
def scalaVersion = crossScalaVersion
107-
def scalaJSVersion = crossJSVersion
108-
def offset = os.up
109-
def moduleDeps = Seq(JsSourcecodeModule.this)
110-
val crossScalaVersion = JsSourcecodeModule.this.crossScalaVersion
60+
object js extends Cross[JsSourcecodeModule](scalaVersions)
61+
trait JsSourcecodeModule extends SourcecodeMainModule with ScalaJSModule with SourcecodeModule {
62+
63+
def scalaJSVersion = "1.12.0"
64+
object test extends ScalaJSTests{
65+
def testFramework = ""
11166
}
11267
}
11368

114-
object native extends Cross[NativeSourcecodeModule](scalaNativeVersions: _*)
115-
class NativeSourcecodeModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
116-
extends SourcecodeMainModule with ScalaNativeModule with SourcecodeModule {
117-
def offset = os.up
118-
119-
def scalaNativeVersion = crossScalaNativeVersion
120-
121-
override def docJar =
122-
if (crossScalaVersion.startsWith("2.")) super.docJar
123-
else T {
124-
val outDir = T.ctx().dest
125-
val javadocDir = outDir / "javadoc"
126-
os.makeDir.all(javadocDir)
127-
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
128-
}
129-
130-
object test extends SourcecodeTestModule with ScalaNativeModule{
131-
def scalaVersion = crossScalaVersion
132-
def scalaNativeVersion = crossScalaNativeVersion
133-
def offset = os.up
134-
def moduleDeps = Seq(NativeSourcecodeModule.this)
135-
val crossScalaVersion = NativeSourcecodeModule.this.crossScalaVersion
69+
object native extends Cross[NativeSourcecodeModule](scalaVersions)
70+
trait NativeSourcecodeModule extends SourcecodeMainModule with ScalaNativeModule with SourcecodeModule {
71+
72+
def scalaNativeVersion = "0.5.0"
73+
object test extends ScalaNativeTests{
74+
// stub to make use of test plumbing but not running a test suite
75+
def mainClass = Some("sourcecode.Main")
76+
def testFramework = ""
13677
}
13778
}
13879
}

0 commit comments

Comments
 (0)