-
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
Semver matching #127
Semver matching #127
Conversation
cd55849
to
1354598
Compare
This feature looks good to me, and is more user friendly than the original implementation. I originally justified my laziness here with the assumption that overrides/settings would need to be tweaked between versions, but in practice I haven't seen this be true and it's a nuisance to manually bump these versions. Can you rebase this off master now that #121 is merged? |
I'm not sure if this is waiting on me, or is stuck on something else. Is this ready to submit? Looks like it needs a rebase. |
I was going to write some unit tests but had not got around to it |
a7c9f59
to
a578c09
Compare
b52ca19
to
cc96241
Compare
@GregBowyer Hey, is this still relatively close to being done? Additionally, would this allow for me to also specify the following? [raze.crates.some-crate.'*']
some_new_setting = true |
It would / it does.
Personally I always do that with a range (sometimes crates remove / alter things a glob can mess up), but nothing is stopping that usage.
Its waiting on me not being lazy :S I will try to find some time this week.
…On Wed, Sep 9, 2020, at 7:55 AM, UebelAndre wrote:
@GregBowyer <https://github.com/GregBowyer> Hey, is this still relatively close to being done?
Additionally, would this allow for me to also specify the following?
[raze.crates.some-crate.'*']
some_new_setting = true
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#127 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAA6X3YWY24ITA7S6O73QQ3SE6JMNANCNFSM4KN3Y2QA>.
|
@GregBowyer Thanks! Really looking forward to this change getting in 😄 |
@GregBowyer Hey, just a friendly poke? Do you think you'll have some time this week for this pull request? 😅 |
cc96241
to
be0df8d
Compare
@UebelAndre its my top thing today (sorry took a while). Since you have built out an awesome test framework I can make good headway with ... some actual tests :P |
be0df8d
to
2bd28e8
Compare
Ok unit test pushed so we can take a review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after a rebase and some very picky nits.
2bd28e8
to
b306f63
Compare
Thanks for putting this together! Assuming CI passes, I'll go ahead and release this under 0.7.0 |
Looks like the examples need to be updated. |
Just git add examples/vendored? |
The vendored source should be ignored
|
Humm after running smoke-test then I get nothing for examples |
Oh, that's not the error.
|
b306f63
to
5e46892
Compare
Weird ... pushed the fix |
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
5e46892
to
0e1af3d
Compare
Released in 0.7.0 |
@dfreese how did you deploy? Isn't there normally a commit associated with a deploy? |
This is a little WIP, as we / I need to add unit and integration tests for this.
In reworking #123 a little, to allow for aliases to be presented in the "root" raze crate and to avoid a problem with crates presenting multiple versions of aliases I added in basic support for using the semver library to do matches for alias determination.
It occured to me, that rather than just use semver in that one specific place we should expose the richness of the semver objects into raze more generally. As such this commit exposes semver to raze and allows it to use semver for both version details and in matching configuration settings.
Semver Matching
Raze settings come in the form of a TOML section like so
Where the version number (in the above example
1.2.3
) is a literal, hardcodedvalue.
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 sectionmatching 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:
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.