Skip to content

Commit

Permalink
Merge branch 'main' into jo/python-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi authored Jan 31, 2025
2 parents 182d672 + ea64306 commit f5a7b01
Show file tree
Hide file tree
Showing 328 changed files with 3,679 additions and 1,634 deletions.
3 changes: 3 additions & 0 deletions .github/actions/post-build-selective/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ runs:
- uses: actions/setup-node@v4
with: { node-version: '22' }

- run: cat .mill-jvm-version
shell: ${{ inputs.shell }}

- run: ./mill -i -k selective.resolve ${{ inputs.millargs }}
shell: ${{ inputs.shell }}

Expand Down
5 changes: 4 additions & 1 deletion .github/actions/pre-build-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ runs:
name: ${{ inputs.os }}-selective-execution-artifact
include-hidden-files: true

- uses: actions/checkout@v4
- uses: actions/checkout@v4

- run: echo temurin:${{ inputs.java-version }} > .mill-jvm-version
shell: bash
9 changes: 7 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ name: Run Tests

on:
push:
branches-ignore:
- '**-patch-**'
pull_request:
types:
- opened
Expand Down Expand Up @@ -144,10 +146,13 @@ jobs:
install-android-sdk: false

- java-version: 17
millargs: "example.kotlinlib.__.native.server.test"
millargs: "example.kotlinlib.__.local.server.test"
install-android-sdk: false

- java-version: 17
# Run this one using `.native` as a smoketest. Also make sure the java-version
# is the same as that used in the `build-linux` job to avoid diverging code
# hashes (https://github.com/com-lihaoyi/mill/pull/4410)
- java-version: 11
millargs: "example.scalalib.__.native.server.test"
install-android-sdk: false

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
java-version: '17'
distribution: 'temurin'

- uses: scala-steward-org/scala-steward-action@v2.72.0
- uses: scala-steward-org/scala-steward-action@v2.75.0
with:
mill-version: 0.12.1
2 changes: 0 additions & 2 deletions blog/modules/ROOT/pages/1-java-compile.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
:revdate: 29 November 2024
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]

Java compiles have the reputation for being slow, but that reputation does
not match today's reality. Nowadays the Java compiler can compile "typical" Java code at over
100,000 lines a second on a single core. That means that even a million line project
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/2-monorepo-build-tool.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:revdate: 17 December 2024
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]



Software build tools mostly fall into two categories:
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/3-selective-testing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:revdate: 24 December 2024
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]


Selective testing is a key technique necessary for working with any large codebase
or monorepo: picking which tests to run to validate a change or pull-request, because
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/4-flaky-tests.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:revdate: 1 January 2025
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]


Many projects suffer from the problem of flaky tests: tests that pass or fail
non-deterministically. These cause confusion, slow development cycles, and endless
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/5-executable-jars.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:revdate: 2 January 2025
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]


One feature of the https://mill-build.org[Mill JVM build tool] is that the
assembly jars it creates are directly executable:
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/6-garbage-collector-perf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:revdate: 10 January 2025
_{author}, {revdate}_

include::mill:ROOT:partial$gtag-config.adoc[]


Garbage collectors are a core part of many programming languages. While they generally work
well, on occasion when they go wrong they can fail in very unintuitive ways.
Expand Down
2 changes: 1 addition & 1 deletion blog/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Mill Build Engineering Blog

include::mill:ROOT:partial$gtag-config.adoc[]



