Skip to content

Commit aaf820e

Browse files
authored
Merge branch 'main' into consolidate-jvm-subprocess-and-inprocess-functions
2 parents 15334e2 + 1c100f7 commit aaf820e

File tree

124 files changed

+1276
-926
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1276
-926
lines changed

build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ object Deps {
158158
val junitInterface = ivy"com.github.sbt:junit-interface:0.13.3"
159159
val commonsIo = ivy"commons-io:commons-io:2.18.0"
160160
val log4j2Core = ivy"org.apache.logging.log4j:log4j-core:2.24.3"
161-
val osLib = ivy"com.lihaoyi::os-lib:0.11.4-M5"
161+
val osLib = ivy"com.lihaoyi::os-lib:0.11.4-M6"
162162
val pprint = ivy"com.lihaoyi::pprint:0.9.0"
163163
val mainargs = ivy"com.lihaoyi::mainargs:0.7.6"
164164
val millModuledefsVersion = "0.11.3-M3"
@@ -398,7 +398,7 @@ trait MillJavaModule extends JavaModule {
398398

399399
def writeLocalTestOverrides = Task.Anon {
400400
for ((k, v) <- testTransitiveDeps()) {
401-
os.write(Task.dest / "mill" / "local-test-overrides" / k, v, createFolders = true)
401+
os.write(Task.dest / "mill/local-test-overrides" / k, v, createFolders = true)
402402
}
403403
Seq(PathRef(Task.dest))
404404
}

contrib/playlib/src/mill/playlib/Layout.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import mill.scalalib._
55

66
private[playlib] trait Layout extends JavaModule {
77

8-
def conf = Task.Sources { millSourcePath / "conf" }
9-
def app = Task.Sources { millSourcePath / "app" }
8+
def conf = Task.Sources { "conf" }
9+
def app = Task.Sources { "app" }
1010

1111
override def sources = Task { app() }
1212
override def resources = Task { conf() }

contrib/playlib/src/mill/playlib/RouterModule.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import mill.{Agg, T, Task}
99

1010
trait RouterModule extends ScalaModule with Version {
1111

12-
def routes: T[Seq[PathRef]] = Task.Sources { millSourcePath / "routes" }
12+
def routes: T[Seq[PathRef]] = Task.Sources { "routes" }
1313

1414
def routeFiles = Task {
1515
val paths = routes().flatMap(file => os.walk(file.path))

contrib/playlib/src/mill/playlib/Static.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait Static extends ScalaModule {
2525
/**
2626
* Directories to include assets from
2727
*/
28-
def assetSources = Task.Sources { millSourcePath / assetsPath() }
28+
def assetSources = Task.Sources { os.sub / assetsPath() }
2929

3030
/*
3131
Collected static assets for the project

contrib/versionfile/src/mill/contrib/versionfile/VersionFileModule.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import mill._
55
trait VersionFileModule extends Module {
66

77
/** The file containing the current version. */
8-
def versionFile: T[PathRef] = Task.Source(millSourcePath / "version")
8+
def versionFile: T[PathRef] = Task.Source("version")
99

1010
/** The current version. */
1111
def currentVersion: T[Version] = Task { Version.of(os.read(versionFile().path).trim) }

dist/package.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ trait InstallModule extends build.MillPublishJavaModule {
4141
def installLocalCache() = Task.Command {
4242
val path = installLocalTask(
4343
Task.Anon(
44-
(os.home / ".cache" / "mill" / "download" / (build.millVersion() + batExt)).toString()
44+
(os.home / ".cache/mill/download" / (build.millVersion() + batExt)).toString()
4545
)
4646
)()
4747
Task.log.outputStream.println(path.toString())

docs/modules/ROOT/nav.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@
102102
** xref:extending/meta-build.adoc[]
103103
** xref:extending/example-typescript-support.adoc[]
104104
** xref:extending/example-python-support.adoc[]
105+
* xref:large/large.adoc[]
106+
** xref:large/selective-execution.adoc[]
107+
** xref:large/multi-file-builds.adoc[]
108+
** xref:large/multi-language-builds.adoc[]
105109
// This section focuses on diving into deeper, more advanced topics for Mill.
106110
// These are things that most Mill developers would not encounter day to day,
107111
// but people developing Mill plugins or working on particularly large or
108112
// sophisticated Mill builds will need to understand.
109-
* xref:large/large.adoc[]
110-
** xref:large/selective-execution.adoc[]
111-
** xref:large/multi-file-builds.adoc[]
112-
113113
* Mill In Depth
114114
** xref:depth/sandboxing.adoc[]
115115
** xref:depth/execution-model.adoc[]

docs/modules/ROOT/pages/comparisons/maven.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ import $ivy.`ant:ant-optional:1.5.3-1`
391391

392392
object common extends NettyModule{
393393
...
394-
def script = Task.Source(millSourcePath / "src" / "main" / "script")
394+
def script = Task.Source("src" / "main" / "script")
395395
def generatedSources0 = Task {
396396
val shell = new groovy.lang.GroovyShell()
397397
val context = new java.util.HashMap[String, Object]
@@ -520,8 +520,8 @@ with the `make` command essentially being a bash script wrapped in layers of XML
520520
In contrast, the Mill configuration for this logic is as follows:
521521

522522
```scala
523-
def makefile = Task.Source(millSourcePath / "Makefile")
524-
def cSources = Task.Source(millSourcePath / "src" / "main" / "c")
523+
def makefile = Task.Source("Makefile")
524+
def cSources = Task.Source("src" / "main" / "c")
525525
def cHeaders = Task {
526526
for(p <- os.walk(cSources().path) if p.ext == "h"){
527527
os.copy(p, Task.dest / p.relativeTo(cSources().path), createFolders = true)

docs/modules/ROOT/pages/comparisons/unique.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ them into classfiles, and then the `jar` executable to package them together int
176176
```scala
177177
def mainClass: T[Option[String]] = Some("foo.Foo")
178178

179-
def sources = Task.Source(millSourcePath / "src")
180-
def resources = Task.Source(millSourcePath / "resources")
179+
def sources = Task.Source("src")
180+
def resources = Task.Source("resources")
181181

182182
def compile = Task {
183183
val allSources = os.walk(sources().path)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
= Multi-Language Builds
2+
:page-aliases: Multi_Language_Builds.adoc
3+
4+
include::partial$example/large/multi/14-multi-language.adoc[]

docs/package.mill

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,16 @@ object `package` extends RootModule {
6868
envArgs = Map("CI" -> "true"),
6969
workingDir = workDir
7070
)
71-
PathRef(workDir / "build" / "site")
71+
PathRef(workDir / "build/site")
7272
}
7373

7474
def source0 = Task.Source(millSourcePath)
7575
def projectChangelog = Task.Source(Task.workspace / "changelog.adoc")
7676
def source = Task {
7777
os.copy(source0().path, Task.dest, mergeFolders = true)
7878

79-
val pagesWd = Task.dest / "modules" / "ROOT" / "pages"
80-
val partialsWd = Task.dest / "modules" / "ROOT" / "partials"
79+
val pagesWd = Task.dest / "modules/ROOT/pages"
80+
val partialsWd = Task.dest / "modules/ROOT/partials"
8181

8282
os.copy(projectChangelog().path, partialsWd / "project-changelog.adoc", createFolders = true)
8383

@@ -291,7 +291,7 @@ object `package` extends RootModule {
291291
val checkout = Task.dest / displayVersion
292292
os.proc("git", "clone", Task.workspace / ".git", checkout).call(stdout = os.Inherit)
293293
os.proc("git", "checkout", millLastTag).call(cwd = checkout, stdout = os.Inherit)
294-
val outputFolder = checkout / "out" / "docs" / "source.dest"
294+
val outputFolder = checkout / "out/docs/source.dest"
295295
os.proc("./mill", "-i", "docs.source").call(cwd = checkout, stdout = os.Inherit)
296296
expandDiagramsInDirectoryAdocFile(
297297
outputFolder,
@@ -367,7 +367,7 @@ object `package` extends RootModule {
367367
// only copy the "api" sub-dir; api docs contains a top-level index.html with we don't want
368368
val unidocSrc = if (authorMode) site.unidocLocal().path else site.unidocSite().path
369369
Task.log.errorStream.println(s"Copying API docs from ${unidocSrc} ...")
370-
os.copy(unidocSrc, siteDir / "api" / "latest", createFolders = true)
370+
os.copy(unidocSrc, siteDir / "api/latest", createFolders = true)
371371

372372
PathRef(siteDir)
373373
}

example/extending/jvmcode/1-subprocess/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object foo extends JavaModule {
2222
defaultResolver().resolveDeps(Agg(ivy"org.codehaus.groovy:groovy:3.0.9"))
2323
}
2424

25-
def groovyScript = Task.Source(millSourcePath / "generate.groovy")
25+
def groovyScript = Task.Source("generate.groovy")
2626

2727
def groovyGeneratedResources = Task {
2828
Jvm.runSubprocess(

example/extending/jvmcode/2-classloader/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ object foo extends JavaModule {
1414
defaultResolver().resolveDeps(Agg(ivy"org.codehaus.groovy:groovy:3.0.9"))
1515
}
1616

17-
def groovyScript = Task.Source(millSourcePath / "generate.groovy")
17+
def groovyScript = Task.Source("generate.groovy")
1818

1919
def groovyGeneratedResources = Task {
2020
Jvm.runClassloader(classPath = groovyClasspath().map(_.path)) { classLoader =>

example/extending/jvmcode/3-worker/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def groovyWorker: Worker[java.net.URLClassLoader] = Task.Worker {
2424
}
2525

2626
trait GroovyGenerateJavaModule extends JavaModule {
27-
def groovyScript = Task.Source(millSourcePath / "generate.groovy")
27+
def groovyScript = Task.Source("generate.groovy")
2828

2929
def groovyGeneratedResources = Task {
3030
mill.api.ClassLoader.withContextClassLoader(groovyWorker()) {

example/extending/python/1-hello-python/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import mill._
99
def pythonExe: T[PathRef] = Task {
1010

1111
os.call(("python3", "-m", "venv", Task.dest / "venv"))
12-
val python = Task.dest / "venv" / "bin" / "python3"
12+
val python = Task.dest / "venv/bin/python3"
1313
os.call((python, "-m", "pip", "install", "mypy==1.13.0"))
1414

1515
PathRef(python)
@@ -19,7 +19,7 @@ def pythonExe: T[PathRef] = Task {
1919

2020
// The `sources` task specifies the directory for Python source files (`src` folder).
2121

22-
def sources: T[PathRef] = Task.Source(millSourcePath / "src")
22+
def sources: T[PathRef] = Task.Source("src")
2323

2424
// === Type Checking
2525

example/extending/python/2-python-modules/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import mill._
88

99
trait PythonModule extends Module {
1010

11-
def sources: T[PathRef] = Task.Source(millSourcePath / "src")
11+
def sources: T[PathRef] = Task.Source("src")
1212
def mainFileName: T[String] = Task { "main.py" }
1313

1414
def pythonExe: T[PathRef] = Task {
1515

1616
os.call(("python3", "-m", "venv", Task.dest / "venv"))
17-
val python = Task.dest / "venv" / "bin" / "python3"
17+
val python = Task.dest / "venv/bin/python3"
1818
os.call((python, "-m", "pip", "install", "mypy==1.13.0"))
1919

2020
PathRef(python)

example/extending/python/3-python-module-deps/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ trait PythonModule extends Module {
1313
// List of module dependencies required by this module.
1414
def moduleDeps: Seq[PythonModule] = Nil
1515

16-
def sources: T[PathRef] = Task.Source(millSourcePath / "src")
16+
def sources: T[PathRef] = Task.Source("src")
1717
def mainFileName: T[String] = Task { "main.py" }
1818

1919
def pythonExe: T[PathRef] = Task {
2020

2121
os.call(("python3", "-m", "venv", Task.dest / "venv"))
22-
val python = Task.dest / "venv" / "bin" / "python3"
22+
val python = Task.dest / "venv/bin/python3"
2323
os.call((python, "-m", "pip", "install", "mypy==1.13.0"))
2424

2525
PathRef(python)

example/extending/python/4-python-libs-bundle/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import mill._
1111
trait PythonModule extends Module {
1212
def moduleDeps: Seq[PythonModule] = Nil
1313
def mainFileName: T[String] = Task { "main.py" }
14-
def sources: T[PathRef] = Task.Source(millSourcePath / "src")
14+
def sources: T[PathRef] = Task.Source("src")
1515

1616
def pythonDeps: T[Seq[String]] = Task { Seq.empty[String] }
1717

@@ -22,7 +22,7 @@ trait PythonModule extends Module {
2222

2323
def pythonExe: T[PathRef] = Task {
2424
os.call(("python3", "-m", "venv", Task.dest / "venv"))
25-
val python = Task.dest / "venv" / "bin" / "python3"
25+
val python = Task.dest / "venv/bin/python3"
2626
os.call((python, "-m", "pip", "install", "mypy==1.13.0", "pex==2.24.1", transitivePythonDeps()))
2727

2828
PathRef(python)

example/extending/typescript/1-hello-typescript/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def npmInstall = Task {
3939
// e.g. someone can later easily override `allSources` to add additional filtering
4040
// on exactly which files within the source root they wish to pick up.
4141

42-
def sources = Task.Source(millSourcePath / "src")
42+
def sources = Task.Source("src")
4343
def allSources = Task {
4444
os.walk(sources().path).filter(_.ext == "ts").map(PathRef(_))
4545
}

example/extending/typescript/2-typescript-modules/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trait TypeScriptModule extends Module {
1313
PathRef(Task.dest)
1414
}
1515

16-
def sources = Task.Source(millSourcePath / "src")
16+
def sources = Task.Source("src")
1717
def allSources = Task {
1818
os.walk(sources().path).filter(_.ext == "ts").map(PathRef(_))
1919
}

example/extending/typescript/3-module-deps/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait TypeScriptModule extends Module {
2222
PathRef(Task.dest)
2323
}
2424

25-
def sources = Task.Source(millSourcePath / "src")
25+
def sources = Task.Source("src")
2626
def allSources = Task { os.walk(sources().path).filter(_.ext == "ts").map(PathRef(_)) }
2727

2828
def compile: T[(PathRef, PathRef)] = Task {

example/extending/typescript/4-npm-deps-bundle/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ trait TypeScriptModule extends Module {
3939
PathRef(Task.dest)
4040
}
4141

42-
def sources = Task.Source(millSourcePath / "src")
42+
def sources = Task.Source("src")
4343
def allSources = Task { os.walk(sources().path).filter(_.ext == "ts").map(PathRef(_)) }
4444

4545
def compile: T[(PathRef, PathRef)] = Task {

example/fundamentals/libraries/4-mainargs/build.mill

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def taskCallingCommand = Task {
8080
// For example, here is a `customPlanCommand` command which uses this
8181
// to traverse the module tree to find the tasks specified by the `tasks` strings,
8282
// and plan out what would be necessary to run them
83-
import mill.eval.{Evaluator, Terminal}
83+
import mill.eval.Evaluator
8484
import mill.resolve.{Resolve, SelectMode}
8585

8686
def customPlanCommand(evaluator: Evaluator, tasks: String*) = Task.Command {
@@ -91,10 +91,10 @@ def customPlanCommand(evaluator: Evaluator, tasks: String*) = Task.Command {
9191
) match {
9292
case Left(err) => Left(err)
9393
case Right(resolved) =>
94-
val (sortedGroups, _) = evaluator.plan(resolved)
95-
val plan = sortedGroups
94+
val plan = evaluator.plan(resolved)
95+
.sortedGroups
9696
.keys()
97-
.collect { case r: Terminal.Labelled[_] => r.render }
97+
.map(_.toString)
9898
.toArray
9999

100100
plan.foreach(println)

example/fundamentals/modules/6-modules/build.mill

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ object foo2 extends FooModule {
133133
// module expects its input files to be on disk.
134134

135135
trait MyModule extends Module {
136-
def sources = Task.Source(millSourcePath / "sources")
136+
def sources = Task.Source("sources")
137137
def task = Task { "hello " + os.list(sources().path).map(os.read(_)).mkString(" ") }
138138
}
139139

@@ -238,7 +238,7 @@ object outer2 extends MyModule {
238238
//
239239

240240
trait Foo extends Module {
241-
def sourceRoots = Task.Sources(millSourcePath / "src")
241+
def sourceRoots = Task.Sources("src")
242242
def sourceContents = Task {
243243
sourceRoots()
244244
.flatMap(pref => os.walk(pref.path))
@@ -249,7 +249,7 @@ trait Foo extends Module {
249249
}
250250

251251
trait Bar extends Foo {
252-
def additionalSources = Task.Sources(millSourcePath / "src2")
252+
def additionalSources = Task.Sources("src2")
253253
def sourceRoots = Task { super.sourceRoots() ++ additionalSources() }
254254
}
255255

example/fundamentals/modules/8-diy-java-modules/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait DiyJavaModule extends Module {
99
def mainClass: T[Option[String]] = None
1010

1111
def upstream: T[Seq[PathRef]] = Task { Task.traverse(moduleDeps)(_.classPath)().flatten }
12-
def sources = Task.Source(millSourcePath / "src")
12+
def sources = Task.Source("src")
1313

1414
def compile = Task {
1515
val allSources = os.walk(sources().path)

example/fundamentals/tasks/1-task-graph/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import mill._
66

77
def mainClass: T[Option[String]] = Some("foo.Foo")
88

9-
def sources = Task.Source(millSourcePath / "src")
10-
def resources = Task.Source(millSourcePath / "resources")
9+
def sources = Task.Source("src")
10+
def resources = Task.Source("resources")
1111

1212
def compile = Task {
1313
val allSources = os.walk(sources().path)

example/fundamentals/tasks/2-primary-tasks/build.mill

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ package build
99

1010
import mill.{Module, T, _}
1111

12-
def sources = Task.Source { millSourcePath / "src" }
13-
def resources = Task.Source { millSourcePath / "resources" }
12+
def sources = Task.Source { "src" }
13+
def resources = Task.Source { "resources" }
1414

1515
// ``Source``s are defined using `Task.Source{...}` taking one `os.Path`, or `Task.Sources{...}`,
1616
// taking multiple ``os.Path``s as arguments. A ``Source``'s:

example/fundamentals/tasks/3-anonymous-tasks/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package build
66
import mill._, define.Task
77

8-
def data = Task.Source(millSourcePath / "data")
8+
def data = Task.Source("data")
99

1010
def anonTask(fileName: String): Task[String] = Task.Anon {
1111
os.read(data().path / fileName)

example/fundamentals/tasks/5-persistent-tasks/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import java.util.Arrays
1717
import java.io.ByteArrayOutputStream
1818
import java.util.zip.GZIPOutputStream
1919

20-
def data = Task.Source(millSourcePath / "data")
20+
def data = Task.Source("data")
2121

2222
def compressedData = Task(persistent = true) {
2323
println("Evaluating compressedData")

example/fundamentals/tasks/6-workers/build.mill

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import java.util.Arrays
2525
import java.io.ByteArrayOutputStream
2626
import java.util.zip.GZIPOutputStream
2727

28-
def data = Task.Source(millSourcePath / "data")
28+
def data = Task.Source("data")
2929

3030
def compressWorker = Task.Worker { new CompressWorker(Task.dest) }
3131

0 commit comments

Comments
 (0)