Skip to content

Commit 0d8285e

Browse files
authored
Fix ./mill init unpack path (#5195)
`InitModule#init` assumes that zip file name is the same as the path to the content inside the zip, which was broken recently in #5147. This PR makes it consistent again by computing the name once and using it both in naming the zip and in naming the enclosing folder of its contents
1 parent 1c268cf commit 0d8285e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.mill-jvm-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
zulu:17.0.14
1+
zulu:17.0.4

dist/package.mill

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,15 @@ object `package` extends MillJavaModule with DistModule {
221221
prepareBootstrapLauncher(millBootstrapBat().path, Task.dest, build.millVersion(), "mill.bat")
222222
}
223223

224-
def examplePathsWithArtifactName: Task[Seq[(PathRef, String)]] = Task.Input {
225-
for {
226-
exampleMod <- build.example.exampleModules
227-
path = exampleMod.moduleDir
228-
} yield {
229-
val example = path.subRelativeTo(Task.workspace)
224+
def examplePathsWithArtifactName0: Task[Seq[PathRef]] = Task.Input {
225+
for (exampleMod <- build.example.exampleModules) yield PathRef(exampleMod.moduleDir)
226+
}
227+
228+
def examplePathsWithArtifactName = Task {
229+
for (pr <- examplePathsWithArtifactName0()) yield {
230+
val example = pr.path.subRelativeTo(Task.workspace)
230231
val artifactName = example.segments.mkString("-")
231-
(PathRef(path), artifactName)
232+
(pr, s"${build.dist.artifactFileNamePrefix()}-$artifactName")
232233
}
233234
}
234235

libs/init/package.mill

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object `package` extends MillPublishScalaModule {
1919
val data: Seq[(os.SubPath, String)] =
2020
build.dist.examplePathsWithArtifactName().map { case (pathRef, str) =>
2121
val downloadUrl =
22-
s"${build.millDownloadUrl()}/${build.dist.artifactFileNamePrefix()}-$str.zip"
22+
s"${build.millDownloadUrl()}/$str.zip"
2323
val subPath = pathRef.path.subRelativeTo(Task.workspace / "example")
2424
(subPath, downloadUrl)
2525
}
@@ -118,8 +118,7 @@ object `package` extends MillPublishScalaModule {
118118
)
119119

120120
// An `sbt` plugin is built with Scala 2.12. See https://www.scala-sbt.org/1.x/docs/Plugins.html#Creating+an+auto+plugin.
121-
object models
122-
extends Cross[ModelsModule](Deps.sbtScalaVersion212, Deps.scalaVersion)
121+
object models extends Cross[ModelsModule](Deps.sbtScalaVersion212, Deps.scalaVersion)
123122
trait ModelsModule extends MillPublishCrossScalaModule {
124123
// def moduleDeps = Seq(buildgen.tree())
125124
def mvnDeps = Seq(Deps.upickle)

0 commit comments

Comments
 (0)