Plugin testing example broken since 0.12.12
https://github.com/com-lihaoyi/mill/blob/0.12.14/example/extending/plugins/7-writing-mill-plugins/build.mill
https://mill-build.org/mill/extending/writing-plugins.html
The example downloads Mill for integration tests with this code:
override def forkEnv = Map(
"MILL_EXECUTABLE_PATH" -> millExecutable.assembly().path.toString
)
object millExecutable extends JavaModule {
override def ivyDeps = Agg(
ivy"com.lihaoyi:mill-dist:${BuildInfo.millVersion}"
)
So the ivyDeps wants to download https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/$millVersion/mill-dist-$mill-version.jar.
However, since 0.12.12 that file does not exist.
FTR, the example works in main branch, which is 1ca8b97ec5b7e81768f9d96d5462af5414db25d3
> git rev-parse HEAD
1ca8b97ec5b7e81768f9d96d5462af5414db25d3
> mill --version
Mill Build Tool version 1.0.0-RC2
Java version: 17.0.14, vendor: Azul Systems, Inc., runtime: /home/lefou/.cache/coursier/arc/https/cdn.azul.com/zulu/bin/zulu17.56.15-ca-jdk17.0.14-linux_x64.tar.gz/zulu17.56.15-ca-jdk17.0.14-linux_x64
Default locale: de_DE, platform encoding: UTF-8
OS name: "Linux", version: 6.6.74-gentoo-x86_64, arch: amd64
> mill example.extending.plugins[7-writing-mill-plugins].packaged.daemon
...
[6345/6345] example.extending.plugins[7-writing-mill-plugins].packaged.daemon.testForked
[6345] -------------------------------- Running Tests --------------------------------
[6345] Copying integration test sources from /home/lefou/work/opensource/mill/example/extending/plugins/7-writing-mill-plugins to /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1
[6345] /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1> ./mill --disable-ticker myplugin.compile
[6345] --- Expected output ----------
[6345] compiling 1 Scala source...
[6345] ------------------------------
[6345] /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1> ./mill --disable-ticker myplugin.test
[6345] --- Expected output ----------
[6345] + myplugin.UnitTests.unit...
[6345] + myplugin.IntegrationTests.integration...
[6345] + myplugin.ExampleTests.example...
[6345] ...
[6345] ------------------------------
[6345] /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1> sed -i.bak 's/0.0.1/0.0.2/g' build.mill
[6345] --- Expected output ----------
[6345]
[6345] ------------------------------
[6345] /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1> ./mill --disable-ticker myplugin.publishLocal
[6345] --- Expected output ----------
[6345] Publishing Artifact(com.lihaoyi,myplugin_millSNAPSHOT_3,0.0.2) to ivy repo...
[6345] ------------------------------
[6345] /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1> ./mill --disable-ticker shutdown
[6345] --- Expected output ----------
[6345]
[6345] ------------------------------
[6345] + mill.testkit.UtestExampleTestSuite.exampleTest 77259ms /home/lefou/work/opensource/mill/out/example/extending/plugins/7-writing-mill-plugins/packaged/daemon/testForked.dest/sandbox/run-1
[6345] Tests: 1, Passed: 1, Failed: 0
[6345/6345] ============================== example.extending.plugins[7-writing-mill-plugins].packaged.daemon ============================== 93s
For versions since Mill 0.12.13, the file has another file extension: "exe". This is due to a newly introduced restriction in Maven Central. We are no longer allowed to use the "jar" extension, if the file has a prepended script, even if this is a fully standard conform JAR file. Hence we are forced to break compatibility.
The URL for 0.12.14 is: https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/0.12.14/mill-dist-0.12.14.exe
@alexarchambault Can you help out how we can specify the file extension for a dependency?
Bump @alexarchambault
I think you should change the packaging to exe in the POM file (needs to be done before publishing). Then, you should add exe in the artifact types when fetching the dependency, like
def artifactTypes = super.artifactTypes() ++ Seq(coursier.Type("exe"))
It seems this can be done without modifying the POM upfront, like
def mvnDeps = {
val dep = mvn"com.lihaoyi:mill-dist:0.12.14"
Seq(
dep.copy(dep = dep.dep.withPublication("", coursier.Type("exe")))
)
}
def artifactTypes = super.artifactTypes() ++ Seq(coursier.Type("exe"))
Assuming, we want a short notification like we have for classifier as in mvn"com.lihaoyi:mill-dist:0.12.14;classifier=tests", what would be the best name for it, type? We already have support for type which is a shortcut for .withType(coursier.Type(v)). is that the same?
@nafg could you try using ivy"com.lihaoyi:mill-runner:${BuildInfo.millVersion}" as your dependency? I think that would work around the problem by depending on an upstream normal jar, rather than the weird .exe assembly executable that dist contains
Probably going to call this a wontfix since we're moving forward with 1.x