Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Mill process working directory to sandbox #3367

Merged
merged 11 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion contrib/bloop/src/mill/contrib/bloop/Bloop.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package mill.contrib.bloop

import mill.eval.Evaluator
import mill.api.WorkspaceRoot

/**
* Usage : `mill mill.contrib.bloop.Bloop/install`
*/
object Bloop extends BloopImpl(() => Evaluator.allBootstrapEvaluators.value.value, os.pwd)
object Bloop extends BloopImpl(
() => Evaluator.allBootstrapEvaluators.value.value,
WorkspaceRoot.workspaceRoot
)
9 changes: 9 additions & 0 deletions example/thirdparty/acyclic/build.sc
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import mill._, scalalib._, publish._

// acyclic test suite assumes files are on disk at specific paths relative to `os.pwd`.
// To avoid changing the test code, we instead copy the necessary files into the `os.pwd`
// when preparing the resources for test suite execution
os.copy.over(
interp.watch(mill.api.WorkspaceRoot.workspaceRoot / "acyclic"),
os.pwd / "acyclic",
createFolders = true
)

object Deps {
def acyclic = ivy"com.lihaoyi:::acyclic:0.3.6"
def scalaCompiler(scalaVersion: String) = ivy"org.scala-lang:scala-compiler:$scalaVersion"
Expand Down
4 changes: 2 additions & 2 deletions example/thirdparty/netty/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ object common extends NettyModule{
val shell = new groovy.lang.GroovyShell()

val context = new java.util.HashMap[String, Object]
context.put("collection.template.dir", "common/src/main/templates")
context.put("collection.template.test.dir", "common/src/test/templates")
context.put("collection.template.dir", T.workspace + "/common/src/main/templates")
context.put("collection.template.test.dir", T.workspace + "/common/src/test/templates")
context.put("collection.src.dir", (T.dest / "src").toString)
context.put("collection.testsrc.dir", (T.dest / "testsrc").toString)
shell.setProperty("properties", context)
Expand Down
2 changes: 1 addition & 1 deletion integration/invalidation/watch-source-input/repo/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def lol = T{
def writeCompletionMarker(name: String) = {

Range(0, 10)
.map(i => os.pwd / "out" / s"$name$i")
.map(i => mill.api.WorkspaceRoot.workspaceRoot / "out" / s"$name$i")
.find(!os.exists(_))
.foreach(os.write(_, ""))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ abstract class IntegrationTestSuite extends TestSuite {

override def utestAfterEach(path: Seq[String]): Unit = {
runnerState = RunnerState.empty
if (integrationTestMode == "server") {
if (integrationTestMode == "server" || integrationTestMode == "local") {
// try to stop the server
try {
os.proc(millReleaseFileOpt.get, "shutdown").call(
Expand Down
12 changes: 8 additions & 4 deletions runner/client/src/mill/runner/client/MillProcessLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static Process configureRunMillProcess(ProcessBuilder builder,
builder.environment().put("MILL_WORKSPACE_ROOT", new File("").getCanonicalPath());
File sandbox = new java.io.File(serverDir + "/" + ServerFiles.sandbox);
sandbox.mkdirs();
// builder.directory(sandbox);
builder.directory(sandbox);
return builder.start();
}

Expand Down Expand Up @@ -88,7 +88,7 @@ static String javaExe() {
return "java";
}

static String[] millClasspath() {
static String[] millClasspath() throws Exception {
String selfJars = "";
List<String> vmOptions = new LinkedList<>();
String millOptionsPath = System.getProperty("MILL_OPTIONS_PATH");
Expand Down Expand Up @@ -121,10 +121,14 @@ static String[] millClasspath() {
if (selfJars == null || selfJars.trim().isEmpty()) {
throw new RuntimeException("MILL_CLASSPATH is empty!");
}
return selfJars.split("[,]");
String[] selfJarsArray = selfJars.split("[,]");
for(int i = 0; i < selfJarsArray.length; i++){
selfJarsArray[i] = new java.io.File(selfJarsArray[i]).getCanonicalPath();
}
return selfJarsArray;
}

static List<String> millLaunchJvmCommand(boolean setJnaNoSys) {
static List<String> millLaunchJvmCommand(boolean setJnaNoSys) throws Exception {
final List<String> vmOptions = new ArrayList<>();

// Java executable
Expand Down
Loading