55 Commits

Author SHA1 Message Date
Eric Huss
fd258634c9 Improvements to StringList config handling. 2020-02-16 15:29:59 -08:00
Eric Huss
0279e8e63a Fix using global options before an alias. 2020-01-31 13:56:06 -08:00
Eric Huss
77ee608de3 Add named config profiles. 2020-01-13 13:27:33 -08:00
Alex Crichton
d7b45f9992 Use context to create a chain of errors
There's an existing bug (#7782) in Cargo which exacerbates the issue
here but in general having a stack of errors is a bit easier to read and
work with than having a big long error message.
2020-01-09 10:29:22 -08:00
Alex Crichton
3a18c89a55 Migrate from the failure crate to anyhow
The `anyhow` crate interoperates with the `std::error::Error` trait
rather than a custom `Fail` trait, and this is the general trend of
error handling in Rust as well.

Note that this is mostly mechanical (sed) and intended to get the test
suite passing. As usual there's still more idiomatic cleanup that can
happen, but that's left to later commits.
2020-01-07 16:50:09 -08:00
Eric Huss
829ddf0dc8 Fix config env vars that are prefix of another with underscore. 2019-12-23 18:13:50 -08:00
Eric Huss
e7eda2f91f Implement config-include. 2019-12-19 09:44:02 -08:00
Eric Huss
91015d52ce Add --config CLI option. 2019-12-19 09:44:02 -08:00
Eric Huss
2e5796d4e8 Store Definition in ConfigValue. 2019-12-19 09:44:02 -08:00
Eric Huss
6d95721ec5 Add a ConfigBuilder for tests. 2019-12-19 09:44:01 -08:00
Eric Huss
381251aa1f Config refactoring. 2019-12-19 09:44:01 -08:00
Eric Huss
83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Eric Huss
fcfe0b8988 Rename overrides to package in profiles. 2019-10-10 14:39:30 -07:00
Alex Crichton
d7d8ca1e12 Consolidate build key configuration
Add a typed structure which lists all `build` key configuration
throughout Cargo.
2019-10-07 17:12:03 -07:00
Alex Crichton
37ace8886a Finish implementing Value, use it in helpers
Rewrite helpers like `get_bool` to use `get::<Option<Value<bool>>>`
instead of duplicating the logic that's already with the typed access of
configuration. This is more along the effort to centralize all
deserialization of configuration into typed values instead of using
ad-hoc accessors in a number of locations.
2019-10-07 17:12:03 -07:00
Alex Crichton
c0baf844e3 Refactor ConfigKey to its own file
Also make it a little less allocation-heavy by tweaking the API to
encourage incremental building of the key and incremental destruction as
we walk throughout the configuration tree.
2019-10-07 17:12:03 -07:00
bors
8b0561d68f Auto merge of #6989 - da-x:custom-profile-pr-rfc, r=ehuss
Support for named profiles (RFC 2678)

Tracking issue: https://github.com/rust-lang/cargo/issues/6988

Implementation according to the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2678-named-custom-cargo-profiles.md).
2019-09-30 19:51:19 +00:00
Guanqun Lu
852cf05365 add a bit more docs 2019-10-01 00:06:34 +08:00
Guanqun Lu
a4e3b81a55 run cargo fmt to pass the CI build 2019-09-30 23:48:08 +08:00
Guanqun Lu
ba1f16a7a4 fixes 2019-09-30 00:32:57 +08:00
Guanqun Lu
0e5d378e04 modify to enum/struct and add test for SslVersionConfig 2019-09-30 00:29:15 +08:00
Dan Aloni
375a46f18b Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-18 08:56:13 +03:00
Alex Crichton
ebd10526f3 Run rustfmt 2019-09-16 12:00:12 -07:00
Alex Crichton
9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Dan Aloni
f0896975be Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-09-08 21:43:41 +03:00
Zach Lute
7119683251 Symlinking 'config' to 'config.toml' should not produce a warning.
Also true cor symlinking 'credentials.toml' to 'credentials'.

This will allow users to run multiple versions of Cargo without generating a warning if they want to use the .toml versions.

Note that Windows symlinks require special permission, so in the case the user doesn't have that permission, we don't run the symlink tests. This matches behavior in Rust libstd.
2019-08-29 00:39:15 -07:00
Zach Lute
c530720b29 Allow using 'config.toml' instead of just 'config' files.
Note that this change only makes 'config.toml' optional to use instead of 'config'. If both exist, we will print a warning and prefer 'config', since that would be the existing behavior if both existed.

We should also consider a separate change to make config.toml the default and update docs, etc.
2019-08-24 12:43:15 -07:00
Eric Huss
b41c209af3 Bump toml 0.5.3 2019-08-13 14:56:22 -07:00
Dan Aloni
27da33c67d Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-07-28 09:24:31 +03:00
Alex Crichton
c2354b9a11 Setup CI with Azure Pipelines 2019-07-23 09:09:41 -07:00
Dan Aloni
87183146d9 Merge remote-tracking branch 'origin/master' into custom-profile-pr-rfc 2019-06-20 16:18:42 +03:00
Jethro Beekman
0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Dan Aloni
bb86a5c3f4 tests: config_load_toml_profile fixup 2019-06-01 15:06:45 +03:00
Dan Aloni
55f4b67555 tests: fix and extend config_load_toml_profile for RFC 2689 2019-06-01 13:44:07 +03:00
Eric Huss
309eb874fd Stabilize offline mode. 2019-05-12 10:49:45 -07:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements. 2019-02-20 10:58:27 +00:00
Dale Wijnand
920d552750
Replace CargoError with failure::Error 2018-12-12 23:25:08 +00:00
Alex Crichton
b8b7faee50 Run cargo fix --edition-idioms and fixup output
This gets Cargo passing the `--edition-idioms` lints and more down the
road of the 2018 edition!
2018-12-11 05:45:46 -08:00
Alex Crichton
fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand
04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Dale Wijnand
85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand
c9b59deb3a
Resolve 4 unreadable_literal lint warnings 2018-08-13 11:10:03 +01:00
Matthias Krüger
8798bf0d28 fix a bunch of clippy warnings (invocation: cargo clippy --all-targets --all-features -- --cap-lints warn )
Special thanks to dwijnand for helping me with this! :)
2018-08-12 10:00:12 +02:00
Dale Wijnand
16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand
05400b8018
Drop the [/] test output macro 2018-08-02 10:18:48 +01:00
Alex Crichton
adbd625e35 Upgrade to failure 0.1.2 idioms
Fixes some deprecation warnings in Cargo
2018-08-01 07:20:04 -07:00
Dale Wijnand
43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00
Dale Wijnand
7fe2fbc8a3
Remove the argument from the project test support function
By rewriting the tests, with rerast (https://github.com/google/rerast),
to use the newly introduced "at" method.

First I added the following temporary function to cargotest::support:

    pub fn project_foo() -> ProjectBuilder {
        project("foo")
    }

Then I defined the following rewrite.rs:

    use cargotest::support::{ project, project_foo };

    fn rule1(a: &'static str) {
        replace!(project("foo") => project_foo());
        replace!(project(a) => project_foo().at(a));
    }

Then I ran rerast:

    cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs

Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).

    find tests -type f -exec sed -i -e 's/project_foo/project/g' {} +
    git clean -d tests
2018-07-20 13:31:50 +01:00
Eh2406
75bb190664 default tests to stable and override where needed 2018-06-29 15:21:05 -04:00
Eric Huss
154c787c72 Add -Z advanced-env feature flag. 2018-05-23 09:30:54 -07:00