347 Commits

Author SHA1 Message Date
hi-rustin
154f372b6b Warning on conflicting dev-dependencies keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
hi-rustin
a317aff9b8 Warning on conflicting crate_types keys
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-03-09 23:16:38 +08:00
bors
c9a8199e92 Auto merge of #10372 - weihanglo:issue-9325, r=ehuss
Test: ensure dep-infos do not collide when cdylib and bin coexist
2022-02-25 18:08:41 +00:00
Loïc BRANSTETT
4ac4f3d9ab Add test for -Z check-cfg-features with namespaced features 2022-02-22 18:43:12 +01:00
Loïc BRANSTETT
a864c81549 Disable -Z check-cfg-features tests on windows due to weird normalization issues
See https://github.com/rust-lang/cargo/runs/5290789288?check_suite_focus=true
Where the expected is: --check-cfg 'values(feature, "f_a", "f_b")'
But we got: --check-cfg "values(feature, /"f_a/", /"f_b/")"
2022-02-22 18:33:03 +01:00
Loïc BRANSTETT
03fbb2eda8 Add -Z check-cfg-features to enable compile-time checking of features 2022-02-22 16:47:52 +01:00
Weihang Lo
e2142487d4
Test: ensure dep-infos do not collide when cdylib and bin coexist
A new test `build::no_dep_info_collision_when_cdylib_and_bin_coexist`
is added to prevent regression.

Note that on Windows MSVC cargo does not use metadata, so a collision
still happens when cdylib and bin targets coexist.
2022-02-08 22:51:18 +08:00
bors
bb96b3a3e8 Auto merge of #10086 - epage:toml, r=ehuss
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`

TODO
- [x] Analyze performance and address regressions
- [x] Identify and resolve incompatibiies
- [x] Resolve remaining test failures, see
      https://github.com/ordian/toml_edit/labels/cargo
- [x] ~~Switch the code from https://github.com/rust-lang/cargo/pull/10176 to only parse once~~ (this PR is being merged first)
2022-01-20 03:56:18 +00:00
bors
95bb3c92bf Auto merge of #10243 - hi-rustin:rustin-patch-collision, r=ehuss
Error when setting crate type of both dylib and cdylib in library

close https://github.com/rust-lang/cargo/issues/10231

Error when setting crate type of both dylib and cdylib in library. Cargo can't support that at this time, since they both output the same filename.
2022-01-18 17:39:35 +00:00
hi-rustin
3738002e43 Error when setting crate type of both dylib and cdylib in library
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-16 17:38:43 +08:00
maxwase
2623af0c43 Use is_symlink() method 2022-01-14 00:36:24 +03: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
bors
2478331215 Auto merge of #10214 - weihanglo:revert-10188-issue-9528, r=alexcrichton
Be resilient to most IO error and filesystem loop while walking dirs

Let `PathSource::walk` be resilient to most IO errors and filesystem loop.

This PR also

- Add a test validating the resilience against filesystem loop to prevent regression.
- Emit warning when filesystem loop found while walking the filesystem. This is the only way I can think of now to solve #9528

Fixes #10213.
2022-01-05 22:10:29 +00:00
Josh Triplett
65ddbbdfb3 Remove the option to disable pipelining
Cargo has had pipelining enabled by default for a long time, without
issue. Remove support for `build.pipelining = false`. (Continue parsing
the option from the config file, but ignore it.)
2022-01-05 10:25:23 -08:00
Weihang Lo
d92dceaeba
Test IO error resilience while walking directories
Remove `build_script::build_script_scan_eacces`  test case because cargo
ignores it and returns its path during a `cargo build`. The caller still
has a chance to hit the IO error if they does access it.
2022-01-05 14:29:59 +08:00
Weihang Lo
6f912788ed
Test cargo build being resilient to filesystem loop 2021-12-21 02:46:05 +08:00
Josh Triplett
2f53ca2df1 Support abbreviating --release as -r
Of the options people regularly pass to cargo, `--release` seems by far
the most common. Yet even on the command line, we expect people to type
out `--release`.

Add a short version `-r`, and add some tests in the testsuite that
confirm it works.
2021-11-28 20:25:57 -08:00
hi-rustin
a22a68e937 re-enabled lto_build test on 32-bit MSVC
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-22 22:12:48 +08:00
Weihang Lo
2698bc6a42
Test for target auto-discovery error enhancement 2021-11-17 18:14:27 +08:00
Weihang Lo
0afd40b4de
Update tests to display dep-req info for dep-chain 2021-08-24 00:39:38 +08:00
bors
216f915c46 Auto merge of #9814 - ehuss:move-tmp, r=alexcrichton
Move `tmp` test directory.

The `tmp` directory added in #9375 was placed within the profile directory (such as `target/debug/tmp` or `target/release/tmp`).  This causes problems for any cargo target (binary, test, etc.) with the name `tmp` as there is a name collision.  This PR attempts to address that by moving the `tmp` directory to the root of the target directory (`target/tmp`), and reserving the profile name "tmp".

Fixes #9783
2021-08-20 22:23:14 +00:00
Eric Huss
cfcb0786dd Fix test incorrectly validating CARGO_PKG_LICENSE_FILE. 2021-08-20 12:16:25 -07:00
Eric Huss
4e7fe836d5 Move tmp test directory. 2021-08-20 12:12:42 -07:00
Weihang Lo
8c75e2ffa0
Update tests to use registry names 2021-07-22 00:50:30 +08:00
Joshua Nelson
9c7cc545d7 Combine rustc and cargo's diagnostic summaries
This works by introspecting rustc's error output, using the JSON format
to determine whether it's a warning or error, then skipping it
altogether if it's a summary of the diagnostics printed.

Before:

```
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: aborting due to 2 previous errors; 1 warning emitted
error: could not compile `wrong`

```

After:

```
$ cargo check --message-format short
src/main.rs:1:10: warning: trait objects without an explicit `dyn` are deprecated
src/main.rs:1:1: error[E0601]: `main` function not found in crate `wrong`
src/main.rs:1:9: error[E0038]: the trait `Clone` cannot be made into an object
error: could not compile `wrong` due to 2 previous errors; 1 warning emitted
```
2021-07-06 19:46:27 -04:00
bors
9233aa06c8 Auto merge of #9607 - hi-rustin:rustin-patch-cargo-toml, r=ehuss
Detect incorrectly named cargo.toml

close https://github.com/rust-lang/cargo/issues/9541
2021-06-22 21:32:55 +00:00
hi-rustin
b3a1d0ceba Only testing on linux 2021-06-22 15:36:32 +08:00
hi-rustin
cb1a3f05f0 Detect incorrectly named cargo.toml for build 2021-06-22 15:31:28 +08:00
Eric Huss
c0dca04f49 Disambiguate is_symlink. 2021-06-19 11:27:14 -07:00
Henri Francois
0663b713b7 Handling job=0 argument in cargo config files. 2021-06-17 09:18:59 -07:00
Eric Huss
e132bb53ab Move comparison and diffing code to a new module.
This includes various minor refactorings to try to clean things up
and provide better error messages.
2021-06-16 09:44:29 -07:00
Eric Huss
47a02919cc Fix rustc/rustdoc config values to be config-relative paths. 2021-06-09 17:46:18 -07:00
Eric Huss
7b229bbe39 Move the rustc-echo-wrapper to be shared across tests.
This helps avoid rebuilding the same project several times.
2021-06-09 17:13:33 -07:00
David Tolnay
3b62e466ec
Update to semver 1.0.0-rc 2021-05-25 17:42:05 -07:00
Vojtech Kral
64bfe7f1de Add CARGO_TARGET_TMPDIR env var for integration tests & benches
The variable is set to $target_dir/$config/tmp
This is a directory where tests & benches can place testcasei-related data
for use by the tests.
cargo makes sure the directory exists when building tests/benches.
2021-05-06 23:47:28 +02:00
Eric Huss
1dae5acb7d Move paths to cargo-util. 2021-03-20 17:42:41 -07:00
Simonas Kazlauskas
548300b20f Add the path to the manifest in json output
This allows consumers of the json messages to avoid guessing where
exactly the package root is. Having access to the package root is
difficult by virtue of requiring logic to guess its location by e.g.
walking filesystem from the source file.

This guessing logic becomes further complicated in presence of
workspaces and nigh impossible to implement correctly in instances where
artifacts end up produced from paths above the package root (e.g.
`../foo.rs`).

Since Cargo has access to this data in the first place, there doesn't
seem to be much reason to force consumers to invent their own, possibly
flawed, logic.
2021-03-04 20:09:51 +02:00
Orson Peters
07cc897a4f Added support for negative --jobs parameter, counting backwards from max CPUs. 2021-03-01 17:05:22 +01:00
Eric Huss
0f78dbd38e testsuite: Use split debuginfo on macos. 2021-02-25 09:06:11 -08:00
Eric Huss
bb7ec2fcee Fix hang on broken stderr. 2021-02-23 18:15:44 -08:00
bors
aaaf296ab7 Auto merge of #9112 - alexcrichton:split-debuginfo, r=ehuss
Add split-debuginfo profile option

This commit adds a new `split-debuginfo` option to Cargo compilation
profiles which gets forwarded to the `-Csplit-debuginfo` codegen option
in rustc. This commit also sets the default, only on macOS, to be
`-Csplit-debuginfo=unpacked`. The purpose of this change is to leverage
rust-lang/rust#79570 to avoid running `dsymutil` on incremental builds
while also preserving a pleasant debugging experience by default. This
should lead to much faster incremental build times on macOS since
`dsymutil` isn't exactly the speediest tool in the world.

This is technically a breaking change in Cargo because we're no longer
by-default producing the `*.dSYM` folders on macOS. If those are still
desired, however, authors can always run `dsymutil` themselves or
otherwise configure `split-debuginfo = 'packed'` in their
manifest/profile configuration.
2021-02-03 22:50:15 +00:00
Eric Huss
d8673d93d2 Fix env/cfg set for cargo test and cargo run. 2021-02-01 19:20:54 -08:00
Alex Crichton
ed4568e108 Add split-debuginfo profile option
This commit adds a new `split-debuginfo` option to Cargo compilation
profiles which gets forwarded to the `-Csplit-debuginfo` codegen option
in rustc. This commit also sets the default, only on macOS, to be
`-Csplit-debuginfo=unpacked`. The purpose of this change is to leverage
rust-lang/rust#79570 to avoid running `dsymutil` on incremental builds
while also preserving a pleasant debugging experience by default. This
should lead to much faster incremental build times on macOS since
`dsymutil` isn't exactly the speediest tool in the world.

This is technically a breaking change in Cargo because we're no longer
by-default producing the `*.dSYM` folders on macOS. If those are still
desired, however, authors can always run `dsymutil` themselves or
otherwise configure `split-debuginfo = 'packed'` in their
manifest/profile configuration.
2021-02-01 09:21:36 -08:00
Eric Huss
fdb8ea1e03 Add some extra help to cargo new and invalid package names. 2021-01-24 13:21:25 -08:00
Eric Huss
b04c7fb849 Add suggestion for bad package id. 2021-01-22 13:38:53 -08:00
Eric Huss
60143816bf Bump to 0.52.0 2021-01-03 14:56:35 -08:00
Eduardo Broto
f838a003f1 Stabilize RUSTC_WORKSPACE_WRAPPER 2020-12-13 23:50:15 +01:00
ayazhafiz
e831dd12a8 Publish target's "doc" setting when emitting metadata
Prior to this commit `cargo metadata` would not emit the value of a
target's "doc" setting, used by `cargo doc` to determine whether
documentation should be generated. However, this information is useful
for machine programs interested in such targets, and the information is
already made available on the internal representation of a target, so
this commit just exposes that during target serialization for emit.

cf https://github.com/deadlinks/cargo-deadlinks/issues/99
2020-11-17 19:54:17 -06:00
Weihang Lo
d613cd66c7
Merge branch 'master' into feat/glob-pattern 2020-10-18 08:48:30 +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