213 Commits

Author SHA1 Message Date
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
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
Eduardo Broto
0f20b2e478 Add test for CARGO_PRIMARY_PACKAGE 2020-10-14 23:35:00 +02:00
Eric Huss
ad34852f39 Update toml dependency 2020-10-12 11:22:45 -07:00
Weihang Lo
e4a1794b41
fix: emit errors instead of warnings when glob patterns not found 2020-10-10 09:50:36 +08:00
Weihang Lo
e5007de6e9
test: use with_stderr_unordered 2020-10-10 08:43:38 +08:00
Weihang Lo
8f0664f02a
test: normalize raw string indentation. 2020-10-10 07:44:57 +08:00
Weihang Lo
5e3dc46753
test: be consistent on error message styles 2020-10-10 06:58:06 +08:00
Weihang Lo
667a5aedfb
test(build): glob support for package selection 2020-10-05 01:24:42 +08:00
Weihang Lo
633e5f0048
test: glob support for target selection 2020-10-05 01:24:39 +08:00
Eric Huss
6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
bors
875e012325 Auto merge of #8655 - camelid:patch-1, r=ehuss
Lowercase and remove periods in error messages for consistency
2020-09-08 20:17:21 +00:00
Camelid
82c834cec2 Update tests 2020-09-07 10:57:00 -07:00
Alex Crichton
bf10871c32 Fix flakiness in close_output test
It looks like stdout/stderr can race as to which gets printed first, but
both are valid for this test.

Closes #8665
2020-08-31 13:15:30 -07:00
Eric Huss
191250b910 Fix close_output test. 2020-08-04 15:50:17 -07:00
bors
c4e93dc5ed Auto merge of #8566 - alexcrichton:less-output, r=ehuss
Don't print to raw stderr in test

Avoids polluting the output of tests with Cargo's build output.
2020-07-31 03:03:35 +00:00
Alex Crichton
d0983fb3f0 Don't print to raw stderr in test
Avoids polluting the output of tests with Cargo's build output.
2020-07-30 07:20:43 -07:00
Oliver Scherer
95b22d2874 Emit the test field in cargo metadata 2020-07-30 09:50:46 +02:00
Alex Crichton
005e1a442a Fix O0 build scripts by default without [profile.release]
This fixes an issue where #8500 didn't quite work as expected, since it
only worked if a crate had a `[profile.release]` section.
2020-07-29 08:41:11 -07:00
Esteban Küber
c46b9a70bd
Add support for rustc's -Z terminal-width.
This commit adds support for rustc's `-Z terminal-width` flag, which is
used to trim diagnostic output to fit within the current terminal.

Co-authored-by: David Wood <david@davidtw.co>
Signed-off-by: David Wood <david@davidtw.co>
2020-07-08 10:56:45 +01:00
bors
cf3bfc904d Auto merge of #8378 - jstasiak:backups, r=ehuss
Exclude the target directory from backups using CACHEDIR.TAG

This patch follows the lead of #4386 (which excludes target directories
from Time Machine backups) and is motived by the same reasons listen
in #3884. CACHEDIR.TAG is an OS-independent mechanism supported by Borg,
restic, GNU Tar and other backup/archiving solutions.

See https://bford.info/cachedir/ for more information about the
specification. This has been discussed in Rust Internals earlier this
year[1] and it seems like it's an uncontroversial improvement so I went
ahead with the patch.

One thing I'm wondering is whether this should maybe cover the whole main target directory (right now it applies to `target/debug`, `target/release` etc. but not to target root).

[1] https://internals.rust-lang.org/t/pre-rfc-put-cachedir-tag-into-target/12262/11
2020-07-02 14:49:38 +00:00
Jakub Stasiak
092781c1fa Compress two tests into one 2020-07-01 22:48:02 +02:00
Jakub Stasiak
f34b086949 Exclude whole target/ from backups
This is following the discussion on GitHub. The doc tests are no longer
necessary because Layout::new() creates CACHEDIR.TAG directly in target
root, no doc-specific code is necessary anymore.
2020-07-01 22:47:59 +02:00
Bryan Donlan
d19ff18347 Expose built cdylib artifacts in the Compilation structure
This change makes it much easier to find these artifacts in a
platform-independent way when writing automation around the cargo API.
2020-06-26 17:23:34 +00:00
Jakub Stasiak
3eb2ae045c Add two tests 2020-06-24 23:22:20 +02:00
bors
c26576f9ad Auto merge of #8387 - robinmoussu:master, r=alexcrichton
Adding environment variable CARGO_PKG_LICENSE_FILE

When #8325 was added, only CARGO_PKG_LICENSE was added. However, the field license [may be empty](https://doc.rust-lang.org/cargo/reference/manifest.html#the-license-and-license-file-fields) if the license_field is filled in.
2020-06-23 16:21:21 +00:00
bors
78c16716e6 Auto merge of #8323 - naerbnic:add_workspace_metadata_table, r=alexcrichton
Add support for `workspace.metadata` table

Implements feature request #8309

Additionally includes the information in the output of "cargo metadata" through a new top-level field `metadata`, similar to the per-package `metadata` field
2020-06-23 15:18:10 +00:00
Robin Moussu
3b39e3a73d Adding environment variable CARGO_PKG_LICENSE_FILE 2020-06-20 12:01:35 +02:00
Daniél Kerkmann
1e800abcab
Merge branch 'master' into license-field-as-environment-variable 2020-06-08 21:24:02 +02:00
bors
6f9d808323 Auto merge of #8270 - reggaemuffin:8251-binary-name-env-var, r=ehuss
Add environment variables to identify the binary and crate name

Closes #8251

This adds `CARGO_BIN_NAME` and `CARGO_CRATE_NAME` to rustc/rustdoc process env.

`CARGO_BIN_NAME` is added for binary compilation units, `CARGO_CRATE_NAME` is added for binary and library units.

The `build::crate_env_vars` test was updated to test for this. The test is currently only checking behavior for the binary compile unit.

Documentation was updated to reflect the added environment variables.
2020-06-08 13:53:33 +00:00
Daniél Kerkmann
8c99e2026b
Change test 'MIT' license to 'MIT OR Apache-2.0' 2020-06-06 10:24:06 +02:00
Brian Chin
866d4316e1 Add support for workspace.metadata table 2020-06-05 09:32:54 -07:00
Eric Huss
f975c2e588 Don't hash executable filenames on apple platforms. 2020-06-04 16:14:17 -07:00
Daniél Kerkmann
4a4f5a20fa
Adding environment variable CARGO_PKG_LICENSE
Fixes #8024
2020-06-04 02:51:16 +02:00
bors
5847787fef Auto merge of #8274 - Eh2406:8249-repro, r=alexcrichton
reset lockfile information between resolutions

#8249 pointed out that some kind of lockfile data was leaking between calls to the resolver. @ehuss made a reproducing test case. This PR resets the `LockedMap` data structure when calling `register_previous_locks`.

lets see if CI likes it.
fix #8249
2020-06-01 16:01:10 +00:00
Eric Huss
e2d1d2456c Fix several issues with close_output test. 2020-05-26 11:35:48 -07:00