79 Commits

Author SHA1 Message Date
Ed Page
5b84fc99c5 feat(test): Snapshot .crate validation 2024-10-17 06:26:47 +08:00
elchc
ed294ab4e7 test: cargo tree panic on artifact dep target deactivated 2024-10-10 22:21:50 -04:00
Lucas Kent
5c5ea78ecd Fix panic when running cargo tree on a package with a cross compiled bindep 2024-10-10 21:34:19 -04:00
Lucas Kent
1623c414ad improve error reporting when feature not found in activated_features 2024-10-05 17:10:54 -04:00
Weihang Lo
3f1b82893a
test(artifact_dep): relax compiler panic assertions 2024-09-30 13:26:49 -04:00
Ed Page
5e35e271bc feat(toml): Add autolib
PR #5335 added `autobins`, etc for #5330.  Nowhere in there is
discussion of `autolib`.

Cargo script disables support for additional build-targets by disabling
discovery.
Except we don't have a way to disable discovery of `autolib`, leading to #14476.
By adding `autolib`, we can continue in that direction.

This also allows us to bypass inferring of libs on published packages,
like all other build-targets which were handled in #13849.

As this seems fairly low controversy, this insta-stabilizes the field.
In prior versions of Cargo, users will get an "unused manifest key"
warning.
For packags where this is set by `cargo publish`, the warning will be suppressed and things will work as normal.
For `cargo vendor`, the same except there will be some churn in the
vendored source as this field will now be set.
For local development, it should be rare to set `autolib` so the lack of
error by discovering a file when this is set shouldn't be a problem.

Fixes #14476
2024-09-24 11:24:24 -05:00
Ed Page
a6cf1be655 test: Switch from allow to expect deprecated
This caught a couple of lingering items.
2024-09-23 20:44:06 -05:00
Ed Page
d2ec764995 fix(resolve): Dont show locking workspace members
This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
2024-08-22 16:57:06 -05:00
Ed Page
fd8a91d185 fix(test): Un-redact Packaged files
This is a partial revert of ##14121
(e11d1722bb6e1e58c91adb1964993c74b45f4293)

Our focus for redacting (auto or with globs) includes
- run-specific information (timing, hashes, platform-specific wording)
- rustc-specific information

(We tend to use globs for rustc-specific information because there might
be some very specific times we need to care about some of the details)

However, "Packaged files" does not fit into any of that and, for now, we
are erring on the side of redacting less, rather than more, with the
move to snapbox.
As we see how it works out and what the underlying requirements are, we
can revisit this.
2024-06-21 11:05:41 -04:00
bors
922960916d Auto merge of #14121 - dieterplex:redact-file-num, r=weihanglo
test: Auto-redact file number

This is from <https://github.com/rust-lang/cargo/pull/14096#discussion_r1648889843>.

Although the number of files in `cargo package` is important,
we have `validate_crate_contents` and `validate_upload_with_contents`
that verify the exact contents.
Redacting `Packaged` status should be fine.
2024-06-21 13:14:27 +00:00
Ed Page
601ab1aaea test: Add missing edition fields 2024-06-19 15:00:47 -05:00
d1t2
e11d1722bb
test: Auto-redact file number 2024-06-19 20:00:56 +08:00
Ed Page
7d9e9e12f0 test: Redact conditional compile-fail warning
I got a CI failure because the following line showed up:
```
[WARNING] build failed, waiting for other jobs to finish...
```
I'm assumin this is a race condition in the test for whether the
successful target completed before the error or not.

