-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Limit Task.Source
s to only targeting subfolders of the enclosing module that are not in sub-modules
#4447
Comments
So, what we want here is a new |
@lefou no, what I mean is to make both of these fail object foo extends Module{
def bar = Task.Source(millSourcePath / "../bar")
} object foo extends Module{
object bar extends Module{}
def qux = Task.Source(millSourcePath / "bar/qqux")
} Both currently work: |
Task.Source
s to only watching subfolders of the enclosing module that are not in sub-modulesTask.Source
s to only targeting subfolders of the enclosing module that are not in sub-modules
…bpath 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
…tly from subpath string literals (#4487) 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
This is a limitation that Bazel has, and it's worth considering if we should as well. There's some trickiness with things like cross modules that can share the
millSourcePath
, but overall I think we might be able to make it work.The text was updated successfully, but these errors were encountered: