6729 Commits

Author SHA1 Message Date
Eric Huss
9ce30a6ca3 Update tests to resolve recent changes
Upstream changed these messages slightly.
2024-10-29 08:12:43 -07:00
Tor Hovland
032bc29bb8 feat: cargo::error build script directive. 2024-10-29 08:02:55 -07:00
Tor Hovland
3fade07a0b test: cargo::error build script directive. 2024-10-29 08:02:55 -07:00
Tor Hovland
3e59d08f9d test: Update to snapshot style. 2024-10-29 08:02:54 -07:00
Weihang Lo
886e55b572
fix: make deprecated cmds more obvious in help and --list 2024-10-28 14:19:22 -04:00
MoskalykA
7a517af7ea Deprecate cargo verify-project 2024-10-28 01:30:18 +01:00
bors
28274d0a51 Auto merge of #14724 - epage:resolver, r=weihanglo
test(install): Verify 2024 edition / resolver=3 doesn't affect resolution

### What does this PR try to resolve?

I was worried there might be bugs related to this.  With this out of the way, I think we'll be ready to stabilize `resolver = "3"`.

### How should we test and review this PR?

### Additional information
2024-10-25 13:41:40 +00:00
bors
8315873f5a Auto merge of #14701 - linyihai:trace-env-table, r=weihanglo
Fix: trace `config` `[env]` table in dep-info.

### What does this PR try to resolve?

The `env` defined in `config.toml` or `--config env`  are stripped before recording in the dep-info file.  The absence of the env table doesn't rebuild when env changed

By tracing the `env` table into the `dep-info` file, If the envs changed then the rebuild can be triggered.

Fixes #13280

### How should we test and review this PR?
One commit add the test, the latter commit update the test through the fixes.

### Additional information
The PR only fixed the `env` table changes can't trigger a rebuild, other `CARGO-like` envs
 doesn't take into account.
2024-10-25 04:05:40 +00:00
Lin Yihai
668d82e3f0 fix: trace [env] config table into fingerprint. 2024-10-25 11:21:52 +08:00
Lin Yihai
02d2c77d87 test: add test to describe the issue#13280
Cargo fails to detect environment variable is newly set and rebuild if the environment variable is set in `config.toml`
2024-10-25 11:01:31 +08:00
todd
11f84a964c fix: use Registry::describe_source to fix error message and related test cases
`Registry::describe_source` will be used as default error message, but if the message
come from `Registry::describe_source` is empty, then it uses `SourceId` message
2024-10-25 00:35:30 +08:00
Ed Page
487bbc813f test(install): Verify edition=2024 is ignored 2024-10-23 15:15:02 -05:00
Ed Page
49f096edaf test(install): Verify resolver=3 is ignored 2024-10-23 15:14:08 -05:00
todd
c84799257f test: add test case to check replace-with error message
The test is used to duplicate #14697
2024-10-23 20:30:12 +08:00
Ed Page
5b84fc99c5 feat(test): Snapshot .crate validation 2024-10-17 06:26:47 +08:00
Arlo Siemsen
8db2192bba fix: block_until_ready can return early when there is still pending work 2024-10-15 12:58:38 -05:00
Arlo Siemsen
b0b6b16278 add test to show existing behavior of block_until_ready 2024-10-15 12:58:38 -05:00
bors
3c4c0a2b3c Auto merge of #14688 - weihanglo:git-cli, r=epage
fix(git): dont fetch tags by default

### What does this PR try to resolve?

Change Cargo to pass [`--no-tags`] Git CLI option by default. This aligns with how libgit2 works in Cargo.

Based on the Git official doc,
the flag has been there since at least 2.0.5

[`--no-tags`]: https://git-scm.com/docs/git-fetch/2.0.5#Documentation/git-fetch.txt---no-tags

### How should we test and review this PR?

Not sure if we want a test for this.
`CARGO_NET_GIT_FETCH_WITH_CLI` is barely tested.

### Additional information

Fixes #14687
2024-10-15 04:26:53 +00:00
Weihang Lo
1975c3ca53
fix(git): dont fetch tags by default
Change Cargo to pass [`--no-tags`] Git CLI option by default.
This aligns with how libgit2 works in Cargo.

