12869 Commits

Author SHA1 Message Date
Arlo Siemsen
49fb8f3d88 Fix publishing with a dependency on a sparse registry 2022-10-20 17:21:32 -05:00
bors
b1b25a0255 Auto merge of #11265 - hi-rustin:rustin-patch-missing, r=epage
Add missing edition

When I read this doc, I found that we are missing the edition key in this manifest. I think we should add it because` cargo new` always does this.
2022-10-20 14:55:24 +00:00
hi-rustin
96bf10e1d4 Add missing edition
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-20 21:52:43 +08:00
bors
a6e72d0a27 Auto merge of #11255 - epage:registry, r=arlosi
fix(publish): Check remote git registry more than once post-publish

With `publish-timeout` on remote git registries, we were checking once and never checking again.  There were 3 layers of guards preventing the cache from being updating
- `needs_update`, handled via `invalidate_cache`
- `config.updated_sources()`,. handled by removing from the HashSet
- `updated`, inaccessible

This change collapses `updated` into `config.updated_sources()`, allowing the cache to be updated

Tested by publishing `epage-publish-test`.  After about 7 registry updates, it succeded.  Before, it just hit the timeout of 60s.  No tests are added as we don't have the plumbing setup to be able to control when the test remote git registry publishes.  All of our tests focus on the remote http registry.

Fixes #11253
2022-10-20 11:17:03 +00:00
bors
bab91cafb3 Auto merge of #11258 - hi-rustin:rustin-patch-typo, r=weihanglo
Fix typo

### What does this PR try to resolve?
It's `first-come-first-serve` not `first-come-first- serve`.
<img width="743" alt="image" src="https://user-images.githubusercontent.com/29879298/196712847-f575615a-2538-45ae-915a-64406dc5c7e8.png">
2022-10-20 03:55:34 +00:00
hi-rustin
49b0fbbb26 Fix typo
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-19 21:59:15 +08:00
Ed Page
dd696741fd fix(publish): Check remote git registry more than once post-publish
With `publish-timeout` on remote git registries, we were checking once
and never checking again.  There were 3 layers of guards preventing the
cache from being updating
- `needs_update`, handled via `invalidate_cache`
- `config.updated_sources()`,. handled by removing from the HashSet
- `updated`, inaccessible

This change collapses `updated` into `config.updated_sources()`,
allowing the cache to be updated

Tested by publishing `epage-publish-test`.  After about 7 registry
updates, it succeded.  Before, it just hit the timeout of 60s.  No tests
are added as we don't have the plumbing setup to be able to control when
the test remote git registry publishes.  All of our tests focus on the
remote http registry.

Fixes #11253
2022-10-18 11:39:41 -05:00
bors
3ff044334f Auto merge of #11243 - weihanglo:refactor/cargo_compile, r=epage
Some tiny refactors around `ops::cargo_compile`

### What does this PR try to resolve?

Some tiny refactors I found during polishing documentations.

- Extract `CompileFilter` and `Packages` from `ops::cargo_compile` to their own modules.
- Remove `FilterRule::try_collect` as its intent is not clear, and we don't need this indirection.
- Remove `CompileOptions::local_rustdoc_args`, which is obsolete since 1ef954ea.
2022-10-17 20:25:00 +00:00
Weihang Lo
886c9d2153
refactor(cargo_compile): move to mod.rs 2022-10-18 01:59:12 +08:00
bors
e008032442 Auto merge of #11241 - weihanglo:doc/build_context, r=epage
Polish docs for module `build_context`
2022-10-17 12:27:27 +00:00
bors
76293b3ade Auto merge of #11247 - arlosi:fix-sparse, r=Eh2406
Remove sparse+ prefix for index.crates.io

### What does this PR try to resolve?

#11209 changed how sparse registry URLs are stored in a `SourceId` to remove the `sparse+` prefix, however the URL was not updated.

