forked from com-lihaoyi/mill
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow users to use a custom output dir via an env var (com-lihaoyi#3530)
This allows users to change the Mill output directory (by default, `out` under the project root) to a directory of their choice, via the `MILL_OUTPUT_DIR` environment variable. Fixes com-lihaoyi#3144
- Loading branch information
1 parent
41ef503
commit 4c3d2cb
Showing
14 changed files
with
154 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// The default location for Mill's output directory is `out/` under the project workspace. | ||
// A task `printDest` of a module `foo` will have a default scratch space folder | ||
// `out/foo/printDest.dest/`: | ||
package build | ||
|
||
import mill._ | ||
|
||
object foo extends Module { | ||
def printDest = Task { | ||
println(T.dest) | ||
} | ||
} | ||
|
||
/** Usage | ||
> ./mill foo.printDest | ||
... | ||
.../out/foo/printDest.dest | ||
*/ | ||
|
||
// If you'd rather use another location than `out/`, that lives | ||
// in a faster or a writable filesystem for example, you can change the output directory | ||
// via the `MILL_OUTPUT_DIR` environment variable. | ||
|
||
/** Usage | ||
> MILL_OUTPUT_DIR=build-stuff/working-dir ./mill foo.printDest | ||
... | ||
.../build-stuff/working-dir/foo/printDest.dest | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package build | ||
|
||
import mill._ | ||
import mill.scalalib._ | ||
|
||
object `package` extends RootModule with ScalaModule { | ||
def scalaVersion = scala.util.Properties.versionNumberString | ||
} |
41 changes: 41 additions & 0 deletions
41
integration/feature/output-directory/src/OutputDirectoryTests.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package mill.integration | ||
|
||
import mill.main.client.{EnvVars, OutFiles} | ||
import mill.testkit.UtestIntegrationTestSuite | ||
import utest._ | ||
|
||
object OutputDirectoryTests extends UtestIntegrationTestSuite { | ||
|
||
def tests: Tests = Tests { | ||
test("Output directory sanity check") - integrationTest { tester => | ||
import tester._ | ||
eval("__.compile").isSuccess ==> true | ||
val defaultOutDir = workspacePath / OutFiles.defaultOut | ||
assert(os.isDir(defaultOutDir)) | ||
} | ||
|
||
test("Output directory elsewhere in workspace") - integrationTest { tester => | ||
import tester._ | ||
eval( | ||
"__.compile", | ||
env = millTestSuiteEnv + (EnvVars.MILL_OUTPUT_DIR -> "testing/test-out") | ||
).isSuccess ==> true | ||
val expectedOutDir = workspacePath / "testing/test-out" | ||
val defaultOutDir = workspacePath / OutFiles.defaultOut | ||
assert(os.isDir(expectedOutDir)) | ||
assert(!os.exists(defaultOutDir)) | ||
} | ||
|
||
test("Output directory outside workspace") - integrationTest { tester => | ||
import tester._ | ||
val outDir = os.temp.dir() / "tmp-out" | ||
eval( | ||
"__.compile", | ||
env = millTestSuiteEnv + (EnvVars.MILL_OUTPUT_DIR -> outDir.toString) | ||
).isSuccess ==> true | ||
val defaultOutDir = workspacePath / OutFiles.defaultOut | ||
assert(os.isDir(outDir)) | ||
assert(!os.exists(defaultOutDir)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.