Before snapbox, we used a `contains` check which didn't have this
problem.  I'm replacing this with a `...` multi-line (0+) glob.
2024-06-13 15:28:06 -05:00
Scott Schafer
b08fb91f23
test: Resolve artifact_dep deprecations 2024-06-12 13:31:55 -06:00
Ed Page
dc5ac62cab fix(test): Deprecate non-snapbox assertions
While this is noisy and hides other deprecations, I figured deprecations would
make it easier for people to discover what tasks remain and allow us to
divide and conquer this work rather than doing a heroic PR.
In theory, this will be short lived and we'll go back to seeing
deprecations in our tests.
2024-06-10 10:20:52 -05:00
Ed Page
3054936cab refactor: Port from assert_matches_exact to assert_e2e
This leaves off `validate_crate_contents` as that would be an effort on
its own
2024-05-29 14:08:10 -05:00
Weihang Lo
88ac4aaf2e
test: switch to assert_match_exact
There is no need to provide additional messages here.
2024-05-07 14:24:43 -04:00
Herman Skogseth
9a5cfbcbb9 Only build the specified artifact library when multiple types are available 2024-05-07 13:20:30 +02:00
Herman Skogseth
845d376ce0 Add integration test for building only the specified artifact library 2024-05-07 12:46:00 +02:00
Ed Page
06a57142f1 fix(toml): Warn, rather than fail publish, if targets are excluded
This could offer performance gains when parsing a published
manifest since the targets don't need to be discovered.
To see this, we'd first need to stop discovering potential targets even when it isn't
needed.
2024-04-29 12:25:56 -05:00
Ed Page
1e6047763d fix(toml): Warn, rather than fail publish, if build.rs is excluded
This could offer a minor performance gain when reading this manifest
since the target doesn't need to be discovered.
2024-04-29 12:25:19 -05:00
Ed Page
39f1a210b8 perf(toml): Avoid looking up readme on published packages
Not much of a performance gain;
this is mostly done to be consistent with the target work.
2024-04-29 12:25:19 -05:00
Lucas Kent
4079305704 Add failing test: artifact_dep_target_specified 2024-04-28 17:49:16 +10:00
Ed Page
bec36fce99 fix(update): Remove locking message for --precise
We aren't locking to latest.
We could customize the message for precise but it seemed a bit
excessive.
2024-04-15 13:00:34 -05:00
Ed Page
1876326b6b feat(resolve): Tell the user the style of resovle done
This is to help with #9930

Example changes:
```diff
-[LOCKING] 4 packages
+[LOCKING] 4 packages to latest version
-[LOCKING] 2 packages
+[LOCKING] 2 packages to latest Rust 1.60.0 compatible versions
-[LOCKING] 2 packages
+[LOCKING] 2 packages to earliest versions
```

Benefits
- The package count is of "added" packages and this makes that more
  logically clear
- This gives users transparency into what is happening, especially with
  - what rust-version is use
  - the transition to this feature in the new edition
  - whether the planned config was applied or not (as I don't want it to
    require an MSRV bump)
- Will make it easier in tests to show what changed
- Provides more motiviation to show this message in `cargo update` and
  `cargo install` (that will be explored in a follow up PR)

This does come at the cost of more verbose output but hopefully not too
verbose.  This is why I left off other factors, like avoid-dev-deps.
2024-04-13 20:39:59 -05:00
Ed Page
cad9673785 refactor(package): Move preamble to Manifest 2024-03-28 13:29:24 -05:00
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
bors
69726309bf Auto merge of #12783 - dvdhrm:pr/libname2, r=ehuss
cargo: prevent dashes in lib.name

The TOML parser of Cargo currently refuses `lib.name` entries that contain dashes. Unfortunately, it uses the package-name as default if no explicit `lib.name` entry is specified. This package-name, however, can contain dashes.

Cargo documentation states that the package name is converted first, yet this was never implemented by the code-base.

Fix this inconsistency and convert the package name to a suitable crate-name first.

This fixes #12780. It is an alternative to #12640.
2024-03-16 20:50:35 +00:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Ed Page
831847e5f0 fix(rustc): Always pass --edition to rustc
On [Internals](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309),
the idea came up for warning on unset Edition.
I am working on the cargo warning but if rustc ever wants to do so,
they'd be blocked on cargo ensuring `--edition` is always set.
Hence this change.
2024-02-28 15:35:41 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Ed Page
69eb49194b fix: Switch more notes/warnings to lowercase
See https://doc.crates.io/contrib/implementation/console.html#style

