You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow Task.Source/Task.Sources to be constructed directly from subpath string literals (#4486)
First step in #4447, by
providing an alternative to the previous `os.Path` APIs.
Effectively this allows us to replace
```scala
def mainScript = Task.Source { millSourcePath / "src/foo.py" }
```
with
```scala
def mainScript = Task.Source { "src/foo.py" }
```
Pulls in com-lihaoyi/os-lib#353 from upstream to
make constructing `os.SubPath`s more ergonomic by eliding the lead
`os.sub /` prefix in the case of literal strings while still maintaining
a degree of safety:
* "outer" paths starting with `..`s and absolute paths starting with `/`
are rejected at compile time
* Only literal strings are converted implicitly, anything non-literal
needs to be an explicit `os.SubPath`
For now we provide this as an alternative to passing in an absolute
`os.Path`, but probably 99% of scenarios should be using this sub-path
API rather than absolute paths since (a) it's more concise and (b) your
sources should be within your `millSourcePath` anyway. I'm not sure we
can get rid of the `os.Path`-taking API entirely, but we can definitely
de-prioritize it and call it `SourcesUnsafe` or something so that anyone
who needs it can use it but most people won't use it accidentally
0 commit comments