28 Commits

Author SHA1 Message Date
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
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
Ed Page
347fa09b1b perf(build-rs): Remove an allocation 2024-11-13 13:42:46 -06:00
Ed Page
f4193559c2 refactor(build-rs): Make env vars more composable 2024-11-13 13:32:25 -06:00
Ed Page
5e53b21e19 refactor(build-rs): Clarify bool policy 2024-11-13 12:54:59 -06:00
Ed Page
58ac23d60a feat(build-rs): Add cargo_makeflags 2024-11-13 12:46:44 -06:00
Ed Page
e4e7a36eaa docs(build-rs): Correct documentation for manifest_links 2024-11-13 12:46:43 -06:00
Ed Page
eef4b30d31 docs(build-rs): Split out short descriptions 2024-11-13 12:46:25 -06:00
Ed Page
9814045a03 docs: Declare build-rs as intentional 2024-11-08 08:58:45 -06:00
Ed Page
82a912a2ee chore: Silence clippy for intregration 2024-11-08 08:58:45 -06:00
Ed Page
54660c665e chore: Integrate build-rs into the workspace 2024-11-08 08:58:45 -06:00
Ed Page
0c7577d48a chore: Stage build-rs for merging 2024-11-07 08:39:59 -06:00