350 Commits

Author SHA1 Message Date
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
Daniel Wagner-Hall
556c236f9a Bump to semver 0.10 for VersionReq::is_exact
This stops using `to_string` as a proxy for this now-provided precise API.

This reverts commit b71927224fd9306b2b5bd2b4f8c22268eadfeb6a and bupms the
dependency version in Cargo.toml.
2020-05-25 11:11:45 +01:00
Eh2406
61e592788c remove all residual state from previous lock files 2020-05-24 17:31:31 -04:00
Eh2406
46b50bbb67 minimize test 2020-05-24 17:31:30 -04:00
Eric Huss
771b2bca76 Repro 2020-05-24 17:31:30 -04:00
ReggaeMuffin
50a537bf93
Add CARGO_BIN_NAME and CARGO_CRATE_NAME to rustc/rustdoc env
CARGO_BIN_NAME is added for binary compilation units, CARGO_CRATE_NAME is added for binary and library units. 

The `crate_env_vars` test was updated to test for this. The test is currently only checking behavior for the binary compile unit.
2020-05-23 16:23:49 +01:00
Eric Huss
0a5960bcfb Gracefully handle errors during a build. 2020-05-16 09:43:03 -07:00
Eric Huss
b19d6ac2a7 Update tests and comments for testing windows-gnu. 2020-04-21 11:00:37 -07:00
Mateusz Mikuła
9f742466f1 Update tests for windows-gnu 2020-04-21 17:25:25 +02:00
bors
1638705700 Auto merge of #8123 - ehuss:fix-windows-pdb-dash, r=alexcrichton
Fix pdb uplift when executable has dashes.

Windows `.pdb` files were not being uplifted for executables with dashes in their name. `rustc` calls the linker with the crate name (with underscores), which creates a pdb with underscores. Cargo renames the executable (`foo_bar.exe` to `foo-bar.exe`), and it was expecting the pdb to have the same form, but it doesn't.

Note: There shouldn't be any effect for using a debugger. Because the pdb path is embedded in the executable, the debugger was already looking in the `deps/` folder.  Uplifting is only useful if you want to copy the exe/pdb pair to some other machine.  In that case, it looks in the same directory as the `exe` for the pdb file.

Fixes #8117
2020-04-17 15:39:25 +00:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss
3acd15eb47 Fix pdb uplift when executable has dashes. 2020-04-16 18:02:47 -07:00
bors
239f2bfd0c Auto merge of #8069 - ehuss:build-finished, r=alexcrichton
Add "build-finished" JSON message.

This adds a JSON message when a build is finished.  This is useful for tools to know when to stop parsing JSON, which is particularly useful for commands like `cargo test` or `cargo run` where additional output may follow.

Closes #7978
2020-04-09 19:34:39 +00:00
Matt Stavola
fcff51b3e0
Add test for bad renaming 2020-04-08 23:46:30 -07:00