Bug 1888321 - Rename .cargo/config.in to .cargo/config.toml.in. r=firefox-build-system-reviewers,webdriver-reviewers,ahochheiden

Cargo 1.79 is emitting a warning when using .cargo/config.
.cargo/config.toml has been supported since cargo 1.39.

Differential Revision: https://phabricator.services.mozilla.com/D205974
This commit is contained in:
Mike Hommey 2024-04-01 21:26:49 +00:00
parent ff68b67b5e
commit 26df6afc74
12 changed files with 23 additions and 20 deletions

View File

@ -113,9 +113,9 @@ replace-with = "vendored-sources"
# Take advantage of the fact that cargo will treat lines starting with #
# as comments to add preprocessing directives. This file can thus by copied
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
# as-is to $topsrcdir/.cargo/config.toml with no preprocessing to be used there
# (for e.g. independent tasks building rust code), or be preprocessed by
# the build system to produce a .cargo/config with the right content.
# the build system to produce a .cargo/config.toml with the right content.
#define REPLACE_NAME vendored-sources
#define VENDORED_DIRECTORY third_party/rust
# We explicitly exclude the following section when preprocessing because

View File

@ -112,5 +112,5 @@ if CONFIG["COMPILE_ENVIRONMENT"] and CONFIG["CBINDGEN"]:
"cbindgen-metadata.json",
script="/build/RunCbindgen.py",
entry_point="generate_metadata",
inputs=["!/.cargo/config"],
inputs=["!/.cargo/config.toml"],
)

View File

@ -202,15 +202,15 @@ endif
$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
# Rust targets, and export targets that run cbindgen need
# $topobjdir/.cargo/config to be preprocessed first. Ideally, we'd only set it
# $topobjdir/.cargo/config.toml to be preprocessed first. Ideally, we'd only set it
# as a dependency of the rust targets, but unfortunately, that pushes Make to
# execute them much later than we'd like them to be when the file doesn't exist
# prior to Make running. So we also set it as a dependency of pre-export, which
# ensures it exists before recursing the rust targets and the export targets
# that run cbindgen, tricking Make into keeping them early.
$(rust_targets): $(DEPTH)/.cargo/config
$(rust_targets): $(DEPTH)/.cargo/config.toml
ifndef TEST_MOZBUILD
recurse_pre-export: $(DEPTH)/.cargo/config
recurse_pre-export: $(DEPTH)/.cargo/config.toml
endif
endif

View File

