Skip to content

Commit 6206f3c

Browse files
authored
Update to Mill 1.0.0 (#396)
1 parent 6edd90e commit 6206f3c

File tree

3 files changed

+36
-50
lines changed

3 files changed

+36
-50
lines changed

.mill-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.12.14-native
1+
1.0.0-RC1

build.mill

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
//| mvnDeps:
2+
//| - com.github.lolgab::mill-mima_mill1.0.0-RC1:0.2.0-M1
13
package build
2-
// plugins
3-
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
4-
import $ivy.`com.github.lolgab::mill-mima::0.1.1`
54

65
// imports
76
import mill._, scalalib._, scalanativelib._, publish._
8-
import mill.scalalib.api.ZincWorkerUtil
97
import com.github.lolgab.mill.mima._
10-
import de.tobiasroeser.mill.vcs.version.VcsVersion
8+
import mill.main.VcsVersion
119

1210
val communityBuildDottyVersion = sys.props.get("dottyVersion").toList
1311

@@ -20,40 +18,29 @@ val scalaVersions = Seq(
2018
) ++ communityBuildDottyVersion
2119

2220
object Deps {
23-
val acyclic = ivy"com.lihaoyi:::acyclic:0.3.18"
24-
val jna = ivy"net.java.dev.jna:jna:5.15.0"
25-
val geny = ivy"com.lihaoyi::geny::1.1.1"
26-
val ant = ivy"org.apache.ant:ant:1.10.15"
27-
val sourcecode = ivy"com.lihaoyi::sourcecode::0.4.2"
28-
val utest = ivy"com.lihaoyi::utest::0.8.4"
29-
val expecty = ivy"com.eed3si9n.expecty::expecty::0.16.0"
30-
def scalaReflect(scalaVersion: String) = ivy"org.scala-lang:scala-reflect:$scalaVersion"
31-
def scalaLibrary(version: String) = ivy"org.scala-lang:scala-library:${version}"
21+
val acyclic = mvn"com.lihaoyi:::acyclic:0.3.18"
22+
val jna = mvn"net.java.dev.jna:jna:5.15.0"
23+
val geny = mvn"com.lihaoyi::geny::1.1.1"
24+
val ant = mvn"org.apache.ant:ant:1.10.15"
25+
val sourcecode = mvn"com.lihaoyi::sourcecode::0.4.2"
26+
val utest = mvn"com.lihaoyi::utest::0.8.4"
27+
val expecty = mvn"com.eed3si9n.expecty::expecty::0.16.0"
28+
def scalaReflect(scalaVersion: String) = mvn"org.scala-lang:scala-reflect:$scalaVersion"
29+
def scalaLibrary(version: String) = mvn"org.scala-lang:scala-library:${version}"
3230
}
3331

3432
trait AcyclicModule extends ScalaModule {
35-
def acyclicDep: T[Agg[Dep]] = T {
36-
Agg.from(Option.when(!ZincWorkerUtil.isScala3(scalaVersion()))(Deps.acyclic))
33+
def acyclicDep: T[Seq[Dep]] = Task {
34+
Option.when(!scalaVersion().startsWith("3."))(Deps.acyclic).toSeq
3735
}
38-
def acyclicOptions: T[Seq[String]] = T {
39-
Option.when(!ZincWorkerUtil.isScala3(scalaVersion()))("-P:acyclic:force").toSeq
36+
def acyclicOptions: T[Seq[String]] = Task {
37+
Option.when(!scalaVersion().startsWith("3."))("-P:acyclic:force").toSeq
4038
}
41-
def compileIvyDeps = acyclicDep
42-
def scalacPluginIvyDeps = acyclicDep
39+
def compileMvnDeps = acyclicDep
40+
def scalacPluginMvnDeps = acyclicDep
4341
def scalacOptions = super.scalacOptions() ++ acyclicOptions()
4442
}
4543

46-
trait SafeDeps extends ScalaModule {
47-
def mapDependencies: Task[coursier.Dependency => coursier.Dependency] = T.task {
48-
val sd = Deps.scalaLibrary(scala213Version)
49-
super.mapDependencies().andThen { d =>
50-
// enforce up-to-date Scala 2.13.x version
51-
if (d.module == sd.dep.module && d.version.startsWith("2.13.")) sd.dep
52-
else d
53-
}
54-
}
55-
}
56-
5744
trait MiMaChecks extends Mima {
5845
def mimaPreviousVersions =
5946
Seq(
@@ -100,11 +87,10 @@ trait OsLibModule
10087
extends OsLibPublishModule
10188
with CrossScalaModule
10289
with AcyclicModule
103-
with SafeDeps
10490
with PlatformScalaModule { outer =>
10591

106-
trait OsLibTestModule extends ScalaModule with TestModule.Utest with SafeDeps {
107-
def ivyDeps = Agg(Deps.utest, Deps.sourcecode)
92+
trait OsLibTestModule extends ScalaModule with TestModule.Utest {
93+
def mvnDeps = Seq(Deps.utest, Deps.sourcecode)
10894
// we check the textual output of system commands and expect it in english
10995
def forkEnv = super.forkEnv() ++ Map(
11096
"LC_ALL" -> "C",
@@ -115,12 +101,12 @@ trait OsLibModule
115101
}
116102

117103
trait OsModule extends OsLibModule { outer =>
118-
def ivyDeps = Agg(Deps.geny)
119-
override def compileIvyDeps = T {
120-
val scalaReflectOpt = Option.when(!ZincWorkerUtil.isDottyOrScala3(scalaVersion()))(
104+
def mvnDeps = Seq(Deps.geny)
105+
override def compileMvnDeps = Task {
106+
val scalaReflectOpt = Option.when(!scalaVersion().startsWith("3."))(
121107
Deps.scalaReflect(scalaVersion())
122108
)
123-
super.compileIvyDeps() ++ scalaReflectOpt
109+
super.compileMvnDeps() ++ scalaReflectOpt
124110
}
125111

126112
def artifactName = "os-lib"
@@ -131,8 +117,8 @@ trait OsModule extends OsLibModule { outer =>
131117
s".*geny.*::scaladoc3::https://javadoc.io/doc/com.lihaoyi/geny_3/${Deps.geny.dep.version}/"
132118
).mkString(",")
133119

134-
def conditionalScalaDocOptions: T[Seq[String]] = T {
135-
if (ZincWorkerUtil.isDottyOrScala3(scalaVersion()))
120+
def conditionalScalaDocOptions: T[Seq[String]] = Task {
121+
if (scalaVersion().startsWith("3."))
136122
Seq(
137123
s"-external-mappings:${scalaDocExternalMappings}"
138124
)
@@ -141,7 +127,7 @@ trait OsModule extends OsLibModule { outer =>
141127

142128
def scalaDocOptions = super.scalaDocOptions() ++ conditionalScalaDocOptions()
143129

144-
def generatedSources = T {
130+
def generatedSources = Task {
145131
val conversions = for (i <- Range.inclusive(2, 22)) yield {
146132
val ts = Range.inclusive(1, i).map(n => s"T$n").mkString(", ")
147133
val fs = Range.inclusive(1, i).map(n => s"f$n: T$n => R").mkString(", ")
@@ -154,7 +140,7 @@ trait OsModule extends OsLibModule { outer =>
154140
|""".stripMargin
155141
}
156142
_root_.os.write(
157-
T.dest / "os" / "GeneratedTupleConversions.scala",
143+
Task.dest / "os" / "GeneratedTupleConversions.scala",
158144
s"""package os
159145
|trait GeneratedTupleConversions[R]{
160146
| protected def flatten(vs: R*): R
@@ -164,7 +150,7 @@ trait OsModule extends OsLibModule { outer =>
164150
|""".stripMargin,
165151
createFolders = true
166152
)
167-
Seq(PathRef(T.dest))
153+
Seq(PathRef(Task.dest))
168154
}
169155
}
170156

@@ -175,7 +161,7 @@ object os extends Module {
175161
def moduleDeps = super.moduleDeps ++ Seq(os.zip)
176162

177163
object test extends ScalaTests with OsLibTestModule {
178-
override def ivyDeps = T { super.ivyDeps() ++ Agg(Deps.expecty) }
164+
override def mvnDeps = Task { super.mvnDeps() ++ Seq(Deps.expecty) }
179165

180166
// we check the textual output of system commands and expect it in english
181167
def forkEnv = super.forkEnv() ++ Map(
@@ -229,9 +215,9 @@ object os extends Module {
229215
* To avoid classpath conflicts, the dependency is shaded and compiled from source. Only the `org.apache.tools.zip`
230216
* package, not the entire Ant codebase, is needed. This only adds < 100kb to Os-Lib jar size.
231217
*/
232-
def generatedSources = T {
218+
def generatedSources = Task {
233219
val pkg = "os.shaded_org_apache_tools_zip"
234-
val zipSrc = T.dest / "os/shaded_org_apache_tools_zip"
220+
val zipSrc = Task.dest / "os/shaded_org_apache_tools_zip"
235221
_root_.os.makeDir.all(zipSrc)
236222

237223
// Move from "package org.apache.tools.zip" to "package os.shaded_org_apache_tools_zip"
@@ -244,7 +230,7 @@ object os extends Module {
244230
_root_.os.write(zipSrc / p.last, content)
245231
}
246232

247-
Seq(PathRef(T.dest))
233+
Seq(PathRef(Task.dest))
248234
}
249235
}
250236

@@ -262,7 +248,7 @@ object os extends Module {
262248
trait WatchJvmModule extends OsLibModule {
263249
def artifactName = "os-lib-watch"
264250
def moduleDeps = super.moduleDeps ++ Seq(os.jvm())
265-
def ivyDeps = Agg(Deps.jna)
251+
def mvnDeps = Seq(Deps.jna)
266252
object test extends ScalaTests with OsLibTestModule {
267253
def moduleDeps = super.moduleDeps ++ Seq(os.jvm().test)
268254

mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
set -e
3434

3535
if [ -z "${DEFAULT_MILL_VERSION}" ] ; then
36-
DEFAULT_MILL_VERSION="0.12.10"
36+
DEFAULT_MILL_VERSION=1.0.0-RC1
3737
fi
3838

3939

0 commit comments

Comments
 (0)