Welcome to the Mill build engineering blog! This is the home for articles on
Expand Down
6 changes: 3 additions & 3 deletions bsp/src/mill/bsp/BSP.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object BSP extends ExternalModule with CoursierModule {
// we create a file containing the additional jars to load
val libUrls = bspWorkerLibs().map(_.path.toNIO.toUri.toURL).iterator.toSeq
val cpFile =
T.workspace / Constants.bspDir / s"${Constants.serverName}-${BuildInfo.millVersion}.resources"
Task.workspace / Constants.bspDir / s"${Constants.serverName}-${BuildInfo.millVersion}.resources"
os.write.over(
cpFile,
libUrls.mkString("\n"),
Expand All @@ -51,9 +51,9 @@ object BSP extends ExternalModule with CoursierModule {
*/
def startSession(allBootstrapEvaluators: Evaluator.AllBootstrapEvaluators)
: Command[BspServerResult] = Task.Command {
T.log.errorStream.println("BSP/startSession: Starting BSP session")
Task.log.errorStream.println("BSP/startSession: Starting BSP session")
val res = BspContext.bspServerHandle.runSession(allBootstrapEvaluators.value)
T.log.errorStream.println(s"BSP/startSession: Finished BSP session, result: ${res}")
Task.log.errorStream.println(s"BSP/startSession: Finished BSP session, result: ${res}")
res
}

Expand Down
4 changes: 2 additions & 2 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object Deps {
Seq(Play_3_0, Play_2_9, Play_2_8, Play_2_7, Play_2_6).map(p => (p.playBinVersion, p)).toMap

val acyclic = ivy"com.lihaoyi:::acyclic:0.3.15"
val ammoniteVersion = "3.0.0-2-6342755f"
val ammoniteVersion = "3.0.1"
val asmTree = ivy"org.ow2.asm:asm-tree:9.7.1"
val bloopConfig = ivy"ch.epfl.scala::bloop-config:1.5.5"

Expand Down Expand Up @@ -201,7 +201,7 @@ object Deps {
ivy"org.apache.maven.resolver:maven-resolver-transport-http:$mavenResolverVersion"
val mavenResolverTransportWagon =
ivy"org.apache.maven.resolver:maven-resolver-transport-wagon:$mavenResolverVersion"
val coursierJvmIndexVersion = "0.0.4-70-51469f"
val coursierJvmIndexVersion = "0.0.4-84-f852c6"
val gradleApi = ivy"dev.gradleplugins:gradle-api:8.11.1"

object RuntimeDeps {
Expand Down
2 changes: 2 additions & 0 deletions changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ endif::[]
:link-milestone: {link-github}/milestone
// find-replace-regex: https://github.com/com-lihaoyi/mill/pull/(\d*) -> {link-pr}/$1[#$1]

_The changelog below is for tagged, stable releases. For unstable releases,
see the list at https://repo1.maven.org/maven2/com/lihaoyi/mill-dist_

[#0-12-5]
=== 0.12.5 - 2025-01-01
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import mill.api.Result
import scalalib._
import mill.contrib.artifactory.ArtifactoryPublishModule.checkArtifactoryCreds
import mill.define.{ExternalModule, Task}
import mill.define.Command

trait ArtifactoryPublishModule extends PublishModule {
def artifactoryUri: String
Expand Down Expand Up @@ -35,7 +36,7 @@ trait ArtifactoryPublishModule extends PublishModule {
checkArtifactoryCreds(credentials)(),
readTimeout,
connectTimeout,
T.log
Task.log
).publish(artifacts.map { case (a, b) => (a.path, b) }, artifactInfo)
}
}
Expand All @@ -59,9 +60,9 @@ object ArtifactoryPublishModule extends ExternalModule {
publishArtifacts: mill.main.Tasks[PublishModule.PublishData],
readTimeout: Int = 60000,
connectTimeout: Int = 5000
) = Task.Command {
): Command[Unit] = Task.Command {

val artifacts = T.sequence(publishArtifacts.value)().map {
val artifacts = Task.sequence(publishArtifacts.value)().map {
case data @ PublishModule.PublishData(_, _) => data.withConcretePath
}
new ArtifactoryPublisher(
Expand All @@ -70,7 +71,7 @@ object ArtifactoryPublishModule extends ExternalModule {
checkArtifactoryCreds(credentials)(),
readTimeout,
connectTimeout,
T.log
Task.log
).publishAll(
artifacts: _*
)
Expand All @@ -79,8 +80,8 @@ object ArtifactoryPublishModule extends ExternalModule {
private def checkArtifactoryCreds(credentials: String): Task[String] = Task.Anon {
if (credentials.isEmpty) {
(for {
username <- T.env.get("ARTIFACTORY_USERNAME")
password <- T.env.get("ARTIFACTORY_PASSWORD")
username <- Task.env.get("ARTIFACTORY_USERNAME")
password <- Task.env.get("ARTIFACTORY_PASSWORD")
} yield {
Result.Success(s"$username:$password")
}).getOrElse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import mill.api.Result
import scalalib._
import mill.contrib.bintray.BintrayPublishModule.checkBintrayCreds
import mill.define.{ExternalModule, Task}
import mill.define.Command

trait BintrayPublishModule extends PublishModule {

Expand Down Expand Up @@ -44,7 +45,7 @@ trait BintrayPublishModule extends PublishModule {
release,
readTimeout,
connectTimeout,
T.log
Task.log
).publish(bintrayPublishArtifacts())
}
}
Expand All @@ -69,25 +70,25 @@ object BintrayPublishModule extends ExternalModule {
publishArtifacts: mill.main.Tasks[BintrayPublishData],
readTimeout: Int = 60000,
connectTimeout: Int = 5000
) = Task.Command {
): Command[Unit] = Task.Command {
new BintrayPublisher(
bintrayOwner,
bintrayRepo,
checkBintrayCreds(credentials)(),
release,
readTimeout,
connectTimeout,
T.log
Task.log
).publishAll(
T.sequence(publishArtifacts.value)(): _*
Task.sequence(publishArtifacts.value)(): _*
)
}

private def checkBintrayCreds(credentials: String): Task[String] = Task.Anon {
if (credentials.isEmpty) {
(for {
username <- T.env.get("BINTRAY_USERNAME")
password <- T.env.get("BINTRAY_PASSWORD")
username <- Task.env.get("BINTRAY_USERNAME")
password <- Task.env.get("BINTRAY_PASSWORD")
} yield {
Result.Success(s"$username:$password")
}).getOrElse(
Expand Down
10 changes: 5 additions & 5 deletions contrib/bloop/src/mill/contrib/bloop/BloopImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BloopImpl(evs: () => Seq[Evaluator], wd: os.Path) extends ExternalModule {
* under pwd/.bloop.
*/
def install() = Task.Command {
val res = T.traverse(computeModules)(_.bloop.writeConfigFile())()
val res = Task.traverse(computeModules)(_.bloop.writeConfigFile())()
val written = res.map(_._2).map(_.path)
// Make bloopDir if it doesn't exists
if (!os.exists(bloopDir)) {
Expand Down Expand Up @@ -91,7 +91,7 @@ class BloopImpl(evs: () => Seq[Evaluator], wd: os.Path) extends ExternalModule {
os.makeDir.all(bloopDir)
val path = bloopConfigPath(jm)
_root_.bloop.config.write(config(), path.toNIO)
T.log.info(s"Wrote $path")
Task.log.info(s"Wrote $path")
name(jm) -> PathRef(path)
}

Expand Down Expand Up @@ -139,7 +139,7 @@ class BloopImpl(evs: () => Seq[Evaluator], wd: os.Path) extends ExternalModule {
* from module#sources in bloopInstall
*/
def moduleSourceMap = Task.Input {
val sources = T.traverse(computeModules) { m =>
val sources = Task.traverse(computeModules) { m =>
m.allSources.map { paths =>
name(m) -> paths.map(_.path)
}
Expand Down Expand Up @@ -203,7 +203,7 @@ class BloopImpl(evs: () => Seq[Evaluator], wd: os.Path) extends ExternalModule {
// //////////////////////////////////////////////////////////////////////////

val classpath = Task.Anon {
val transitiveCompileClasspath = T.traverse(module.transitiveModuleCompileModuleDeps)(m =>
val transitiveCompileClasspath = Task.traverse(module.transitiveModuleCompileModuleDeps)(m =>
Task.Anon { m.localCompileClasspath().map(_.path) ++ Agg(classes(m)) }
)().flatten

Expand Down Expand Up @@ -273,7 +273,7 @@ class BloopImpl(evs: () => Seq[Evaluator], wd: os.Path) extends ExternalModule {
Task.Anon {
BloopConfig.Platform.Jvm(
BloopConfig.JvmConfig(
home = T.env.get("JAVA_HOME").map(s => os.Path(s).toNIO),
home = Task.env.get("JAVA_HOME").map(s => os.Path(s).toNIO),
options = {
// See https://github.com/scalacenter/bloop/issues/1167
val forkArgs = module.forkArgs().toList
Expand Down
8 changes: 4 additions & 4 deletions contrib/buildinfo/src/mill/contrib/buildinfo/BuildInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ trait BuildInfo extends JavaModule {

val subPath = os.SubPath(buildInfoPackageName.replace('.', '/'))
val stream = os.write.outputStream(
T.dest / subPath / s"$buildInfoObjectName.buildinfo.properties",
Task.dest / subPath / s"$buildInfoObjectName.buildinfo.properties",
createFolders = true
)

Expand All @@ -54,7 +54,7 @@ trait BuildInfo extends JavaModule {
s"mill.contrib.buildinfo.BuildInfo for ${buildInfoPackageName}.${buildInfoObjectName}"
)
stream.close()
PathRef(T.dest)
PathRef(Task.dest)
}

private def isScala = this.isInstanceOf[ScalaModule]
Expand Down Expand Up @@ -82,11 +82,11 @@ trait BuildInfo extends JavaModule {
val ext = if (isScala) "scala" else "java"

os.write(
T.dest / buildInfoPackageName.split('.') / s"${buildInfoObjectName}.$ext",
Task.dest / buildInfoPackageName.split('.') / s"${buildInfoObjectName}.$ext",
code,
createFolders = true
)
Seq(PathRef(T.dest))
Seq(PathRef(Task.dest))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait CodeartifactPublishModule extends PublishModule {
credentials,
readTimeout,
connectTimeout,
T.log
Task.log
).publish(artifacts.map { case (a, b) => (a.path, b) }, artifactInfo)
}
}
Expand All @@ -42,7 +42,7 @@ object CodeartifactPublishModule extends ExternalModule {
connectTimeout: Int = 5000
) =
Task.Command {
val artifacts = T.sequence(publishArtifacts.value)().map {
val artifacts = Task.sequence(publishArtifacts.value)().map {
case data @ PublishModule.PublishData(_, _) => data.withConcretePath
}
new CodeartifactPublisher(
Expand All @@ -51,7 +51,7 @@ object CodeartifactPublishModule extends ExternalModule {
credentials,
readTimeout,
connectTimeout,
T.log
Task.log
).publishAll(
artifacts: _*
)
Expand Down
6 changes: 3 additions & 3 deletions contrib/docker/src/mill/contrib/docker/DockerModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ trait DockerModule { outer: JavaModule =>
* [[https://docs.docker.com/engine/reference/commandline/cli/#environment-variables Environment variables]]
* for more information.
*/
def dockerEnv: T[Map[String, String]] = T.env
def dockerEnv: T[Map[String, String]] = Task.env

/**
* Commands to add as RUN instructions.
Expand Down Expand Up @@ -161,15 +161,15 @@ trait DockerModule { outer: JavaModule =>
}

final def build = Task {
val dest = T.dest
val dest = Task.dest
val env = dockerEnv()

val asmPath = outer.assembly().path
os.copy(asmPath, dest / asmPath.last)

os.write(dest / "Dockerfile", dockerfile())

val log = T.log
val log = Task.log

val tagArgs = tags().flatMap(t => List("-t", t))

Expand Down
2 changes: 1 addition & 1 deletion contrib/flyway/readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ mill foo.flywayMigrate

CAUTION: You should never hard-code credentials or check them into a version control system.
You should write some code to populate the settings for flyway instead.
For example `def flywayPassword = Task.Input(T.ctx.env("FLYWAY_PASSWORD"))`
For example `def flywayPassword = Task.Input(Task.ctx.env("FLYWAY_PASSWORD"))`
Loading

0 comments on commit f5a7b01

Please sign in to comment.