1014 Commits

Author SHA1 Message Date
Weihang Lo
4a1e2ea539
fix(schemas): Fix 'metadata' JSON Schema (#15033)
Instead of allowing any type in metadata, we were specifying fields like
`"string": "<any string>"`.

Found this when looking into #15030

<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->
2025-01-08 19:05:19 +00:00
Jacob Finkelman
06811d8594 manual impl of hash 2025-01-08 17:35:54 +00:00
Jacob Finkelman
d8b7c072c5 shortening the comment 2025-01-08 17:35:42 +00:00
Ed Page
e48257d3c8 fix(schemas): Fix 'metadata' JSON Schema
Found this when looking into #15030
2025-01-08 11:26:27 -06:00
Ed Page
e8f3e5e0f2 chore(schema): Bump version 2025-01-08 11:26:27 -06:00
Eric Huss
e6ecef6cc8 Remove condition on RUSTUP_WINDOWS_PATH_ADD_BIN
This is no longer needed since rustup 1.27.1 which changed the default
to false.
2025-01-04 11:49:20 -08:00
Ed Page
34d0bcb3e9 feat(test); Add arg_line support to Execs 2024-12-18 11:56:37 -06:00
Ed Page
729776b589 fix(schema): Correct and update the JSON Schema
Fixes #14999
2025-01-01 10:14:31 -06:00
renovate[bot]
5f42cf2873
chore(deps): update alpine docker tag to v3.21 2025-01-01 02:26:01 +00:00
Weihang Lo
4c06c57d0d
refactor(cargo-util): one generic for each argument
So `path` and `base` are able to accept different types
2024-12-31 16:21:43 -05:00
Weihang Lo
562e83a443
test: track caller for .crate file publish verification
This was found during some recent works around `cargo package`.
The purpose of it is showing the caller's line number when panicking.
2024-12-30 09:50:04 -05:00
Weihang Lo
0921264bc5
test: make path arguments more generic and flexible
So we don't need to `p.to_str().unwrap()`
and are able to pass different types for each argument
2024-12-24 10:33:21 -05:00
Eric Huss
20ec18a3ff Update home changelog 2024-12-15 14:22:53 -08:00
Eric Huss
014378f8c0 Clarify status of home_dir
Users should be using the standard library `home_dir` instead of this
crate.
2024-12-15 14:20:56 -08:00
Ed Page
4e5af28150 refactor(schema): Group TomlManifest fields to clarify requires_package
I found a bug in the manifest parser and figured this would help make it
more obvious.

Since I was already changing the order, I figure I'm make things a
little more logical (user-facing first, implementtion details later)
2024-12-13 10:31:53 -06:00
Ed Page
20870cea81 feat(test): Allow custom index lines 2024-12-12 11:50:54 -06:00
Ed Page
4f68299e27 fix(test)!: Clarify purpose of Package::invalid_index_line 2024-12-12 11:50:54 -06:00
Ed Page
9a8ca867e2 chore: Bump cargo-test-support's version 2024-12-12 11:50:54 -06:00
Ed Page
b45ca32bff refactor(source): Rename AlternativeVersions to RejectedVersions
Really, when we switch the req to a wildcard, it is an alternative
version, so for yanked and unsupported we need a different name.
2024-12-11 10:48:14 -06:00
Scott Schafer
ad5b4934b7
fix(resolver): Report unmatched versions, rather than saying no package (#14897)
### What does this PR try to resolve?

Instead of saying no package found when there are hidden `Summary`s,
we'll instead say why the summary was hidden in the cases of
- Yanked packages
- Schema mismatch
- Offline packages?

The schema mismatch covers part of #10623. Whats remaining is when we
can't parse the `Summary` but can parse a subset (name, version, schema
version, optionally rust-version). That will be handled in a follow up.

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

This has a couple of risky areas
- Moving the filtering of `IndexSummary` variants from the Index to the
Registry Source. On inspection, there were other code paths but they
seemed innocuous to not filter, like asking for a hash of a summary
- Switching `PackageRegistry` to preserve the `IndexSummary` variant for
regular sources and overrides
- I did not switch patches to preserve `IndexSummary` as that was more
invasive and the benefits seemed more minor (normally people patch over
registry dependencies and not to them)

### Additional information
2024-12-11 16:05:00 +00:00
Ed Page
6c021e0ac8 fix(build-rs): Implicitly report rerun-if-env-changed for input
As we abstract aware the env variables, users can't do a good job of
reporting these, so we'll do it ourselves.

We could make the traits public and take and explicit `env` parameter.
I figured we can wait until there is a motivating use case.
`build_env` does have a fancier `Env` impl where you pass it HOST and
TARGET and it automatically looks up values for those with a fallback
scheme.
2024-12-09 14:07:32 -06:00
Ed Page
15892e003c refactor(build-rs): Abstract std::env::var_os
I made a dedicated `Env::is_present` function in case we want to handle
`rerun-if-env-changed` differently in that case.
2024-12-09 10:10:45 -06:00
Ed Page
8e90ce9a24 feat(build-script): Pass CARGO_CFG_FEATURE
This may look redundant with `CARGO_FEATURE_<CASE_CONVERTED_NAME>=1`
except that doesn't provide a lossless way of getting the names, e.g. for
forwarding for child builds like tests that need to build examples.

This also makes things more consistent as users
conditionalize on features through `cfg` and this even fits with what
the `CARGO_CFG_` docs say:

> For each configuration option of the package being built, this
> environment variable will contain the value of the configuration, where
> <cfg> is the name of the configuration uppercased and having -
> translated to _. Boolean configurations are present if they are set, and
> not present otherwise. Configurations with multiple values are joined to
> a single variable with the values delimited by ,. This includes values
> built-in to the compiler (which can be seen with rustc --print=cfg) and
> values set by build scripts and extra flags passed to rustc (such as
> those defined in RUSTFLAGS). Some examples of what these variables are:

Fixes #3702
2024-12-09 12:38:11 -06:00
Ed Page
f8e51543af fix(build-rs): Correctly refer to the item in assert
Follow up to #14910
2024-12-09 14:00:56 -06:00
Ed Page
5fa8a686fa feat(build-rs): Add the 'error' directive 2024-12-09 10:10:34 -06:00
Ed Page
260fcab3b3 refactor(build-rs): Clean up 'use's 2024-12-09 10:10:34 -06:00
Ed Page
5e833bfbbb perf(build-rs): Always emit check-cfg
These didn't require an MSRV bump.  Worse case, some metadata will be
emitted but that shouldn't impact things too negatively.
2024-12-09 10:06:02 -06:00
Ed Page
0f62101676 perf(build-rs): Always emit :: directives
Our MSRV is much higher than 1.77.  Also, as time goes on, there is less
incentive to drop it below 1.77, especially with the MSRV-aware resolver
in 1.84
2024-12-09 10:06:02 -06:00
Ed Page
f9ef2c547c docs(build-rs): Backtick literal values 2024-12-09 09:33:48 -06:00
Ed Page
0f4e698785 docs(build-rs): Make MSRV stick out 2024-12-06 10:01:19 -06:00
Ed Page
19bb28e64d refactor(build-rs): Clarify MSRV policy being added 2024-12-06 09:57:28 -06:00
Ed Page
71f68dc3c3 fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions'
The documentation that was added was pulled straight from a comment in
`custom_build.rs`.
2024-12-06 09:33:16 -06:00
Ed Page
70a6f011a4 chore(build-rs): Bump major version 2024-12-06 09:33:10 -06:00
Ed Page
d2fcf6b13f fix(resolver): Report unmatched versions, rather than saying no package 2024-12-05 12:55:16 -06:00
Ed Page
4d7913bfe3 refactor(source): Qualify what alternatives we look for 2024-12-05 12:55:16 -06:00
Weihang Lo
4240e722d4
test: requires attribute accepts string literals for cmds
The new syntax is key-value pair like `requires = "rustfmt"`,
comparing to the previous `requires_<cmd>`.
2024-11-29 22:23:08 -05:00
Ed Page
6da546c9e1 chore: Bump versions 2024-11-29 10:43:19 -06:00
renovate[bot]
1ec49b8947
chore(deps): update msrv 2024-11-29 03:54:45 +00:00
Urgau
e2028d4bc2 Adjust future-incompatibility cfg keyword with raw-idents in cfgs 2024-11-25 22:01:44 +01:00
Urgau
9450706a03 Add support for raw-idents in cfgs 2024-11-25 22:01:44 +01:00
Urgau
4946828211 Add future-incompatibility warning against some keyword-as-ident 2024-11-25 21:51:19 +01:00
Urgau
80dde854b4 Bump cargo-platform to 0.2.0 in preparation for cfg(<true/false>) 2024-11-25 21:51:18 +01:00
Ed Page
8b41a8ecbe feat(test): Provide access to 'RawOutput' from 'Execs::run'
This will allow more custom assertions.
2024-11-18 20:53:50 -06:00
Ed Page
e3065568d0 docs: Focus the summary for API items
This was aided by `clippy::too_long_first_doc_paragraph`
2024-11-15 09:33:23 -06:00
Ed Page
878caf7447 docs: Surround identifiers in backticks
This was mostly done by clippy via `clippy::doc_markdown`.
I then reviewed it to fix words that shouldn't have it or where `--fix`
put the backtick in the wrong location.
2024-11-15 09:33:23 -06:00
Ed Page
c02c9f2517 docs(build-rs): Remove reference to encoding 2024-11-13 14:46:11 -06:00
Ed Page
8b43030bb7 chore(build-rs): Remove comment about update
At this point, it is assumed to always be up-to-date
2024-11-13 13:55:14 -06:00
Ed Page
611ec991fb feat(build-rs): Add cargo_manifest_path 2024-11-13 13:54:48 -06:00
Ed Page
4ff0809afd fix(build-rs)!: Prefer None/empty-Vec to empty-String 2024-11-13 13:49:23 -06:00
Ed Page
27c577286e refactor(build-rs): Extract minor version extraction 2024-11-13 13:44:04 -06:00