-
Notifications
You must be signed in to change notification settings - Fork 105
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
Allow for aliases at the top level #187
Closed
Closed
Conversation
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
Raze settings come in the form of a [TOML] section like so ```toml [raze.crates.some-crate.'1.2.3'] some_new_setting = True ``` Where the version number (in the above example `1.2.3`) is a literal, hardcoded value. This works but is a little inflexible for dependencies, _especially_ dependencies that are transiant and update a lot (for instance `syn`). Since Cargo follows [Semver] we can use this fact, along with the richness of the exported and serialisable `semver::Version` types to perform section matching with [Semver] in the same fashion as Cargo itself. This means that the above example can be written with semver expressions, for example it can be written as: ```toml [raze.crates.some-crate.'1.2.*'] some_new_setting = True [raze.crates.some-crate.'~1.2.3'] some_new_setting = True [raze.crates.some-crate.'^1.2.3'] some_new_setting = True [raze.crates.some-crate.'=1.6.6'] some_new_setting = True ``` _Note_: Bare versions follow the semantics _as if they had_ specified a `^`, which is in keeping with [Cargo semver semantics] but is distinct from previous behaviour of raze (in which these would be interpreted as exacting or `=`). This is deliberate as we should aim to mirror the semantics of cargo as much as possible to avoid confusion. We presently do not allow for multiple matches in raze settings, this is intentional and is presented to the end user as an error. [TOML]: https://github.com/toml-lang/toml [Semver]: https://semver.org/spec/v2.0.0.html [Cargo semver semantics]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-cratesio
Previously aliases could only exist inside targets that cargo-raze depends on and not in the raze "root" crate itself. This means that a construction such as the following ```toml bytes = "2.0" bytes_old = { version = "1.0", package = "bytes" } ``` Could not allow for the production of top level bazel aliases such as: ```python "//cargo:bytes", "//cargo:bytes_old", ``` This naturally turns up in larger codebases where migrartions are in progress from one crate to another.
GregBowyer
force-pushed
the
aliases-at-root
branch
from
July 21, 2020 20:51
e5f4afe
to
1c70ba7
Compare
This was referenced Nov 4, 2020
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 6, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 6, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 6, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 6, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
This is dead in favor of #282 |
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 7, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 7, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Nov 9, 2020
…kages There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunatly, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targetting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of sublte aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Feb 4, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Feb 4, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Feb 5, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 23, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
GregBowyer
added a commit
to GregBowyer/cargo-raze
that referenced
this pull request
Apr 24, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes google#241, fixes google#269, fixes google#270, resolves google#144, resolves google#187
dfreese
pushed a commit
that referenced
this pull request
Aug 9, 2021
There are a range of subtle and irritating bugs that stem from attempting to work with renames from the package set provided by cargo metadata. Fortunately, recent versions of cargo metadata provide a limited version of the resolve nodes, both as the original node ids and as a newer set providing both rename and targeting information. As such we can (hopefully) simplify crate -> dep node resolution, remove a bunch of subtle aliasing bugs. Fixes #241, fixes #269, fixes #270, resolves #144, resolves #187
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So in closing out #123 for #162 an important use case was missed, that of allowing top level aliases in the cargo that raze itself is going to load.
This is pretty important for large monorepos where doing a full migration of types upfront is pretty challenging.
Previously aliases could only exist inside targets that cargo-raze
depends on and not in the raze "root" crate itself.
This means that a construction such as the following
Could not allow for the production of top level bazel aliases such as:
This naturally turns up in larger codebases where migrartions are in
progress from one crate to another.