Bug 1835972 - Allow to force rust vendoring. r=firefox-build-system-reviewers,sergesanspaille

With the requirement that `cargo vet` goes through, testing things out
can be annoying. Add a --force option that allows to temporarily ignore
problems. This also replaces the --build-peers-said-large-imports-were-ok
flag.

Differential Revision: https://phabricator.services.mozilla.com/D179512
This commit is contained in:
Mike Hommey 2023-06-06 00:03:10 +00:00
Родитель 14304a177a
Коммит 7d01bc83cd
3 изменённых файлов: 10 добавлений и 15 удалений

Просмотреть файл

@ -10,8 +10,8 @@ additional support code for FFI.
1. In /toolkit/library/rust/shared/Cargo.toml, Set the `rev` attribute of the
`mp4parse_capi` dependency to the revision you want to use.
2. Run `mach vendor rust` (`--build-peers-said-large-imports-were-ok` may be
necessary since the `mp4parse` crate's lib.rs is quite large).
2. Run `mach vendor rust` (`--force` may be necessary since the `mp4parse`
crate's lib.rs is quite large).
3. Verify the expected changes in /third_party/rust.
4. Build, run try, etc.

Просмотреть файл

@ -182,13 +182,9 @@ Please commit or stash these changes before vendoring, or re-run with `--ignore-
default=False,
)
@CommandArgument(
"--build-peers-said-large-imports-were-ok",
"--force",
action="store_true",
help=(
"Permit overly-large files to be added to the repository. "
"To get permission to set this, raise a question in the #build "
"channel at https://chat.mozilla.org."
),
help=("Ignore any kind of error that happens during vendoring"),
default=False,
)
@CommandArgument(

Просмотреть файл

@ -592,9 +592,7 @@ license file's hash.
ret = False
return ret
def vendor(
self, ignore_modified=False, build_peers_said_large_imports_were_ok=False
):
def vendor(self, ignore_modified=False, force=False):
from mozbuild.mach_commands import cargo_vet
self.populate_logger()
@ -834,7 +832,7 @@ license file's hash.
# If we failed when checking the crates list and/or running `cargo vet`,
# stop before invoking `cargo vendor`.
if failed:
if failed and not force:
return False
res = subprocess.run(
@ -890,7 +888,7 @@ license file's hash.
)
)
if not self._check_licenses(vendor_dir):
if not self._check_licenses(vendor_dir) and not force:
self.log(
logging.ERROR,
"license_check_failed",
@ -919,7 +917,7 @@ license file's hash.
# Forcefully complain about large files being added, as history has
# shown that large-ish files typically are not needed.
if large_files and not build_peers_said_large_imports_were_ok:
if large_files:
self.log(
logging.ERROR,
"filesize_check",
@ -942,7 +940,8 @@ The changes from `mach vendor rust` will NOT be added to version control.
)
self.repository.forget_add_remove_files(vendor_dir)
self.repository.clean_directory(vendor_dir)
return False
if not force:
return False
# Only warn for large imports, since we may just have large code
# drops from time to time (e.g. importing features into m-c).