Repository navigation
Rework test overrides repo - #5514
Conversation
Replace it by a more reliable local Maven repo for test stuff
| playMinorVersion() match { | ||
| case "2.6" | "2.7" | "2.8" => | ||
| Seq(mvn"com.typesafe.play::routes-compiler:${playVersion()}") | ||
| case "2.6" => |
There was a problem hiding this comment.
We make the Scala version suffixes explicit here, in accordance with what's done in playRouteCompilerWorkerClasspath a bit below. Without this, playRouteCompilerWorkerClasspath and routerClasspath, which are merged in playRouterToolsClasspath, might bring artifacts for different Scala versions. I don't recall if this breaks the CI here or only with some more work for #5398, but this needs fixing anyway.
There was a problem hiding this comment.
This makes the resolution of com.lihaoyi:mill-contrib-playlib-worker-*, which now happens with the new local repo in examples and integration tests, more consistent
|
One concern about using a single Is there some way to preserve some of the precision that |
We probably can do something like that, yes. Looking into it. |
Conflicts: core/coursierutil/src/mill/coursierutil/TestOverridesRepo.scala
| def localTestExtraModules: Seq[MillJavaModule] = Nil | ||
| def localTestRepositories: T[Seq[PathRef]] = { | ||
|
|
||
| def recursive[T](start: T, deps: T => Seq[T]): Seq[T] = { |
There was a problem hiding this comment.
I find this code surprisingly confusing. What is going on here? Is it just a depth-first or breadth-first search? If so, could we implement it with a more traditional while-loop and mutable queue/stack?
| m => { | ||
| val localTestExtraModules0 = m match { | ||
| case m0: MillJavaModule => m0.localTestExtraModules | ||
| case _ => Nil |
There was a problem hiding this comment.
Given the type signatures involved, it seems like this case will never occur? And the .collect below can just be a .map?
| * artifact resolution, or be merged together and then used as repository, | ||
| * for example. | ||
| */ | ||
| def stagePublish: Task[PathRef] = Task { |
There was a problem hiding this comment.
Let's put the publish prefix first, to namespace the task a bit better. publishLocal is already taken, maybe publishStage? publishTestFolder?
f472544 to
3226805
Compare
β¦6819) This gets rid of the need of `MILL_LOCAL_TEST_REPO` and `MILL_USER_TEST_REPO` from #5514, and manages those repos solely via the `COURSIER_REPOSITORIES` environment variable. That way, the repositories from `mill-repositories` of #6713 automatically get precedence over the former repos. This addresses issues I've been seeing locally, where some artifacts under `~/.ivy2/local` were being used by the JvmWorker, while they shouldn't.
"Test overrides" stuff is being used to make integration tests or examples use modules and artifacts from the build rather than downloading those from Maven Central. Until now, the way it was injecting modules from the build was somehow low-level: the injected modules don't have dependencies anymore, and their full class path as provided by the build is put in the resolution artifacts as is.
The PR here makes it more principled: the build now provides a local Maven repository (
out/dist/localRepo.dest, resulting in things likeout/dist/localRepo.dest/com/lihaoyi/mill-libs-javalib_3/SNAPSHOT/mill-libs-javalib_3-SNAPSHOT.{pom,jar}), and the path to that local repository is passed around via an environment variable. Then, that local repository is added to the repository list, where coursier can pick things from it, and we don't blindly drop all dependencies and inject class paths as is any more.This makes the resolutions happening in examples and ITs more similar to how it happens when using a Mill release.
I've been needing while working on #5398, although I don't recall exactly which part of the fix requires it. But this makes things more principled, and less hackish IMO (no more
transitiveLocalTestOverridesthing to maintain), so I think it's a good thing in itself.