Skip to content

Commit

Permalink
Avoid having the mill-launcher jar twice on the classpath (#2702)
Browse files Browse the repository at this point in the history
Pull request: #2702
  • Loading branch information
lefou authored Aug 24, 2023
1 parent d257f5d commit 66467bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions runner/src/mill/runner/MillBuildBootstrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ object MillBuildBootstrap {
// Copy the current location of the enclosing classes to `mill-launcher.jar`
// if it has the wrong file extension, because the Zinc incremental compiler
// doesn't recognize classpath entries without the proper file extension
val millLauncherOpt: Option[os.Path] =
val millLauncherOpt: Option[(os.Path, os.Path)] =
if (
os.isFile(selfClassLocation) &&
!Set("zip", "jar", "class").contains(selfClassLocation.ext)
Expand All @@ -340,9 +340,12 @@ object MillBuildBootstrap {
if (!os.exists(millLauncher)) {
os.copy(selfClassLocation, millLauncher, createFolders = true, replaceExisting = true)
}
Some(millLauncher)
Some((selfClassLocation, millLauncher))
} else None
enclosingClasspath ++ millLauncherOpt
enclosingClasspath
// avoid having the same file twice in the classpath
.filter(f => millLauncherOpt.isEmpty || f != millLauncherOpt.get._1) ++
millLauncherOpt.map(_._2)
}

def evaluateWithWatches(
Expand Down

0 comments on commit 66467bd

Please sign in to comment.