• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24    test_cmd = input_api.Command(
25        name=cmd_name,
26        cmd=[input_api.python3_executable, run_cargo_vet_path] + vet_args,
27        kwargs={},
28        message=output_api.PresubmitError)
29    if input_api.verbose:
30        print('Running ' + cmd_name)
31    return input_api.RunTests([test_cmd])
32