Fixes #11246

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

Run a command that requires sparse registry `cargo  -Z sparse-registry update --dry-run`

Tests can't really be added for this case, since the `index.crates.io` URL was incorrect, and tests shouldn't access the network.

r? `@Eh2406`
2022-10-16 22:48:25 +00:00
Arlo Siemsen
fe7ff11f72 Remove sparse+ prefix for index.crates.io 2022-10-16 17:06:45 -05:00
Weihang Lo
0195423233
Remove unused CompileOptions.local_rustdoc_args 2022-10-16 08:03:48 +08:00
Weihang Lo
3fd7580c5b
remove unnecessary specialiized FilterRule::try_collect method 2022-10-16 07:31:26 +08:00
Weihang Lo
f4da514ddc
doc(cargo_compile): more on compile filter 2022-10-16 06:42:55 +08:00
Weihang Lo
e6d90b4c1f
refactor: extract Packages & CompileFilter to separate modules 2022-10-16 06:11:39 +08:00
Weihang Lo
d86d3bfb3b
doc(build_context): module level doc 2022-10-16 05:06:15 +08:00
Weihang Lo
fa50fc12b3
doc(target_info): add missing doc comments 2022-10-16 05:02:46 +08:00
bors
afadab23a5 Auto merge of #11240 - epage:docs, r=Muscraft
docs(add): Add missing flags to reference

Fixes #11237
2022-10-14 18:41:07 +00:00
bors
2f93984d73 Auto merge of #11227 - cassaundra:remove-docs, r=epage
Document `cargo remove`

### What does this PR try to resolve?

This PR continues the deferred work of #11099 by adding documentation for the cargo remove subcommand.

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

Ensure that the documentation renders correctly and appropriately covers the feature.
2022-10-14 18:01:31 +00:00
Ed Page
85c8f63f2a docs(add): Add missing flags to reference
Fixes #11237
2022-10-14 09:24:18 -05:00
bors
99ff79e96e Auto merge of #11239 - epage:add, r=weihanglo
fix: Update help headings to  match clap

This was missed when upgrading to clap v4

Fixes #11238
2022-10-14 12:22:34 +00:00
Ed Page
f46da373ba fix: Update help headings to match clap
This was missed when upgrading to clap v4

Fixes #11238
2022-10-14 07:16:27 -05:00
Cassaundra Smith
9bacebf9e1
Document cargo remove 2022-10-13 17:53:28 -07:00
bors
b332991a57 Auto merge of #11170 - basile-henry:basile-henry/built-in-alias-shadow, r=epage
Differentiate the warning when an alias (built-in or user-defined) shadows an external subcommand

Fixes #11149
2022-10-13 22:05:28 +00:00
Basile Henry
3ff6d9e698 Add built-in alias shadowing not warning test 2022-10-13 22:22:52 +01:00
Basile Henry
444af4847e Don't warn about shadowing in the case where the alias is built-in 2022-10-13 22:22:52 +01:00
bors
351378006d Auto merge of #11235 - epage:clap, r=weihanglo
chore: Update tests for latest clap
2022-10-13 20:22:44 +00:00
Ed Page
5f30808d00 chore: Update tests for latest clap 2022-10-13 15:16:38 -05:00
bors
b592ba4d97 Auto merge of #11230 - epage:unstable2, r=weihanglo
feat(publish): Support 'publish.timeout' config behind '-Zpublish-timeout'

Originally, crates.io would block on publish requests until the publish
was complete, giving `cargo publish` this behavior by extension.  When
crates.io switched to asynchronous publishing, this intermittently broke
people's workflows when publishing multiple crates.  I say interittent
because it usually works until it doesn't and it is unclear why to the
end user because it will be published by the time they check.  In the
end, callers tend to either put in timeouts (and pray), poll the
server's API, or use `crates-index` crate to poll the index.

This isn't sufficient because
- For any new interested party, this is a pit of failure they'll fall
  into
