Skip to content

Commit 43d67b4

Browse files
committed
Merge branch 'main' into rebootstrap
2 parents 64ed196 + 224a6a4 commit 43d67b4

File tree

58 files changed

+794
-309
lines changed

Some content is hidden

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

58 files changed

+794
-309
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ end_of_line = lf
55
insert_final_newline = true
66
charset = utf-8
77
indent_style = space
8-
indent_size = 4
8+
indent_size = 2
99

1010
[*.scala]
1111
end_of_line = lf

build.mill

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ def millVersion: T[String] = Task {
4545
} else "SNAPSHOT"
4646
}
4747

48-
def millLastTagTruth: T[String] = Task {
49-
VcsVersion.calcVcsState(Task.log).lastTag.getOrElse(
50-
sys.error("No (last) git tag found. Your git history seems incomplete!")
51-
)
48+
def latestUnstableVersion = Task.Input {
49+
val mavenMetadataXml = requests
50+
.get("https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/maven-metadata.xml")
51+
.text()
52+
53+
val xml = scala.xml.XML.loadString(mavenMetadataXml)
54+
55+
(xml \\ "version").map(_.text).last
5256
}
5357

5458
def millLastTag: T[String] = Task {

ci/mill-bootstrap.patch

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ index 4465e163a55..6b8da38aae7 100644
2020

2121
val dummyDeps: Seq[Dep] = Seq(
2222
Deps.DocDeps.millScip,
23+
diff --git a/integration/package.mill b/integration/package.mill
24+
index a5183fc0a5a..4cb6f6689cd 100644
25+
--- a/integration/package.mill
26+
+++ b/integration/package.mill
27+
@@ -14,6 +14,7 @@ import mill.T
28+
import mill.define.Cross
29+
import mill.testrunner.TestResult
30+
import millbuild.*
31+
+import upickle.implicits.namedTuples.default.given
32+
33+
object `package` extends mill.Module {
34+
// We compile the test code once and then offer multiple modes to
2335
diff --git a/runner/codesig/package.mill b/runner/codesig/package.mill
2436
index 3950422474a..1ed233d24f7 100644
2537
--- a/runner/codesig/package.mill

contrib/testng/test/src/mill/testng/TestNGTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ object TestNGTests extends TestSuite {
5353
eval =>
5454
val Right(result) = eval.apply(demo.test.testForked()): @unchecked
5555
val tres = result.value
56-
assert(tres._2.size == 8)
56+
assert(tres.results.size == 8)
5757
}
5858
test("noGrouping") - UnitTester(demo, resourcePath).scoped {
5959
eval =>
6060
val Right(result) = eval.apply(demo.testng.testForked()): @unchecked
61-
val tres = result.value._2
61+
val tres = result.value.results
6262
assert(tres.map(_.fullyQualifiedName).toSet == Set("foo.HelloTests", "foo.WorldTests"))
6363
}
6464
test("testForkGrouping") - UnitTester(demo, resourcePath).scoped {
6565
eval =>
6666
val Right(result) = eval.apply(demo.testngGrouping.testForked()): @unchecked
67-
val tres = result.value._2
67+
val tres = result.value.results
6868
assert(tres.map(_.fullyQualifiedName).toSet == Set("foo.HelloTests", "foo.WorldTests"))
6969
}
7070
}

core/api/src/mill/api/Watchable.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ package mill.api
88
*/
99
private[mill] sealed trait Watchable
1010
private[mill] object Watchable {
11+
12+
/**
13+
* Watched path, can be watched via polling or via a notification system.
14+
*
15+
* @param p the path to watch
16+
* @param quick if true, only watch file attributes
17+
* @param signature the initial hash of the path contents
18+
*/
1119
case class Path(p: java.nio.file.Path, quick: Boolean, signature: Int) extends Watchable
20+
21+
/**
22+
* Watched expression, can only be watched via polling.
23+
*
24+
* @param f the expression to watch, returns some sort of hash
25+
* @param signature the initial hash from the first invocation of the expression
26+
* @param pretty human-readable name
27+
*/
1228
case class Value(f: () => Long, signature: Long, pretty: String) extends Watchable
1329
}

core/api/src/mill/api/internal/api.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ trait ScalaModuleApi extends JavaModuleApi
5858
trait ScalaJSModuleApi extends JavaModuleApi
5959
trait ScalaNativeModuleApi extends JavaModuleApi
6060
trait TestModuleApi extends ModuleApi {
61-
def testLocal(args: String*): TaskApi[(String, Seq[Any])]
62-
private[mill] def bspBuildTargetScalaTestClasses: TaskApi[(String, Seq[String])]
61+
def testLocal(args: String*): TaskApi[(msg: String, results: Seq[Any])]
62+
private[mill] def bspBuildTargetScalaTestClasses
63+
: TaskApi[(frameworkName: String, classes: Seq[String])]
6364
}
6465
trait MainModuleApi extends ModuleApi {
6566
private[mill] def bspClean(

core/define/src/mill/define/Task.scala

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ object Task extends TaskBase {
124124
inline def Command[T](inline t: Result[T])(implicit
125125
inline w: Writer[T],
126126
inline ctx: ModuleCtx
127-
): Command[T] = ${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }) }
127+
): Command[T] =
128+
${ TaskMacros.commandImpl[T]('t)('w, 'ctx, exclusive = '{ false }, persistent = '{ false }) }
128129

129130
/**
130131
* @param exclusive Exclusive commands run serially at the end of an evaluation,
@@ -133,16 +134,20 @@ object Task extends TaskBase {
133134
* These are normally used for "top level" commands which are
134135
* run directly to perform some action or display some output
135136
* to the user.
137+
* @param persistent If true the `Task.dest` directory is not cleaned between
138+
* runs.
136139
*/
137140
def Command(
138141
t: NamedParameterOnlyDummy = new NamedParameterOnlyDummy,
139-
exclusive: Boolean = false
140-
): CommandFactory = new CommandFactory(exclusive)
141-
class CommandFactory private[mill] (val exclusive: Boolean) {
142+
exclusive: Boolean = false,
143+
persistent: Boolean = false
144+
): CommandFactory = new CommandFactory(exclusive = exclusive, persistent = persistent)
145+
class CommandFactory private[mill] (val exclusive: Boolean, val persistent: Boolean) {
142146
inline def apply[T](inline t: Result[T])(implicit
143147
inline w: Writer[T],
144148
inline ctx: ModuleCtx
145-
): Command[T] = ${ TaskMacros.commandImpl[T]('t)('w, 'ctx, '{ this.exclusive }) }
149+
): Command[T] =
150+
${ TaskMacros.commandImpl[T]('t)('w, 'ctx, '{ this.exclusive }, '{ this.persistent }) }
146151
}
147152

148153
/**
@@ -400,7 +405,8 @@ class Command[+T](
400405
val ctx0: mill.define.ModuleCtx,
401406
val writer: Writer[?],
402407
val isPrivate: Option[Boolean],
403-
val exclusive: Boolean
408+
val exclusive: Boolean,
409+
override val persistent: Boolean
404410
) extends NamedTask[T] {
405411

406412
override def asCommand: Some[Command[T]] = Some(this)
@@ -555,12 +561,21 @@ private object TaskMacros {
555561
)(t: Expr[Result[T]])(
556562
w: Expr[Writer[T]],
557563
ctx: Expr[mill.define.ModuleCtx],
558-
exclusive: Expr[Boolean]
564+
exclusive: Expr[Boolean],
565+
persistent: Expr[Boolean]
559566
): Expr[Command[T]] = {
560567
appImpl[Command, T](
561568
(in, ev) =>
562569
'{
563-
new Command[T]($in, $ev, $ctx, $w, ${ taskIsPrivate() }, exclusive = $exclusive)
570+
new Command[T](
571+
$in,
572+
$ev,
573+
$ctx,
574+
$w,
575+
${ taskIsPrivate() },
576+
exclusive = $exclusive,
577+
persistent = $persistent
578+
)
564579
},
565580
t
566581
)

dist/package.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ object `package` extends MillJavaModule with DistModule {
237237
os.copy(examplePath.path, Task.dest / exampleStr, createFolders = true)
238238
val ignoreErrorsOnCI = Task.dest / exampleStr / "ignoreErrorsOnCI"
239239
if (os.exists(ignoreErrorsOnCI)) os.remove(ignoreErrorsOnCI)
240-
os.write(Task.dest / exampleStr / ".mill-version", build.millLastTag())
240+
os.write(Task.dest / exampleStr / ".mill-version", build.millVersion())
241241
os.copy(bootstrapLauncher().path, Task.dest / exampleStr / "mill")
242242
os.copy(bootstrapLauncherBat().path, Task.dest / exampleStr / "mill.bat")
243243
val zip = Task.dest / s"$exampleStr.zip"

example/androidlib/java/1-hello-world/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,17 @@ object app extends AndroidAppModule {
120120

121121
> ./mill show app.it
122122
...
123-
[
124-
"",
125-
[
123+
{
124+
"msg": "",
125+
"results": [
126126
{
127127
"fullyQualifiedName": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
128128
"selector": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
129129
"duration": ...,
130130
"status": "Success"
131131
}
132132
]
133-
]
133+
}
134134
...
135135

136136
> cat out/app/it/testForked.dest/test-report.xml

example/androidlib/java/4-sum-lib-java/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ Publish ... to /home/.../.m2/repository/...
142142

143143
> ./mill show app.test
144144
...
145-
[
146-
"",
147-
[
145+
{
146+
"msg": "",
147+
"results": [
148148
{
149149
"fullyQualifiedName": "com.example.app.CalculatorUnitTest.textSize_isCorrect",
150150
"selector": "com.example.app.CalculatorUnitTest.textSize_isCorrect",
@@ -158,6 +158,6 @@ Publish ... to /home/.../.m2/repository/...
158158
"status": "Success"
159159
}
160160
]
161-
]
161+
}
162162
...
163163
*/

0 commit comments

Comments
 (0)