@ -179,7 +179,7 @@ rsync_filter_list = """
+ /config/**
+ /python/**
+ /.cargo/config.in
+ /.cargo/config.toml.in
+ /third_party/function2/**
- /third_party/python/gyp

View File

@ -183,7 +183,9 @@ if CONFIG["MOZ_BUILD_APP"]:
else:
include("/toolkit/toolkit.mozbuild")
OBJDIR_PP_FILES[".cargo"] += [CONFIG["MOZ_OVERRIDE_CARGO_CONFIG"] or ".cargo/config.in"]
OBJDIR_PP_FILES[".cargo"] += [
CONFIG["MOZ_OVERRIDE_CARGO_CONFIG"] or ".cargo/config.toml.in"
]
DEFINES["top_srcdir"] = TOPSRCDIR

View File

@ -390,11 +390,12 @@ def cargo_vet(command_context, arguments, stdout=None, env=os.environ):
locked = "--locked" in arguments
if locked:
# The use of --locked requires .cargo/config to exist, but other things,
# The use of --locked requires .cargo/config.toml to exist, but other things,
# like cargo update, don't want it there, so remove it once we're done.
topsrcdir = Path(command_context.topsrcdir)
shutil.copyfile(
topsrcdir / ".cargo" / "config.in", topsrcdir / ".cargo" / "config"
topsrcdir / ".cargo" / "config.toml.in",
topsrcdir / ".cargo" / "config.toml",
)
try:
@ -406,7 +407,7 @@ def cargo_vet(command_context, arguments, stdout=None, env=os.environ):
)
finally:
if locked:
(topsrcdir / ".cargo" / "config").unlink()
(topsrcdir / ".cargo" / "config.toml").unlink()
# When the function is invoked without stdout set (the default when running
# as a mach subcommand), exit with the returncode from cargo vet.

View File

@ -47,9 +47,9 @@ CARGO_CONFIG_TEMPLATE = """\
# Take advantage of the fact that cargo will treat lines starting with #
# as comments to add preprocessing directives. This file can thus by copied
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
# as-is to $topsrcdir/.cargo/config.toml with no preprocessing to be used there
# (for e.g. independent tasks building rust code), or be preprocessed by
# the build system to produce a .cargo/config with the right content.
# the build system to produce a .cargo/config.toml with the right content.
#define REPLACE_NAME {replace_name}
#define VENDORED_DIRECTORY {directory}
# We explicitly exclude the following section when preprocessing because
@ -847,7 +847,7 @@ license file's hash.
output = res.stdout.decode("UTF-8")
# Get the snippet of configuration that cargo vendor outputs, and
# update .cargo/config with it.
# update .cargo/config.toml with it.
# XXX(bug 1576765): Hopefully do something better after
# https://github.com/rust-lang/cargo/issues/7280 is addressed.
config = "\n".join(

View File

@ -41,7 +41,7 @@ export PATH="$MOZ_FETCHES_DIR/rustc/bin:$PATH"
cd $GECKO_PATH/testing/geckodriver
cp $GECKO_PATH/.cargo/config.in $GECKO_PATH/.cargo/config
cp $GECKO_PATH/.cargo/config.toml.in $GECKO_PATH/.cargo/config.toml
cargo build --frozen --verbose --release --target "$TARGET"

View File

@ -12,7 +12,7 @@ cd $GECKO_PATH
export PATH=$PATH:$MOZ_FETCHES_DIR/rustc/bin:$HOME/.cargo/bin
cd gfx/wr/
mkdir .cargo
cargo vendor --locked --sync ./Cargo.toml > .cargo/config
cargo vendor --locked --sync ./Cargo.toml > .cargo/config.toml
mkdir wrench-deps
mv vendor .cargo wrench-deps/

View File

@ -32,7 +32,7 @@ cross-compile ARMv7 from a Linux host system is as follows:
% rustup target install armv7-unknown-linux-gnueabihf
```
5. Put this in [testing/geckodriver/.cargo/config]:
5. Put this in [testing/geckodriver/.cargo/config.toml]:
```rust
[target.armv7-unknown-linux-gnueabihf]
@ -47,4 +47,4 @@ cross-compile ARMv7 from a Linux host system is as follows:
```
[central]: https://hg.mozilla.org/mozilla-central/
[testing/geckodriver/.cargo/config]: https://searchfox.org/mozilla-central/source/testing/geckodriver/.cargo/config
[testing/geckodriver/.cargo/config.toml]: https://searchfox.org/mozilla-central/source/testing/geckodriver/.cargo/config.toml

View File

@ -83,14 +83,14 @@ ifdef ENABLE_MOZSEARCH_PLUGIN
cd $(topobjdir)/ && cp _build_manifests/install/dist_include '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_INCLUDEMAP_BASENAME).map'
@echo 'Generating mozsearch scip index...'
$(RM) $(MOZSEARCH_SCIP_INDEX_BASENAME).zip
cp $(topsrcdir)/.cargo/config.in $(topsrcdir)/.cargo/config
cp $(topsrcdir)/.cargo/config.toml.in $(topsrcdir)/.cargo/config.toml
cd $(topsrcdir)/ && \
CARGO=$(MOZ_FETCHES_DIR)/rustc/bin/cargo \
RUSTC=$(MOZ_FETCHES_DIR)/rustc/bin/rustc \
$(MOZ_FETCHES_DIR)/rustc/bin/rust-analyzer scip . && \
zip -r5D '$(ABS_DIST)/$(PKG_PATH)$(MOZSEARCH_SCIP_INDEX_BASENAME).zip' \
index.scip
rm $(topsrcdir)/.cargo/config
rm $(topsrcdir)/.cargo/config.toml
ifeq ($(MOZ_BUILD_APP),mobile/android)
@echo 'Generating mozsearch java/kotlin semanticdb tarball...'
$(RM) $(MOZSEARCH_JAVA_INDEX_BASENAME).zip