From 26df6afc74ddbe8fb9327c280ac09403b81832cd Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Mon, 1 Apr 2024 21:26:49 +0000 Subject: [PATCH] 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 --- .cargo/{config.in => config.toml.in} | 4 ++-- config/moz.build | 2 +- config/recurse.mk | 6 +++--- js/src/make-source-package.py | 2 +- moz.build | 4 +++- python/mozbuild/mozbuild/mach_commands.py | 7 ++++--- python/mozbuild/mozbuild/vendor/vendor_rust.py | 6 +++--- taskcluster/scripts/misc/build-geckodriver.sh | 2 +- taskcluster/scripts/misc/wrench-deps-vendoring.sh | 2 +- testing/geckodriver/.cargo/{config => config.toml} | 0 testing/geckodriver/doc/ARM.md | 4 ++-- toolkit/mozapps/installer/packager.mk | 4 ++-- 12 files changed, 23 insertions(+), 20 deletions(-) rename .cargo/{config.in => config.toml.in} (97%) rename testing/geckodriver/.cargo/{config => config.toml} (100%) diff --git a/.cargo/config.in b/.cargo/config.toml.in similarity index 97% rename from .cargo/config.in rename to .cargo/config.toml.in index 5675cccfc305..0180b957177b 100644 --- a/.cargo/config.in +++ b/.cargo/config.toml.in @@ -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 diff --git a/config/moz.build b/config/moz.build index 3280aac27e10..9ad0268c256a 100644 --- a/config/moz.build +++ b/config/moz.build @@ -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"], ) diff --git a/config/recurse.mk b/config/recurse.mk index a2e10e6a1878..6afad04c2ee1 100644 --- a/config/recurse.mk +++ b/config/recurse.mk @@ -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 diff --git a/js/src/make-source-package.py b/js/src/make-source-package.py index 3ea6b7e310f2..d24b47d667c5 100755 --- a/js/src/make-source-package.py +++ b/js/src/make-source-package.py @@ -179,7 +179,7 @@ rsync_filter_list = """ + /config/** + /python/** -+ /.cargo/config.in ++ /.cargo/config.toml.in + /third_party/function2/** - /third_party/python/gyp diff --git a/moz.build b/moz.build index 5af364216557..9db27fd056f9 100644 --- a/moz.build +++ b/moz.build @@ -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 diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 2398f8de03a1..20b451dc1680 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -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. diff --git a/python/mozbuild/mozbuild/vendor/vendor_rust.py b/python/mozbuild/mozbuild/vendor/vendor_rust.py index 3dae30de2550..ed32907fcf36 100644 --- a/python/mozbuild/mozbuild/vendor/vendor_rust.py +++ b/python/mozbuild/mozbuild/vendor/vendor_rust.py @@ -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( diff --git a/taskcluster/scripts/misc/build-geckodriver.sh b/taskcluster/scripts/misc/build-geckodriver.sh index 7434ee2ef8da..96b5b64f620e 100755 --- a/taskcluster/scripts/misc/build-geckodriver.sh +++ b/taskcluster/scripts/misc/build-geckodriver.sh @@ -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" diff --git a/taskcluster/scripts/misc/wrench-deps-vendoring.sh b/taskcluster/scripts/misc/wrench-deps-vendoring.sh index 8b1897bfd819..7fd77bc07416 100755 --- a/taskcluster/scripts/misc/wrench-deps-vendoring.sh +++ b/taskcluster/scripts/misc/wrench-deps-vendoring.sh @@ -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/ diff --git a/testing/geckodriver/.cargo/config b/testing/geckodriver/.cargo/config.toml similarity index 100% rename from testing/geckodriver/.cargo/config rename to testing/geckodriver/.cargo/config.toml diff --git a/testing/geckodriver/doc/ARM.md b/testing/geckodriver/doc/ARM.md index 8ae9afae5840..1b93f8f17cb9 100644 --- a/testing/geckodriver/doc/ARM.md +++ b/testing/geckodriver/doc/ARM.md @@ -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 diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index aeba614e40fd..6d36d51375da 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -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