David Calavera
1a8bfdf0cf
Update workspace manifest with new members.
...
When a user runs `cargo new` or `cargo init` within a workspace, Cargo will automatically add the new package to the members list in the workspace if necessary. The heuristic to add the new package is as follows:
- If there is no `members` list in the workspace yet, a new `members` list is created.
- If there is an `exclude` statement, Cargo checks if the new package should be excluded. If it doesn't match the `exclude` list, the package is added to the `members` list.
- If there is a glob expression in the `members` list that matches the new package, the package is not added to the `members` list.
- If the existent `members` list is sorted, Cargo tries to preserve the ordering when it adds the new package.
This change doesn't try to format the resulting `members` list in any way, leaving the formatting decissions to the user.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2023-10-28 07:42:23 -07:00
Ed Page
5cac7aa8c6
fix(toml): Remove redundant error messages
2023-08-24 16:19:48 -05:00
Scott Schafer
45c9c8e905
chore: update workspaces
tests to use check
2023-02-20 12:22:29 -06:00
Ed Page
6007f05a85
chore: Update to toml v0.6, toml_edit v0.18
...
`toml` replaces `toml_edit::easy`, using `toml_edit` as its parser.
2023-01-19 15:26:28 -06:00
Scott Schafer
ab18bd40d5
refactor(testsuite): Replace [project]
with [package]
2022-09-26 09:51:16 -06:00
bors
6fc517b1c3
Auto merge of #10784 - tedinski:fix-10783, r=epage
...
Allow '.' in workspace.default-members in non-virtual workspaces.
2022-07-16 02:32:05 +00:00
Scott Schafer
6070b0aab4
Add a test to check for regressions in selecting the correct workspace when there are nested workspaces
2022-07-13 21:10:22 -05:00
Ted Kaminski
380be40922
Allow '.' in workspace.default-members in non-virtual workspaces.
2022-07-13 21:19:31 +00:00
Scott Schafer
cab6d30c1d
fix typos found by the typos-cli
crate
2022-05-10 16:47:28 -05:00
Ed Page
320c279f43
Port cargo from toml-rs to toml_edit
...
Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
- Have `cargo init` add the current crate to the workspace, rather
than error
- #5586 : Upstream `cargo-add`
2022-01-13 09:27:27 -06:00
Weihang Lo
9c0d865389
fix: more error context for missing dep of workspace member
2021-04-17 14:24:29 +08:00
Weihang Lo
832fff8dd1
fix: more context when failed to load workspace member
2021-04-17 13:56:39 +08:00
Jade
de45c6f97a
Delete uses of the USER env var from tests
2021-03-22 13:39:18 -07:00
Eric Huss
fdb8ea1e03
Add some extra help to cargo new
and invalid package names.
2021-01-24 13:21:25 -08:00
Eduardo Broto
fb02ade261
Rework tests to avoid using -vv
...
Environment variables are represented differently in differents OSes in
the output.
Add tests checking if the variable is set instead.
2020-10-15 00:44:04 +02:00
Eduardo Broto
c12aed2fe4
Add tests for CARGO_PRIMARY_PACKAGE (workspaces)
2020-10-14 23:35:00 +02:00
Eric Huss
6f8c7d5a87
Normalize raw string indentation.
2020-09-26 17:59:58 -07:00
Thom Chiovoloni
b377c4bb17
Check for quux
binary in excluded_default_members_crate_glob
test (review feedback)
2020-07-20 09:38:20 -07:00
Thom Chiovoloni
b70a5962c3
Apply workspace.exclude to workspace.default-members.
2020-07-14 13:58:42 -07:00
Julian Wollersberger
d6a1428609
Rephrased error message for disallowed sections in virtual workspace
2020-05-14 10:26:20 +02:00
Eric Huss
4ae79d2ffd
Use fs helpers instead of File functions.
2020-04-17 07:56:16 -07:00
Eric Huss
b64d0f3645
Don't use debug display for error object.
2020-04-15 17:29:19 -07:00
Eric Huss
1eca786d7f
Add path to the failure to load a dependency.
2020-02-27 08:17:18 -08:00
Eric Huss
a07fec1b7b
Provide extra context on a query failure.
2020-02-25 10:17:11 -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
83571aee56
Minor testsuite organization.
2019-11-24 18:42:45 -08: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
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
k-nasa
7176df01d6
Change --all to --workspace
2019-09-03 17:14:34 -07:00
Wim Looman
53e84c571d
Only apply default-members when building root manifest
2019-08-19 14:47:02 -07:00
bors
85a52ce20e
Auto merge of #7242 - ehuss:vendor-ignore-dot, r=alexcrichton
...
`cargo vendor`: Don't delete hidden top-level files.
`cargo vendor` (without `--no-delete`) will delete all files in the `vendor/` directory when it starts. This changes it so that it will skip any entries starting with a dot. This allows one to track the vendor directory with a source control system like git.
Closes #7109
(Note: two commits, one is a test change.)
2019-08-13 22:47:50 +00:00
Eric Huss
b41c209af3
Bump toml 0.5.3
2019-08-13 14:56:22 -07:00
Eric Huss
3c20a24335
Clean up some git test support functions.
2019-08-12 22:25:36 -07:00
Alex Crichton
bdb0ce84e2
Don't suppress error messages with -q
...
If we're printing an error, make sure we always print it regardless of
verbosity settings!
2019-07-10 10:01:09 -07: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
Eric Huss
03932d610d
Fix new_warning_with_corrupt_ws missing "USER".
...
Also removed USER in all invocations to avoid this in the future.
2019-04-16 08:35:58 -07:00
Eric Huss
3c0626270d
Improve warning in cargo new
with parse error.
...
If `cargo new` fails to load a parent manifest (for whatever reason), it as not
displaying the reason why. Add the causes to provide more context.
2019-04-11 13:01:46 -07:00
Eric Huss
d7a9212409
Add more suggestions on how to deal with excluding a package from a workspace.
2019-03-31 17:52:36 -07:00
Eric Huss
e7124ba262
Testsuite: Make cwd()
relative to project root.
...
It's a fairly common pattern, and it seemed natural to me.
2019-03-20 16:34:56 -07:00
Alexander Regueiro
f7c91ba622
Various cosmetic improvements.
2019-02-20 10:58:27 +00:00
Dale Wijnand
37df042ba8
Test cleanup: remove unnecessary with_status(0)
2019-02-04 18:52:33 +01:00
Eric Huss
f58d107e7c
testsuite: Require failing commands to check output.
2018-12-28 17:59:36 -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
Eric Huss
6ad7794027
Include path to manifest in workspace warnings.
2018-11-07 11:17:29 -08:00
Eric Huss
5b2b5f9598
Warn/err on some unused manifest keys in workspaces.
2018-11-07 09:00:54 -08:00
Zach Lute
3492a3905c
Replace 'project' with 'package' in many strings and comments.
2018-09-20 23:47:09 -07:00
Alex Crichton
e2637b6599
Review comments!
2018-09-18 11:33:18 -07:00
Zach Lute
b020d3789a
Resolve merge conflicts with test string changes.
2018-09-09 16:48:57 -07:00