Skip to content

Commit 3b83c84

Browse files
authored
Revert "Run examples with local repo under out/ rather than ~/.ivy2/local (#5949)" (#6067)
This reverts commit 2beb6c1, as it seems to break `./mill dist.installLocalCache` Presumably an unexpected interaction, but reverting it for now so that local testing and development isn't blocked Seems like it causes IntelliJ BSP installation of `installLocalCache` output to fail ``` Executing /Users/lihaoyi/test/mill -i mill.bsp.BSP/install Mill is running in BSP mode, using a separate output directory 'out/mill-bsp-out'. If you would like to reuse the regular `out/` directory, set the 'MILL_NO_SEPARATE_BSP_OUTPUT_DIR' environment variable. This will reduce the CPU usage of the BSP server but make it less responsive. Downloading https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom Failed to download https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom Downloading https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom.sha1 Failed to download https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom.sha1 Exception in thread "main" java.lang.RuntimeException: coursier.error.ResolutionError$CantDownloadModule: Error downloading com.lihaoyi:mill-runner-daemon_3:1.0.6-89-6adfd5-DIRTYc23995aa not found: /Users/lihaoyi/.ivy2/local/com.lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/ivys/ivy.xml not found: https://repo1.maven.org/maven2/com/lihaoyi/mill-runner-daemon_3/1.0.6-89-6adfd5-DIRTYc23995aa/mill-runner-daemon_3-1.0.6-89-6adfd5-DIRTYc23995aa.pom at scala.sys.package$.error(package.scala:27) at mill.launcher.CoursierClient$.resolveMillDaemon(CoursierClient.scala:42) at mill.launcher.CoursierClient.resolveMillDaemon(CoursierClient.scala) at mill.launcher.MillLauncherMain.lambda$main$4(MillLauncherMain.java:79) at mill.launcher.MillProcessLauncher.cachedComputedValue0(MillProcessLauncher.java:270) at mill.launcher.MillLauncherMain.main(MillLauncherMain.java:75) ``` CC @alexarchambault
1 parent 6adfd5c commit 3b83c84

File tree

7 files changed

+143
-205
lines changed

7 files changed

+143
-205
lines changed

dist/package.mill

Lines changed: 15 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import mill.util.Jvm
99
import millbuild.*
1010
import mill.api.BuildCtx
1111
import scala.util.Using
12-
import scala.util.Properties
13-
import java.nio.file.Files
14-
import java.nio.file.attribute.PosixFilePermission
1512

1613
trait DistModule extends Module {
1714
// All modules that we want to aggregate as part of this `dev` assembly.
@@ -22,49 +19,9 @@ trait DistModule extends Module {
2219

2320
def executableRaw: T[PathRef]
2421

25-
def localRepo: T[PathRef] = Task {
26-
val dest = Task.dest
27-
val repos = Task.traverse(allPublishModules)(m => m.publishLocalTestRepo)().map(_.path)
28-
for (repo <- repos; elem <- os.list(repo))
29-
os.copy.into(elem, dest, mergeFolders = true)
30-
PathRef(dest)
31-
}
32-
3322
def executable = Task {
34-
val rawExecutable = executableRaw()
35-
if (Properties.isWin) {
36-
val launcher = Task.dest / "mill.bat"
37-
val launcherContent =
38-
s"""@echo off
39-
|set "NEW_COURSIER_REPOSITORIES=${localRepo().path.toNIO.toUri.toASCIIString}|ivy2Local|central"
40-
|if defined COURSIER_REPOSITORIES (
41-
| set "NEW_COURSIER_REPOSITORIES=%NEW_COURSIER_REPOSITORIES%|%COURSIER_REPOSITORIES%"
42-
|) else (
43-
| set "NEW_COURSIER_REPOSITORIES=%NEW_COURSIER_REPOSITORIES%|ivy2Local|central"
44-
|)
45-
|set "COURSIER_REPOSITORIES=%NEW_COURSIER_REPOSITORIES%"
46-
|set NEW_COURSIER_REPOSITORIES=
47-
|"${rawExecutable.path.toString.replace("\"", "\\\"")}" %*
48-
|if errorlevel 1 exit /b %errorlevel%
49-
|""".stripMargin
50-
os.write(launcher, launcherContent)
51-
PathRef(launcher)
52-
} else {
53-
val launcher = Task.dest / "mill"
54-
val launcherContent =
55-
s"""#!/usr/bin/env bash
56-
|set -e
57-
|export COURSIER_REPOSITORIES="${localRepo().path.toNIO.toUri.toASCIIString}|$${COURSIER_REPOSITORIES:-ivy2Local|central}"
58-
|exec '${rawExecutable.path.toString.replace("'", "\\'")}' "$$@"
59-
|""".stripMargin
60-
os.write(launcher, launcherContent)
61-
val perms = Files.getPosixFilePermissions(launcher.toNIO)
62-
perms.add(PosixFilePermission.OWNER_EXECUTE)
63-
perms.add(PosixFilePermission.GROUP_EXECUTE)
64-
perms.add(PosixFilePermission.OTHERS_EXECUTE)
65-
Files.setPosixFilePermissions(launcher.toNIO, perms)
66-
PathRef(launcher)
67-
}
23+
Task.traverse(allPublishModules)(m => m.publishLocal(doc = false))()
24+
executableRaw()
6825
}
6926

7027
def localBinName: String
@@ -75,15 +32,12 @@ trait DistModule extends Module {
7532
* Build and install Mill locally.
7633
*
7734
* @param binFile The location where the Mill binary should be installed
35+
* @param ivyRepo The local Ivy repository where Mill modules should be published to
7836
*/
79-
def installLocal(binFile: String = localBinName) = {
80-
val binFile0 = os.Path(binFile, BuildCtx.workspaceRoot)
81-
val task = installIvyLocalTask(binFile0)
37+
def installLocal(binFile: String = localBinName, ivyRepo: String = null) =
8238
Task.Command {
83-
task()
84-
PathRef(binFile0)
39+
PathRef(installLocalTask(Task.Anon(binFile), ivyRepo)())
8540
}
86-
}
8741

8842
val batExt = if (scala.util.Properties.isWin) ".bat" else ""
8943

@@ -99,28 +53,16 @@ trait DistModule extends Module {
9953
PathRef(path)
10054
}
10155

102-
def installLocalTask(binFile: Task[String]): Task[os.Path] =
103-
Task.Anon {
104-
val targetFile = os.Path(binFile(), BuildCtx.workspaceRoot)
105-
if (os.exists(targetFile))
106-
Task.log.info(s"Overwriting existing local Mill binary at ${targetFile}")
107-
os.copy.over(executable().path, targetFile, createFolders = true)
108-
Task.log.info(
109-
s"Published ${build.dist.allPublishModules.size} modules under Mill sources local repo ${localRepo().path} and installed ${targetFile}"
110-
)
111-
targetFile
112-
}
113-
114-
def installIvyLocalTask(targetFile: os.Path): Task[Unit] =
115-
Task.Anon {
116-
if (os.exists(targetFile))
117-
Task.log.info(s"Overwriting existing local Mill binary at ${targetFile}")
118-
Task.traverse(allPublishModules)(m => m.publishLocal(doc = false))()
119-
os.copy.over(executableRaw().path, targetFile, createFolders = true)
120-
Task.log.info(
121-
s"Published ${build.dist.allPublishModules.size} modules under ~/.ivy2/local and installed ${targetFile}"
122-
)
123-
}
56+
def installLocalTask(binFile: Task[String], ivyRepo: String = null): Task[os.Path] = Task.Anon {
57+
val targetFile = os.Path(binFile(), BuildCtx.workspaceRoot)
58+
if (os.exists(targetFile))
59+
Task.log.info(s"Overwriting existing local Mill binary at ${targetFile}")
60+
os.copy.over(executable().path, targetFile, createFolders = true)
61+
Task.log.info(
62+
s"Published ${build.dist.allPublishModules.size} modules and installed ${targetFile}"
63+
)
64+
targetFile
65+
}
12466

12567
def artifactName: T[String]
12668
def artifact = Task { Artifact(Settings.pomOrg, artifactName(), build.millVersion()) }

integration/ide/bsp-server/resources/snapshots/build-targets-jvm-test-environments.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"file:///workspace/app/test/compile-resources",
1919
"file:///workspace/app/test/resources",
2020
"file:///workspace/out/mill-bsp-out/app/test/compile.dest/classes",
21-
"file:///mill-workspace/out/dist/localRepo.dest/com/lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar",
21+
"file:///user-home/.ivy2/local/com.lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/jars/mill-libs-javalib-testrunner-entrypoint.jar",
2222
"file:///coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"
2323
],
2424
"jvmOptions": [],
@@ -52,7 +52,7 @@
5252
"file:///workspace/hello-java/test/compile-resources",
5353
"file:///workspace/hello-java/test/resources",
5454
"file:///workspace/out/mill-bsp-out/hello-java/test/compile.dest/classes",
55-
"file:///mill-workspace/out/dist/localRepo.dest/com/lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar",
55+
"file:///user-home/.ivy2/local/com.lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/jars/mill-libs-javalib-testrunner-entrypoint.jar",
5656
"file:///coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"
5757
],
5858
"jvmOptions": [],
@@ -87,7 +87,7 @@
8787
"file:///workspace/hello-scala/test/compile-resources",
8888
"file:///workspace/hello-scala/test/resources",
8989
"file:///workspace/out/mill-bsp-out/hello-scala/test/compile.dest/classes",
90-
"file:///mill-workspace/out/dist/localRepo.dest/com/lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar",
90+
"file:///user-home/.ivy2/local/com.lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/jars/mill-libs-javalib-testrunner-entrypoint.jar",
9191
"file:///coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"
9292
],
9393
"jvmOptions": [],
@@ -135,7 +135,7 @@
135135
"file:///workspace/scripts/folder2/compile-resources",
136136
"file:///workspace/scripts/folder2/resources",
137137
"file:///workspace/out/mill-bsp-out/scripts/folder2/FooTest.java/compile.dest/classes",
138-
"file:///mill-workspace/out/dist/localRepo.dest/com/lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar",
138+
"file:///user-home/.ivy2/local/com.lihaoyi/mill-libs-javalib-testrunner-entrypoint/SNAPSHOT/jars/mill-libs-javalib-testrunner-entrypoint.jar",
139139
"file:///coursier-cache/https/repo1.maven.org/maven2/org/scala-sbt/test-interface/1.0/test-interface-1.0.jar"
140140
],
141141
"jvmOptions": [],