By fixing existing cases, we make it more likely people will copy a case
they should.

I left out multi-sentance cases because I was unsure how to handle those

r? @weighanglo
2024-02-06 19:52:12 -06:00
Eric Huss
0afd943dad Fix some test output validation. 2023-11-15 15:10:18 -08:00
Ed Page
293f2250d6 feat(doc): Print the generated docs links
I've wanted something like this myself.  I dislike using `--open`
because I tend to move up to re-run my `cargo doc` run but then have to
edit it to remove `--open`.
Also makes it annoying when opening docs when `cargo doc` is wrapped by
a tool like `make`.

This was previously attempted in #5592:
- Unlike the request in #5562, this aligns with #5592 in always printing
  rather than using a flag as this seems generally useful
- Unlike #5592, this prints as an alternative to "Opening" to keep
  things light
- Unlike #5592, this prints afterwards as the link is only valid then

Fixes #5562
2023-10-19 10:51:56 -05:00
David Rheinsberg
3ca04e261e cargo: prevent dashes in lib.name
The TOML parser of Cargo currently refuses `lib.name` entries that
contain dashes. Unfortunately, it uses the package-name as default if no
explicit `lib.name` entry is specified. This package-name, however, can
contain dashes.

Cargo documentation states that the package name is converted first, yet
this was never implemented by the code-base.

Fix this inconsistency and convert the package name to a suitable
crate-name first.
2023-10-17 13:48:41 +02:00
Deadbeef
43dccc7535 apply suggestions 2023-08-25 01:43:29 +00:00
Deadbeef
b2b34e4ca2 update tests 2023-08-25 01:43:29 +00:00
cassaundra
5554889f88
Include rust-version in publish request
crates.io reads rust-version from the tarball directly, but we can include it in
the publish request for the sake of consistency for third-party registries.
2023-04-26 11:59:29 -07:00
Eric Huss
f60666ca6e Reword published/completed to uploaded/published 2023-03-15 08:15:00 -07:00
Eric Huss
7e4764a56b Add more information to wait-for-publish 2023-03-15 08:15:00 -07:00
bors
524231f43f Auto merge of #11643 - jofas:11260-fix, r=weihanglo
Error message for transitive artifact dependencies with targets the package doesn't directly interact with

Address #11260. Produces an error message like described by `@weihanglo` [here](https://github.com/rust-lang/cargo/issues/11260#issuecomment-1400455203):

```
error: could not find specification for target "x86_64-windows-msvc"
  Dependency `bar v0.1.0` requires to build for target "x86_64-windows-msvc".
```

Note that this is not a complete fix for #11260.
2023-02-25 07:39:08 +00:00
hi-rustin
0b06a456f2 Make blocking tests non blocking 2023-02-23 09:11:52 +08:00
jofas
4bdface19a applying code review to make get_sysroot_target_libdir more readable + incorporated changes into corresponding test 2023-02-06 14:43:44 +01:00
jofas
ef227e401d error message for target specification that couldn't be queried from rustc 2023-01-28 11:08:23 +01:00
jofas
d5e43bb22c added test replicating error encountered with transitive artifact dependencies 2023-01-24 13:08:12 +01:00
jofas
ded1a15a0a removed trailing whitespaces (done automatically by vim) 2023-01-24 12:40:34 +01:00
Dinu Blanovschi
0beb5fe93d Simple explanations for why cargo rebuilds crates 2022-12-28 16:27:50 +01:00
Roman Volosatovs
548b2528fb
test: reproduce bindep dependency collision bug
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 16:16:12 +01:00
Roman Volosatovs
6d43fa64ec
refactor: simplify rust-lang#10525 test case
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 14:45:25 +01:00
bstrie
386645e990
test: add test for #10525 2022-12-22 14:45:25 +01:00