-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Mill process working directory to sandbox (#3367)
This makes `os.pwd` an empty directory: `out/mill-worker-*/sandbox/` for Mill's server mode, `out/mill-no-server/sandbox/` otherwise In general, code outside of tasks should use `millSourcePath`, while code inside of tasks should use `T.dest` or the `PathRef`s given to it by upstream tasks. Accessing project files via `os.pwd` can result in tasks not invalidating when files changed. Like #3347, this does not prevent people intentionally walking the filesystem to work mischieve, but it does help mitigate "accidental" usage of `os.pwd` to access project files. The original `os.pwd` is still made available as `mill.api.WorkspaceRoot.workspaceRoot` outside of tasks, or `T.workspace` inside of tasks, for the occasional scenarios that need it. But at least this adds some partial guardrails against accidentally using `os.pwd` in a way that subverts Mill's expectations, and the APIs that expose the workspace root can be appropriately documented to warn people against doing the wrong thing
- Loading branch information
Showing
6 changed files
with
26 additions
and
9 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
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 | ||
) |
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