Based on the Git official doc,
the flag has been there since at least 2.0.5

[`--no-tags`]: https://git-scm.com/docs/git-fetch/2.0.5#Documentation/git-fetch.txt---no-tags
2024-10-14 23:54:48 -04:00
bors
5b220de42b Auto merge of #14659 - tweag:publish-workspace-cli-args, r=weihanglo
Support package selection options like `--exclude` in `cargo publish`

Fixes #14652.

Is there a way to make the help text depend on whether nightly/unstable features are enabled? I couldn't find one...
2024-10-15 03:51:32 +00:00
Ralf Jung
2791c127f4 cargo ... --help: clarify --tests and --benches 2024-10-12 16:30:20 +02:00
bors
1e5bad3164 Auto merge of #14593 - elchukc:fix_cargo_tree_bindep_crosscompile, r=weihanglo
Fix panic when running cargo tree on a package with a cross compiled bindep

### What does this PR try to resolve?

This is an attempt to close out `@rukai's` [PR](https://github.com/rust-lang/cargo/pull/13207#issue-2056019109) for #12358 and #10593 by adjusting the new integration test and resolving merge conflicts.

I have also separated the changes into atomic commits as per [previous review](https://github.com/rust-lang/cargo/pull/13207#discussion_r1543447659).

### How should we test and review this PR?

The integration test that has been edited here is sufficient, plus the new integration test that confirms a more specific case where `cargo tree` throws an error.

### Additional information

I have confirmed the test `artifact_dep_target_specified` fails on master branch and succeeds on this branch.

The first commit fixes the panic and the integration test. Commits 2 and 3 add other tests that confirm behaviour mentioned in related issues.

Commits:
1. [Fix panic when running cargo tree on a package with a cross compiled bindep](5c5ea78ecd) - fixes some panics and changes the integration test to succeed
2. [test: cargo tree panic on artifact dep target deactivated](ed294ab4e7) - adds test to confirm the behaviour for the specific panic from [#10539 (comment)](https://github.com/rust-lang/cargo/issues/10593#issuecomment-1317759526)
2024-10-11 14:30:03 +00:00
Rustin170506
76cd19b549 Remove the support for Cargo.toml of the cargo-script 2024-10-11 11:59:11 +02: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
Joe Neeman
4e051c47be Support package selection in cargo publish 2024-10-10 09:37:10 +07:00
Joe Neeman
3ffcdee1ce Add failing test 2024-10-10 09:17:27 +07:00
bors
15fbd2f607 Auto merge of #14137 - Xaeroxe:checksum-freshness, r=weihanglo
initial version of checksum based freshness

Implementation for https://github.com/rust-lang/cargo/issues/14136 and resolves https://github.com/rust-lang/cargo/issues/6529

This PR implements the use of checksums in cargo fingerprints as an alternative to using mtimes. This is most useful on systems with poor mtime implementations.

This has a dependency on https://github.com/rust-lang/rust/pull/126930. It's expected this will increase the time it takes to declare a build to be fresh. Still this loss in performance may be preferable to the issues the ecosystem has had with the use of mtimes for determining freshness.
2024-10-08 21:08:11 +00:00
Jacob Kiesel
cf893c1695
test(freshness_checksum): verify cargo depinfo is properly encoded 2024-10-08 16:30:54 -04:00
Jacob Kiesel
c0e550ee5b
test(freshness_checksum): different fingeprint methods are compatible
This ensures that users can switch between different fingerprint
freshness methods and still correctly rebuild stuff.
2024-10-08 16:29:46 -04:00
Jacob Kiesel
0d08e19661
test(freshness_checksum): verify unstable flag is gated correctly 2024-10-08 16:29:45 -04:00
Weihang Lo
66998ea24a
test(freshness_checksum): verify checksum works
Two new tests:

* checksum_actually_uses_checksum: chekcsum works when mtime forwards
* same_size_different_content: checksum does check content
2024-10-08 16:29:45 -04:00
Weihang Lo
b48fe7354f
test(freshness_checksum): remove unnecessary sleep
We don't rely on mtime anymore for checksum-based fingerprint
2024-10-08 16:29:45 -04:00
Weihang Lo
74cc1deb51
test(freshness_checksum): enable -Zfreshness-checksum
These tests are modified or renamed to reflect the switch to
checksum fingerprint:

* bust_patched_dep
* modifying_and_moving
* rebuild_on_mid_build_file_modification
* rebuild_sub_package_then_while_package
* skip_mtime_check_in_selected_cargo_home_subdirs
* use_mtime_cache_in_cargo_home
2024-10-08 16:29:45 -04:00
Weihang Lo
e5a44e24a1
test(freshness_checksum): requires nightly rustc 2024-10-08 16:29:45 -04:00
Weihang Lo
eea5fe9b00
test(freshness_checksum): remove unnecessary tests
* cargo_env_changes
* fingerprint_cleaner_does_not_rebuild
* modify_only_some_files
* rebuild_if_build_artifacts_move_forward_in_time
* simulated_docker_deps_stay_cached
* update_dependency_mtime_does_not_rebuild
2024-10-08 16:29:45 -04:00
Weihang Lo
9b17115534
test(freshness_checksum): update test module description 2024-10-08 16:29:45 -04:00
Weihang Lo
ad7d33d893
test: copy freshness tests in preparation of checksum tests 2024-10-08 16:29:44 -04:00
Jacob Kiesel
f4ca739073
implement checksum freshness fingerprints for cargo 2024-10-08 16:29:44 -04:00
bors
fbcd9bb571 Auto merge of #14464 - linyihai:issue-14194, r=weihanglo
fix: avoid inserting duplicate `dylib_path_envvar` when calling `cargo run` recursively

### What does this PR try to resolve?

If the current program started by `cargo run` recursively call into `cargo run`, the second `cargo run` will insert  `search_path`  into `dylib_path_envvar` again.

Fixes #14194

### How should we test and review this PR?

The first commit adds the test to reflect the issue. The first call to `cargo run` stores the dylib search path env var to a file. Subsequent calls verify that env var remains the same.

The second commit fixes the behavior by checking if env vars in `search_path` are a prefix of the slice of env vars in `dylib_path_envvar`.
2024-10-08 12:51:33 +00:00
Lin Yihai
54dbc2bf66 fix: Avoid inserting search_path again. 2024-10-08 16:20:21 +08:00
Lin Yihai
e888c1306f test: Add test for issue-14194 2024-10-08 16:16:25 +08:00
Lucas Kent
1623c414ad improve error reporting when feature not found in activated_features 2024-10-05 17:10:54 -04:00
Ed Page
0498e84f89 feat: Stabilize MSRV-aware resolver config
This includes
- `cargo generate-lockfile --ignore-rust-version`
- `cargo update --ignore-rust-version`

This does not include
- `edition = "2024"`
- `resolver = "3"`
2024-10-04 12:49:28 -05:00
Ed Page
c18765a152 test: Migrate remaining build with_json tests to snapbox 2024-10-03 21:15:10 -05:00
Ed Page
f92e54faf9 test: Migrate remaining metadata with_json tests to snapbox 2024-10-03 21:15:10 -05:00
bors
fd5f1a05c1 Auto merge of #14630 - epage:implicit-removal, r=weihanglo
fix: Remove implicit feature removal

### What does this PR try to resolve?

Due to problems we ran into with #14016, we're removing implicit features from the 2024 edition to give ourselves more time to design it as we should.

### How should we test and review this PR?

### Additional information

I could have added a new flag for this or made an EditionNext but I decided to remove it in the hopes to avoid any path dependency in solving this the next time.
2024-10-01 20:06:46 +00:00
Weihang Lo
b4253e5057
fix(help): mention --config <PATH> in help text 2024-10-01 14:54:52 -04:00
Ed Page
7be5a2146b fix: Remove implicit feature removal
Due to problems we ran into with #14016, we're removing implicit
features from the 2024 edition to give ourselves more time to design it
as we should.

I could have added a new flag for this or made an EditionNext but I
decided to remove it in the hopes to avoid any path dependency in
solving this the next time.
2024-10-01 11:48:31 -05:00
Weihang Lo
dfa8f26ddc
test(test): unnecessay env_remove("RUST_BACKTRACE")
This is done for all tests in f3c7525a61d61b347ed9e2e278dd84cc8c943531
2024-09-30 14:23:47 -04:00