Skip to content

Commit 224a6a4

Browse files
authored
Use named tuples in Tasks (#5146)
Use named tuples where we use tuples in Task types. The following task were changed: * `TestModule.test*` tasks now return `(msg: String, results: Seq[TestResult])` * `AndroidAppKotlinModule.androidDiscoveredPreviews` now returns `(previewsDiscoveredJsonFile: PathRef, screenshotConfigs: Seq[ComposeRenderer.Screenshot])` * `AndroidAppModule.android{D,R}8Dex` now returns `(outPath: PathRef, dexCliArgs: Seq[String])` * `AndroidModule.androidCompiledResources` now returns named tuple and includes all relevant resources directly. * Also use some named tuples in `GenIdeaImpl`, which hopefully improve reading/editing it. Pull request: #5146
1 parent 63bd1a6 commit 224a6a4

File tree

32 files changed

+192
-135
lines changed

32 files changed

+192
-135
lines changed

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/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(

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
*/

example/androidlib/java/5-R8/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ object app extends AndroidAppModule { // <2>
103103

104104
> ./mill show app.it
105105
...
106-
[
107-
"",
108-
[
106+
{
107+
"msg": "",
108+
"results": [
109109
{
110110
"fullyQualifiedName": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
111111
"selector": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
112112
"duration": ...,
113113
"status": "Success"
114114
}
115115
]
116-
]
116+
}
117117

118118

119119
> ./mill show app.stopAndroidEmulator

example/androidlib/java/6-native-libs/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ object app extends AndroidNativeAppModule { // <1>
7777

7878
> ./mill show app.it
7979
...
80-
[
81-
"",
82-
[
80+
{
81+
"msg": "",
82+
"results": [
8383
{
8484
"fullyQualifiedName": "com.helloworld.app.ExampleInstrumentedTest.textViewDisplaysHelloFromCpp",
8585
"selector": "com.helloworld.app.ExampleInstrumentedTest.textViewDisplaysHelloFromCpp",
8686
"duration": ...,
8787
"status": "Success"
8888
}
8989
]
90-
]
90+
}
9191
...
9292

9393
> ./mill show app.stopAndroidEmulator

example/androidlib/kotlin/1-hello-kotlin/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ object app extends AndroidAppKotlinModule {
148148

149149
> ./mill show app.it
150150
...
151-
[
152-
"",
153-
[
151+
{
152+
"msg": "",
153+
"results": [
154154
{
155155
"fullyQualifiedName": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
156156
"selector": "com.helloworld.app.ExampleInstrumentedTest.useAppContext",
157157
"duration": ...,
158158
"status": "Success"
159159
}
160160
]
161-
]
161+
}
162162
...
163163

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

example/androidlib/kotlin/3-compose-screenshot-tests/build.mill

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ object app extends AndroidAppKotlinModule {
7070

7171
> ./mill show app.screenshotTest.testForked
7272
...
73-
[
74-
"",
75-
[
73+
{
74+
"msg": "",
75+
"results": [
7676
{
7777
"fullyQualifiedName": "com.example.screenshottest.ExampleMessageCardScreenshots",
7878
"selector": "oMessageCardScreenshot()",
7979
"duration": ...,
8080
"status": "Success"
8181
}
8282
]
83-
]
83+
}
8484
...
8585

8686
> cat out/app/screenshotTest/testForked.dest/test-report.xml

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

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

145145
> ./mill show app.test
146146
...
147-
[
148-
" ",
149-
[
147+
{
148+
"msg": " ",
149+
"results": [
150150
{
151151
"fullyQualifiedName": "com.example.ExampleUnitTest.text_size_is_correct",
152152
"selector": "com.example.ExampleUnitTest.text_size_is_correct",
@@ -166,6 +166,6 @@ Publish ... to /home/.../.m2/repository/...
166166
"status": "Success"
167167
}
168168
]
169-
]
169+
}
170170
...
171171
*/

0 commit comments

Comments
 (0)