Merge branch 'basepath' of https://github.com/dpaoliello/rfcs into basepath

This commit is contained in:
Daniel Paoliello 2024-06-26 16:30:52 -07:00
commit 50a3735bf2
1 changed files with 5 additions and 4 deletions

View File

@ -30,7 +30,7 @@ relative paths (which makes refactoring and moving sub-projects very difficult)
and don't work at all if the mono-repo requires publishing and consuming from an
intermediate directory (as this may very per host, or per target being built).
This RFC proposes a mechanism to specify path bases in `Config.toml` or
This RFC proposes a mechanism to specify path bases in `config.toml` or
`Cargo.toml` files which can be used to prepend `path` dependencies. This allows
mono-repos to specify dependencies relative to their root directory, which
allows the consuming project to be moved freely (no relative paths to update)
@ -69,7 +69,7 @@ drive for performance reasons).
path (e.g., `../../../other_layer/foo` and `../foo`) and may be error prone if
there is some other sub-project in directory with the same name.
Instead, if we could specify these common paths as path bases in a `Config.toml`
Instead, if we could specify these common paths as path bases in a `config.toml`
(which may be generated by an external build system which in turn invokes Cargo):
```toml
@ -90,7 +90,8 @@ baz = { path = "this_layer/baz", base = "sources" }
Which resolves the issues we previously had:
* The current project can be moved without modifying the `Cargo.toml` at all.
* `bar_with_generated` works for all targets (assuming the `Config.toml` is
* `bar_with_generated` works for all targets (assuming the `config.toml` is
generated).
* The `intermediates` directory can be placed anywhere.
* Moving `foo` or `baz` only requires searching for the canonical form relative
@ -101,7 +102,7 @@ to the path base.
The ability to use path bases for `path` dependencies is convenient for
developers who are using a large number of `path` dependencies within the same
root directory. Instead of repeating the same path fragment many times in their
`Cargo.toml`, they can instead specify it once in a `Config.toml` as a path
`Cargo.toml`, they can instead specify it once in a `config.toml` as a path
base, then use that path base in each of their `path` dependencies.
Cargo can also provide built-in base paths, for example `workspace` to point to