1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39

build / ios / presubmit_support.py [blame]

# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit helpers for ios

See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""

from . import update_bundle_filelist


def CheckBundleData(input_api, output_api, base, globroot='//'):
  root = input_api.change.RepositoryRoot()
  filelist = input_api.os_path.join(input_api.PresubmitLocalPath(),
                                    base + '.filelist')
  globlist = input_api.os_path.join(input_api.PresubmitLocalPath(),
                                    base + '.globlist')
  if globroot.startswith('//'):
    globroot = input_api.os_path.join(input_api.change.RepositoryRoot(),
                                      globroot[2:])
  else:
    globroot = input_api.os_path.join(input_api.PresubmitLocalPath(), globroot)
  if update_bundle_filelist.process_filelist(filelist,
                                             globlist,
                                             globroot,
                                             check=True,
                                             verbose=input_api.verbose) == 0:
    return []
  else:
    script = input_api.os_path.join(input_api.change.RepositoryRoot(), 'build',
                                    'ios', 'update_bundle_filelist.py')

    return [
        output_api.PresubmitError(
            'Filelist needs to be re-generated. Please run \'python3 %s %s %s '
            '%s\' and include the changes in this CL' %
            (script, filelist, globlist, globroot))
    ]