Skip to content

Commit e11e03a

Browse files
committed
Merge branch 'main' into tr-path-mapping-optional
2 parents 26f3447 + aa50528 commit e11e03a

File tree

61 files changed

+603
-296
lines changed

Some content is hidden

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

61 files changed

+603
-296
lines changed

.github/workflows/post-build-raw.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
continue-on-error: false
2222
timeout-minutes: ${{ inputs.timeout-minutes }}
2323
steps:
24-
- uses: actions/download-artifact@v4
24+
- uses: actions/download-artifact@v6
2525
with:
2626
path: .
2727
name: ${{ inputs.os }}-artifact

.github/workflows/post-build-selective.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
steps:
4141
- uses: coursier/cache-action@v6
4242

43-
- uses: actions/download-artifact@v4
43+
- uses: actions/download-artifact@v6
4444
with:
4545
path: .
4646
name: ${{ inputs.os }}-artifact

.github/workflows/pre-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- run: ./mill -i -k ${{ inputs.compileargs }}
3939

40-
- uses: actions/upload-artifact@v4.6.2
40+
- uses: actions/upload-artifact@v5.0.0
4141
with:
4242
path: .
4343
name: ${{ inputs.os }}-artifact

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ jobs:
158158
setup-android: true
159159

160160
- java-version: 17
161-
millargs: "'example.thirdparty[androidtodo].packaged.daemon'"
161+
millargs: "'example.thirdparty[android-compose-samples].packaged.daemon'"
162162
setup-android: true
163163

164164
- java-version: 24

core/api/daemon/src/mill/api/daemon/Segments.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import scala.math.Ordering.Implicits.seqOrdering
55
/**
66
* Models a path with the Mill build hierarchy, e.g. `amm.util[2.11].test.compile`.
77
*
8-
* `.`-separated segments are [[Segment.Label]]s,
9-
* while `[]`-delimited segments are [[Segment.Cross]]s
8+
* - `.`-separated segments are [[Segment.Label]]s,
9+
* - `[]`-delimited segments are [[Segment.Cross]]s
10+
* - If the first segment starts with `./`, it refers to a single-file script
11+
* - If the first segment ends with `/`, it refers to an external module
1012
*/
1113
final case class Segments private (value: Seq[Segment]) {
1214

@@ -30,7 +32,7 @@ final case class Segments private (value: Seq[Segment]) {
3032

3133
def render: String = {
3234
def renderCross(cross: Segment.Cross): String = "[" + cross.value.mkString(",") + "]"
33-
value.toList match {
35+
def renderValue(valueList: List[Segment]) = valueList match {
3436
case Nil => ""
3537
case head :: rest =>
3638
val headSegment = head match
@@ -42,6 +44,15 @@ final case class Segments private (value: Seq[Segment]) {
4244
}
4345
headSegment + stringSegments.mkString
4446
}
47+
48+
value.toList match {
49+
// ScriptModule segments always starts with `./`
50+
case Segment.Label(s"./$first") :: Nil => s"./$first"
51+
case Segment.Label(s"./$first") :: next :: rest => s"./$first:${renderValue(next :: rest)}"
52+
// ExternalModule segments always ends with '/'
53+
case Segment.Label(s"$first/") :: next :: rest => s"$first/${renderValue(next :: rest)}"
54+
case valueList => renderValue(valueList)
55+
}
4556
}
4657
override lazy val hashCode: Int = value.hashCode()
4758
}

core/api/src/mill/api/BuildCtx.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object BuildCtx {
5050
}
5151
}
5252

53-
def watch(p: os.Path): os.Path = {
53+
def watch(p: os.Path): os.Path = withFilesystemCheckerDisabled {
5454
val watchable = Watchable.Path(p.toNIO, false, PathRef(p).sig)
5555
watchedValues.append(watchable)
5656
p

core/api/src/mill/api/Evaluator.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@ trait Evaluator extends AutoCloseable with EvaluatorApi {
4848
allowPositionalCommandArgs: Boolean = false,
4949
resolveToModuleTasks: Boolean = false
5050
): mill.api.Result[List[Resolved]] = {
51-
// These are used in the overrides.
52-
val _ = scriptArgs
53-
val _ = selectMode
54-
val _ = allowPositionalCommandArgs
55-
val _ = resolveToModuleTasks
56-
5751
mill.api.Result.Success(Nil)
5852
}
5953

core/api/src/mill/api/ExecutionPaths.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ object ExecutionPaths {
3535
// Dollar sign `$` is our masking-character
3636
private val Dollar = "[$]".r
3737
// Forward-slashed are reserved for directory delimiters
38-
private val Slash = "/".r
3938

4039
private val steps: Seq[String => String] = Seq(
4140
// Step 1: mask all existing dollar signs, so we can use the dollar as masking character
@@ -46,13 +45,11 @@ object ExecutionPaths {
4645
case s => s
4746
},
4847
// Step 3: Replace colon (:) with $colon
49-
s => Colon.replaceAllIn(s, Matcher.quoteReplacement("$colon")),
50-
// Step 4: Replace slash (/) with $slash
51-
s => Slash.replaceAllIn(s, Matcher.quoteReplacement("$slash"))
48+
s => Colon.replaceAllIn(s, Matcher.quoteReplacement("$colon"))
5249
)
5350

5451
def sanitizePathSegment(segment: String): os.PathChunk = {
5552
// sanitize and implicitly convert to PathChunk
56-
steps.foldLeft(segment) { (segment, f) => f(segment) }
53+
os.SubPath(steps.foldLeft(segment) { (segment, f) => f(segment) })
5754
}
5855
}

core/api/src/mill/api/ExternalModule.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ abstract class ExternalModule(using
2727
!" #".exists(millModuleEnclosing0.value.contains(_)),
2828
"External modules must be at a top-level static path, not " + millModuleEnclosing0.value
2929
)
30-
override def moduleSegments: Segments = {
31-
Segments(millModuleEnclosing0.value.split('.').map(Segment.Label(_)).toIndexedSeq)
32-
}
30+
31+
// Include a trailing `/` in the external module first segment to distinguish it
32+
// from script modules or normal build.mill modules
33+
override def moduleSegments: Segments = Segments.labels(millModuleEnclosing0.value + "/")
3334
}
3435

3536
object ExternalModule {

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ package mill.api.internal
33
import mill.api.daemon.Segments
44

55
private[mill] sealed trait Resolved {
6+
def rootModule: RootModule0
67
def segments: Segments
78
def cls: Class[?]
9+
def fullSegments: Segments = rootModule.moduleSegments ++ segments
810
}
911

1012
private[mill] object Resolved {
@@ -23,7 +25,7 @@ private[mill] object Resolved {
2325
}
2426
}
2527

26-
case class Module(segments: Segments, cls: Class[?]) extends Resolved
27-
case class Command(segments: Segments, cls: Class[?]) extends Resolved
28-
case class NamedTask(segments: Segments, cls: Class[?]) extends Resolved
28+
case class Module(rootModule: RootModule0, segments: Segments, cls: Class[?]) extends Resolved
29+
case class Command(rootModule: RootModule0, segments: Segments, cls: Class[?]) extends Resolved
30+
case class NamedTask(rootModule: RootModule0, segments: Segments, cls: Class[?]) extends Resolved
2931
}

0 commit comments

Comments
 (0)