Commit graph

34 commits

Author SHA1 Message Date
Scott Schafer c239e407e7 add a reason to masquerade_as_nightly_cargo so it is searchable 2022-07-15 21:32:23 -05:00
Eric Huss 2c99f654c9 Update nightly failure notification. 2021-07-05 16:08:36 -07:00
Eric Huss 16b5402fd7 testsuite: Switch to colored diffs with Myers diff. 2021-06-16 15:43:29 -07:00
Eric Huss 393077f968 Add run_json to Execs.
This is a helper to run the process and return a JSON object.
2021-06-11 16:07:20 -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
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
Eric Huss 6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Oliver Scherer 95b22d2874 Emit the test field in cargo metadata 2020-07-30 09:50:46 +02:00
Alex Crichton 6514c289d2 Improve git error messages a bit
This commit is targeted at further improving the error messages
generated from git errors. For authentication errors the actual URL
fetched is now printed out as well if it's different from the original
URL. This should help handle `insteadOf` logic where SSH urls are used
instead of HTTPS urls and users can know to track that down.

Otherwise the logic about recommending `net.git-fetch-with-cli` was
tweaked a bit and moved to the same location as the rest of our error
reporting.

Note that a change piggy-backed here as well is that `Caused by:` errors
are now automatically all tabbed over a bit instead of only having the
first line tabbed over. This required a good number of tests to be
updated, but it's just an updated in renderings.
2020-06-25 08:47:15 -07:00
Eric Huss eac3b66bd4 Rework how Cargo computes the rustc file outputs. 2020-05-05 14:32:52 -07:00
Eric Huss aa80a984c0 Add unit-graph JSON output. 2020-03-15 15:16:36 -07:00
Matthias Krüger 1d912002e9 fix most remaining clippy findings (mostly redundant imports) 2020-02-21 12:15:16 +01:00
Eric Huss 83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Aleksey Kladov f0f73f04d1 Add value OUT_DIR to build-script-executed JSON message
The target audience here is IDE authors, who can use this feature to
better support crates which generate code to OUT_DIR
2019-11-22 21:48:04 +03: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
Vadim Petrochenkov 695931608a Update two tests for changes in rustc output 2019-08-10 01:57:00 +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
vlad20012 e1d433d30f Add doctest field into metadata
Some tools can support rust doctests (e.g. highlighting
or launching). So it should be possible to find out if
doctests are enabled for a target or not. This commit
adds `doctest` field to `cargo metadata` output.
2019-05-17 18:39:23 +03:00
Alex Crichton 6b28a0c050 Fix fingerprint handling in pipelining mode
This commit fixes an issue when pipelining mode is used in handling
recompilations. Previously a sequence of compilations could look like:

* Crate A starts to build
* Crate A produces metadata
* Crate B, which depends on A, starts
* Crate B finishes
* Crate A finishes

In this case the mtime for B is before that of A, which fooled Cargo
into thinking that B needed to be recompiled. In this case, however, B
doesn't actually need to be recompiled because it only depends on the
metadata of A, not the final artifacts.

This unfortunately resulted in some duplication in a few places, but not
really much moreso than already exists between fingerprinting and compilation.
2019-05-08 11:28:07 -07:00
Eric Huss 0b2b10b73c Cleanup: Misc. 2019-03-26 19:06:08 -07:00
Eric Huss 27a95d0e74 Some fingerprint cleanup. 2019-03-26 13:22:49 -07:00
Eric Huss 48d56a44cd Update metabuild test to 2018. 2018-12-17 19:58:32 -08:00
Eric Huss 2a0bb65a6f Switch SerializedTarget::src_path to None instead of using fake path. 2018-12-17 19:55:16 -08:00
Eric Huss 9a7fadf6bd Fix metabuild compile errors with --message-format=json.
If an error occurs while compiling a metabuild target with
`--message-format=json`, it would panic because it was unable to serialize
`Target`. This change makes it so that it places a fake "metabuild.rs" string in
the `src_path` in this situation.

I'm very unhappy with this solution, but I'm unable to think of something
better. Changing `src_path` to an `Option` (or something) would break existing
tools. I tried implementing something that resets the `src_path` to the correct
path in the target dir after the workspace is configured, but it felt very
brittle – you have to fix up after all dependencies are downloaded, and there's
not a good way to ensure that happens correctly.

This adds a `with_json_contains_unordered` to help with tests.
2018-12-17 19:55:16 -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 e8c1811f83
Fix metabuild::metabuild_build_plan 2018-11-18 18:39:08 +00:00
Eric Huss 20b5ca3dec Fix slow MacOS Travis issue. 2018-11-02 15:31:31 -07:00
Ted Mielczarek 20920c0131 Prefix build script output with crate name when running in extra verbose mode. Fixes #6158.
cargo's extra verbose mode is useful for getting detailed information out of
builds in CI where it can be difficult to examine the build environment
after-the-fact. However, when multiple build scripts are running as part of a
build it's not always clear what output is from which build script. This patch
makes cargo prefix each line of build script output with the crate name and
version this case.
2018-10-18 09:45:22 -04:00
Dale Wijnand 85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand b5ee3635ef
Wrap ProcessBuilder in Execs & make .cargo return that 2018-08-28 09:24:37 +01:00
Eric Huss ecc87b1795 New metabuild strategy using custom src_path enum.
- Use new enum `TargertSourcePath` for Target::src_path to make it explicit that metabuild has a special path.
- `cargo metadata` now skips the metabuild Target.
- JSON artifacts include the true path to the metabuild source file. This may not be the best solution, but it's unclear what it should be, and I would prefer to avoid breaking the output. Alternatively it could just not emit anything? I'm not completely familiar with the use case of these artifact messages.
- Place the file in `target/.metabuild/metabuild-pkgname-HASH.rs` instead of in the debug/release directory.  Its contents do not depend on the profile.
- Fix bug in write_if_changed.
- More tests.
2018-08-23 23:01:30 -07:00
Eric Huss 2be857af59 Metabuild (RFC 2196) 2018-08-23 13:31:50 -07:00