integration/ide/build-classpath-contents/src/BuildClasspathContentsTests.scala

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,37 @@ object BuildClasspathContentsTests extends UtestIntegrationTestSuite {
1818
.filter(_.startsWith(BuildCtx.workspaceRoot))
1919
.map(_.subRelativeTo(BuildCtx.workspaceRoot))
2020
.filter(!_.startsWith("out/integration"))
21-
.filter(!_.startsWith("out/dist/localRepo.dest"))
2221
.map(_.toString)
2322
.sorted
2423
if (sys.env("MILL_INTEGRATION_IS_PACKAGED_LAUNCHER") == "true") {
2524
assertGoldenLiteral(
2625
millPublishedJars,
2726
List(
28-
"mill-core-api-daemon_3-SNAPSHOT.jar",
29-
"mill-core-api_3-SNAPSHOT.jar",
30-
"mill-core-constants-SNAPSHOT.jar",
31-
"mill-libs-androidlib-databinding_3-SNAPSHOT.jar",
32-
"mill-libs-androidlib_3-SNAPSHOT.jar",
33-
"mill-libs-daemon-client-SNAPSHOT.jar",
34-
"mill-libs-daemon-server_3-SNAPSHOT.jar",
35-
"mill-libs-javalib-api_3-SNAPSHOT.jar",
36-
"mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar",
37-
"mill-libs-javalib-testrunner_3-SNAPSHOT.jar",
38-
"mill-libs-javalib_3-SNAPSHOT.jar",
39-
"mill-libs-javascriptlib_3-SNAPSHOT.jar",
40-
"mill-libs-kotlinlib-api_3-SNAPSHOT.jar",
41-
"mill-libs-kotlinlib-ksp2-api_3-SNAPSHOT.jar",
42-
"mill-libs-kotlinlib_3-SNAPSHOT.jar",
43-
"mill-libs-pythonlib_3-SNAPSHOT.jar",
44-
"mill-libs-rpc_3-SNAPSHOT.jar",
45-
"mill-libs-scalajslib-api_3-SNAPSHOT.jar",
46-
"mill-libs-scalajslib_3-SNAPSHOT.jar",
47-
"mill-libs-scalalib_3-SNAPSHOT.jar",
48-
"mill-libs-scalanativelib-api_3-SNAPSHOT.jar",
49-
"mill-libs-scalanativelib_3-SNAPSHOT.jar",
50-
"mill-libs-script_3-SNAPSHOT.jar",
51-
"mill-libs-util_3-SNAPSHOT.jar",
52-
"mill-libs_3-SNAPSHOT.jar",
27+
"mill-core-api-daemon_3.jar",
28+
"mill-core-api_3.jar",
29+
"mill-core-constants.jar",
30+
"mill-libs-androidlib-databinding_3.jar",
31+
"mill-libs-androidlib_3.jar",
32+
"mill-libs-daemon-client.jar",
33+
"mill-libs-daemon-server_3.jar",
34+
"mill-libs-javalib-api_3.jar",
35+
"mill-libs-javalib-testrunner-entrypoint.jar",
36+
"mill-libs-javalib-testrunner_3.jar",
37+
"mill-libs-javalib_3.jar",
38+
"mill-libs-javascriptlib_3.jar",
39+
"mill-libs-kotlinlib-api_3.jar",
40+
"mill-libs-kotlinlib-ksp2-api_3.jar",
41+
"mill-libs-kotlinlib_3.jar",
42+
"mill-libs-pythonlib_3.jar",
43+
"mill-libs-rpc_3.jar",
44+
"mill-libs-scalajslib-api_3.jar",
45+
"mill-libs-scalajslib_3.jar",
46+
"mill-libs-scalalib_3.jar",
47+
"mill-libs-scalanativelib-api_3.jar",
48+
"mill-libs-scalanativelib_3.jar",
49+
"mill-libs-script_3.jar",
50+
"mill-libs-util_3.jar",
51+
"mill-libs_3.jar",
5352
"mill-moduledefs_3-0.11.10.jar"
5453
)
5554
)

integration/ide/gen-idea/resources/extended/idea/mill_modules/mill-build.iml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -53,38 +53,38 @@
5353
<orderEntry type="library" scope="RUNTIME" name="logback-classic-1.5.18.jar" level="project"/>
5454
<orderEntry type="library" scope="RUNTIME" name="logback-core-1.5.18.jar" level="project"/>
5555
<orderEntry type="library" name="mainargs_3-0.7.7.jar" level="project"/>
56-
<orderEntry type="library" name="mill-core-api-daemon_3-SNAPSHOT.jar" level="project"/>
57-
<orderEntry type="library" name="mill-core-api_3-SNAPSHOT.jar" level="project"/>
58-
<orderEntry type="library" name="mill-core-constants-SNAPSHOT.jar" level="project"/>
59-
<orderEntry type="library" scope="RUNTIME" name="mill-core-eval_3-SNAPSHOT.jar" level="project"/>
60-
<orderEntry type="library" scope="RUNTIME" name="mill-core-exec_3-SNAPSHOT.jar" level="project"/>
61-
<orderEntry type="library" scope="RUNTIME" name="mill-core-internal-cli_3-SNAPSHOT.jar" level="project"/>
62-
<orderEntry type="library" scope="RUNTIME" name="mill-core-internal_3-SNAPSHOT.jar" level="project"/>
63-
<orderEntry type="library" scope="RUNTIME" name="mill-core-resolve_3-SNAPSHOT.jar" level="project"/>
64-
<orderEntry type="library" name="mill-libs-androidlib-databinding_3-SNAPSHOT.jar" level="project"/>
65-
<orderEntry type="library" name="mill-libs-androidlib_3-SNAPSHOT.jar" level="project"/>
66-
<orderEntry type="library" name="mill-libs-daemon-client-SNAPSHOT.jar" level="project"/>
67-
<orderEntry type="library" name="mill-libs-daemon-server_3-SNAPSHOT.jar" level="project"/>
68-
<orderEntry type="library" scope="RUNTIME" name="mill-libs-init_3-SNAPSHOT.jar" level="project"/>
69-
<orderEntry type="library" name="mill-libs-javalib-api_3-SNAPSHOT.jar" level="project"/>
70-
<orderEntry type="library" name="mill-libs-javalib-testrunner-entrypoint-SNAPSHOT.jar" level="project"/>
71-
<orderEntry type="library" name="mill-libs-javalib-testrunner_3-SNAPSHOT.jar" level="project"/>
72-
<orderEntry type="library" name="mill-libs-javalib_3-SNAPSHOT.jar" level="project"/>
73-
<orderEntry type="library" name="mill-libs-javascriptlib_3-SNAPSHOT.jar" level="project"/>
74-
<orderEntry type="library" name="mill-libs-kotlinlib-api_3-SNAPSHOT.jar" level="project"/>
75-
<orderEntry type="library" name="mill-libs-kotlinlib-ksp2-api_3-SNAPSHOT.jar" level="project"/>
76-
<orderEntry type="library" name="mill-libs-kotlinlib_3-SNAPSHOT.jar" level="project"/>
77-
<orderEntry type="library" name="mill-libs-pythonlib_3-SNAPSHOT.jar" level="project"/>
78-
<orderEntry type="library" name="mill-libs-rpc_3-SNAPSHOT.jar" level="project"/>
79-
<orderEntry type="library" name="mill-libs-scalajslib-api_3-SNAPSHOT.jar" level="project"/>
80-
<orderEntry type="library" name="mill-libs-scalajslib_3-SNAPSHOT.jar" level="project"/>
81-
<orderEntry type="library" name="mill-libs-scalalib_3-SNAPSHOT.jar" level="project"/>
82-
<orderEntry type="library" name="mill-libs-scalanativelib-api_3-SNAPSHOT.jar" level="project"/>
83-
<orderEntry type="library" name="mill-libs-scalanativelib_3-SNAPSHOT.jar" level="project"/>
84-
<orderEntry type="library" name="mill-libs-script_3-SNAPSHOT.jar" level="project"/>
85-
<orderEntry type="library" scope="RUNTIME" name="mill-libs-tabcomplete_3-SNAPSHOT.jar" level="project"/>
86-
<orderEntry type="library" name="mill-libs-util_3-SNAPSHOT.jar" level="project"/>
87-
<orderEntry type="library" name="mill-libs_3-SNAPSHOT.jar" level="project"/>
56+
<orderEntry type="library" name="mill-core-api-daemon_3.jar" level="project"/>
57+
<orderEntry type="library" name="mill-core-api_3.jar" level="project"/>
58+
<orderEntry type="library" name="mill-core-constants.jar" level="project"/>
59+
<orderEntry type="library" scope="RUNTIME" name="mill-core-eval_3.jar" level="project"/>
60+
<orderEntry type="library" scope="RUNTIME" name="mill-core-exec_3.jar" level="project"/>
61+
<orderEntry type="library" scope="RUNTIME" name="mill-core-internal-cli_3.jar" level="project"/>
62+
<orderEntry type="library" scope="RUNTIME" name="mill-core-internal_3.jar" level="project"/>
63+
<orderEntry type="library" scope="RUNTIME" name="mill-core-resolve_3.jar" level="project"/>
64+
<orderEntry type="library" name="mill-libs-androidlib-databinding_3.jar" level="project"/>
65+
<orderEntry type="library" name="mill-libs-androidlib_3.jar" level="project"/>
66+
<orderEntry type="library" name="mill-libs-daemon-client.jar" level="project"/>
67+
<orderEntry type="library" name="mill-libs-daemon-server_3.jar" level="project"/>
68+
<orderEntry type="library" scope="RUNTIME" name="mill-libs-init_3.jar" level="project"/>
69+
<orderEntry type="library" name="mill-libs-javalib-api_3.jar" level="project"/>
70+
<orderEntry type="library" name="mill-libs-javalib-testrunner-entrypoint.jar" level="project"/>
71+
<orderEntry type="library" name="mill-libs-javalib-testrunner_3.jar" level="project"/>
72+
<orderEntry type="library" name="mill-libs-javalib_3.jar" level="project"/>
73+
<orderEntry type="library" name="mill-libs-javascriptlib_3.jar" level="project"/>
74+
<orderEntry type="library" name="mill-libs-kotlinlib-api_3.jar" level="project"/>
75+
<orderEntry type="library" name="mill-libs-kotlinlib-ksp2-api_3.jar" level="project"/>
76+
<orderEntry type="library" name="mill-libs-kotlinlib_3.jar" level="project"/>
77+
<orderEntry type="library" name="mill-libs-pythonlib_3.jar" level="project"/>
78+
<orderEntry type="library" name="mill-libs-rpc_3.jar" level="project"/>
79+
<orderEntry type="library" name="mill-libs-scalajslib-api_3.jar" level="project"/>
80+
<orderEntry type="library" name="mill-libs-scalajslib_3.jar" level="project"/>
81+
<orderEntry type="library" name="mill-libs-scalalib_3.jar" level="project"/>
82+
<orderEntry type="library" name="mill-libs-scalanativelib-api_3.jar" level="project"/>
83+
<orderEntry type="library" name="mill-libs-scalanativelib_3.jar" level="project"/>
84+
<orderEntry type="library" name="mill-libs-script_3.jar" level="project"/>
85+
<orderEntry type="library" scope="RUNTIME" name="mill-libs-tabcomplete_3.jar" level="project"/>
86+
<orderEntry type="library" name="mill-libs-util_3.jar" level="project"/>
87+
<orderEntry type="library" name="mill-libs_3.jar" level="project"/>
8888
<orderEntry type="library" name="mill-moduledefs_3-0.11.10.jar" level="project"/>
8989
<orderEntry type="library" name="munit_3-0.7.29.jar" level="project"/>
9090
<orderEntry type="library" scope="RUNTIME" name="native-terminal-no-ffm-0.0.9.1.jar" level="project"/>

0 commit comments

Comments
 (0)