- crates-index has re-implemented index support incorrectly in the past,
  currently doesn't handle auth, doesn't support `git-cli`, etc.
- None of these previous options work if we were to implement
  workspace-publish support (https://github.com/rust-lang/cargo/issues/1169)
- The new sparse registry might increase the publish times, making the
  delay easier to hit manually
- The new sparse registry goes through CDNs so checking the server's API
  might not be sufficient
- Once the sparse registry is available, crates-index users will find
  out when the package is ready in git but it might not be ready through
  the sparse registry because of CDNs

This introduces unstable support for blocking by setting
`publish.timeout` to non-zero value.

A step towards #9507
2022-10-13 16:21:09 +00:00
bors
0b61503914 Auto merge of #11231 - hi-rustin:rustin-patch-build-doc, r=epage
Add missing edition

### What does this PR try to resolve?

When I read this doc, I found that we are missing the edition key in this manifest. I think we should add it because `cargo new` always does this.
2022-10-13 15:37:33 +00:00
hi-rustin
fa815f345c Add missing edition
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-10-13 23:14:31 +08:00
Ed Page
04d836fa71 feat(publish): Support 'publish.timeout' config behind '-Zpublish-timeout'
Originally, crates.io would block on publish requests until the publish
was complete, giving `cargo publish` this behavior by extension.  When
crates.io switched to asynchronous publishing, this intermittently broke
people's workflows when publishing multiple crates.  I say interittent
because it usually works until it doesn't and it is unclear why to the
end user because it will be published by the time they check.  In the
end, callers tend to either put in timeouts (and pray), poll the
server's API, or use `crates-index` crate to poll the index.

This isn't sufficient because
- For any new interested party, this is a pit of failure they'll fall
  into
- crates-index has re-implemented index support incorrectly in the past,
  currently doesn't handle auth, doesn't support `git-cli`, etc.
- None of these previous options work if we were to implement
  workspace-publish support (#1169)
- The new sparse registry might increase the publish times, making the
  delay easier to hit manually
- The new sparse registry goes through CDNs so checking the server's API
  might not be sufficient
- Once the sparse registry is available, crates-index users will find
  out when the package is ready in git but it might not be ready through
  the sparse registry because of CDNs

This introduces unstable support for blocking by setting
`publish.timeout` to non-zero value.

A step towards #9507
2022-10-13 08:53:36 -05:00
Scott Schafer
66b62d2745 test(publish): Demonstrate the impact of non-blocking publish 2022-10-13 08:40:26 -05:00
Scott Schafer
8fadfe7f33 test(registry): Allow custom_responders to call normal responders 2022-10-13 08:40:26 -05:00
bors
9bdc926508 Auto merge of #11219 - weihanglo:doc/profiles, r=ehuss
doc(profiles): add module level doc
2022-10-12 22:48:04 +00:00
bors
823d917df0 Auto merge of #11216 - epage:registry, r=ehuss
refactor(publish): Clarify which SourceId is being used

Ran into confusion on this when updating #11062 to be on top of #10907. This now threads both types of sources through which comments explaining each so callers will always have to explicitly acknowledge which they are dealing with.
2022-10-12 21:47:33 +00:00
bors
5788d76d68 Auto merge of #11209 - arlosi:sparse-kind, r=ehuss
Add new SourceKind::SparseRegistry to differentiate sparse registries

Refactor sparse registry to have its own `SourceKind`.
Follow up from https://github.com/rust-lang/cargo/pull/11177#issuecomment-1272395571

r? `@ehuss`
2022-10-12 21:03:19 +00:00
bors
642a0e625d Auto merge of #11205 - arlosi:build-deadlock, r=ehuss
Fix deadlock when build scripts are waiting for input on stdin

### What does this PR try to resolve?

#10738 introduced a regression where build scripts did not close stdin, causing deadlocks for build scripts waiting for stdin.

Fixes #11196 by not piping `stdin` unless requested by the `ProcessBuilder`.

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

Run a build script that reads from stdin and check that it no longer hangs. See the POC in the linked issue. The included test hangs without the fix.

r? `@ehuss`
2022-10-12 20:18:44 +00:00
bors
953a63013e Auto merge of #11184 - weihanglo:features2-refactor, r=ehuss
refactor: New variant `FeaturesFor::ArtifactDep`
2022-10-12 19:35:06 +00:00
Weihang Lo
74d7fe395a
doc(profiles): add module level doc 2022-10-12 19:10:41 +01:00
Arlo Siemsen
d51ed05324 Fix deadlock when build scripts are waiting for input on stdin 2022-10-12 11:46:51 -05:00
bors
35162068fb Auto merge of #11221 - arlosi:fixci, r=weihanglo
Fix rustdoc warning about unclosed HTML tag

nightly rustdoc is warning about `<name>` being an unclosed HTML tag. Fix by using backticks instead of single quotes.
2022-10-12 15:14:38 +00:00
Arlo Siemsen
c99e9732f9 Use backticks instead of single quotes to fix rustdoc CI 2022-10-12 10:07:15 -05:00
Ed Page
c9f984a9b4 refactor(publish): Clarify which SourceId is being used
Ran into confusion on this when updating #11062 to be on top of #10907.
This now threads both types of sources through which comments explaining
each so callers will always have to explicitly acknowledge which they
are dealing with.
2022-10-12 09:57:29 -05:00
bors
83a1f66d11 Auto merge of #11210 - epage:publish, r=weihanglo
refactor(tests): Prepare for wait-for-publish test changes

In #11062, we are updating `cargo publish` to wait until a package is published.   The problem is a lot of our tests will block until the timeout.  In finding the tests to update, I was originally relying on test failures from the extra output when timing out.  The problem is not all tests verify the test output so they don't fail.

This tries to update the tests to make the introduction of a timeout more obvious.
- Adding `with_stderr` where it wasn't before
- Moving away from `with_stderr_contains` for publish tests

To help with that, I made the predicates on cargo commands more consistent.

I also moved descriptions of tests to be outside of the test so I can more easily document the `registry::init` calls with what we are doing.
2022-10-11 22:59:06 +00:00
bors
8e740bb6c8 Auto merge of #11215 - arlosi:sparse-cfg, r=weihanglo
Add configuration option for controlling crates.io protocol

### What does this PR try to resolve?

Currently, if `-Z sparse-registry` is passed, then Cargo will access crates.io using the sparse protocol. Since we want to stabilize this feature soon, we need a stable way to control which protocol is used.

This adds a config option `registries.crates-io.protocol` that can be set to either `sparse` or `git`. If the option is unset, it will be `sparse` if `-Z sparse-registry` is enabled, otherwise it will be `git`.

This PR does not stabilize `sparse-registry`. Using `registries.crates-io.protocol` without `-Z sparse-registry` will result in an error.

The next steps after PR are to:
* stabilize `sparse-registry`
* make `sparse` the default protocol

### Additional information
The config option is based on the discussion in this note: https://hackmd.io/`@rust-cargo-team/B13O52Zko`
2022-10-11 22:01:32 +00:00
Arlo Siemsen
d77aef5ba4 Add configuration option for controlling crates.io protocol
`registries.crates-io.protocol` can be set to either `sparse` or `git`.
The default is `git` unless `-Z sparse-registry` is passed.
2022-10-11 14:44:09 -05:00
Arlo Siemsen
56f68168f3 Add new SourceKind::SparseRegistry to differentiate sparse registries 2022-10-11 09:26:59 -05:00
bors
b8f30cb23c Auto merge of #11207 - weihanglo:doc-polish, r=epage
Add more doc comments for three modules
2022-10-10 19:16:06 +00:00