1# Copyright 2024 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5"""Top-level presubmit for //third_party/rust 6 7See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts 8for more details about the presubmit API built into depot_tools. 9""" 10 11PRESUBMIT_VERSION = '2.0.0' 12 13def CheckCargoVet(input_api, output_api): 14 vet_args = ['check'] 15 16 # Hermetic and idempotent. 17 vet_args += ['--locked', '--frozen', '--no-minimize-exemptions'] 18 19 run_cargo_vet_path = input_api.os_path.join( 20 input_api.PresubmitLocalPath(), 21 '..', '..', 'tools', 'crates', 'run_cargo_vet.py') 22 cmd_name = '//tools/crates/run_cargo_vet.py check' 23 test_cmd = input_api.Command( 24 name=cmd_name, 25 cmd=[input_api.python3_executable, run_cargo_vet_path] + vet_args, 26 kwargs={}, 27 message=output_api.PresubmitPromptWarning) 28 if input_api.verbose: 29 print('Running ' + cmd_name) 30 return input_api.RunTests([test_cmd]) 31 32