Skip to content

Commit

Permalink
Reland "[ios] Add --landmines-path to build/landmines.py script"
Browse files Browse the repository at this point in the history
This is a reland of aafd725

Original change's description:
> [ios] Add --landmines-path to build/landmines.py script
> 
> Chrome on iOS has some internal landmines and uses a forked version
> of build/landmines.py for that to allow using a separate landmines
> file.
> 
> Add a --landmines-path parameter to build/landmines.py script in
> order to remove the forked version and instead use the shared one.
> 
> Bug: 1033067
> Change-Id: Iac668c5877ae181442078cda7ce8e727f91104b4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2283582
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#786218}

Bug: 1033067
Change-Id: Ice49ba16caf21045e0b513fb4b55cf198d3f0d36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2287477
Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Cr-Commit-Position: refs/heads/master@{#786352}
  • Loading branch information
sdefresne authored and Commit Bot committed Jul 8, 2020
1 parent c09be2f commit 52ba2df
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
17 changes: 17 additions & 0 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4090,6 +4090,23 @@ hooks = [
'src/build/landmines.py',
],
},
{
# This clobbers when necessary (based on get_landmines.py). It must be the
# first hook so that other things that get/generate into the output
# directory will not subsequently be clobbered. This script is only run
# for iOS build with src_internal.
'name': 'landmines_ios_internal',
'pattern': '.',
'condition': 'checkout_ios and checkout_src_internal',
'action': [
'python',
'src/build/landmines.py',
'--landmine-scripts',
'src/ios_internal/build/get_landmines.py',
'--landmines-path',
'src/ios_internal/.landmines',
],
},
{
# Ensure that the DEPS'd "depot_tools" has its self-update capability
# disabled.
Expand Down
14 changes: 11 additions & 3 deletions build/landmines.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ def get_build_dir(src_dir):
return os.path.abspath(os.path.join(src_dir, output_dir))


def clobber_if_necessary(new_landmines, src_dir):
def clobber_if_necessary(new_landmines, src_dir, landmines_path):
"""Does the work of setting, planting, and triggering landmines."""
out_dir = get_build_dir(src_dir)
landmines_path = os.path.normpath(os.path.join(src_dir, '.landmines'))
try:
os.makedirs(out_dir)
except OSError as e:
Expand Down Expand Up @@ -95,6 +94,10 @@ def process_options():
parser.add_option('-d', '--src-dir',
help='Path of the source root dir. Overrides the default location of the '
'source root dir when calculating the build directory.')
parser.add_option(
'-l',
'--landmines-path',
help='Path to the landmines file to use (defaults to .landmines)')
parser.add_option('-v', '--verbose', action='store_true',
default=('LANDMINES_VERBOSE' in os.environ),
help=('Emit some extra debugging information (default off). This option '
Expand Down Expand Up @@ -137,7 +140,12 @@ def main():
universal_newlines=True)
output, _ = proc.communicate()
landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()])
clobber_if_necessary(landmines, options.src_dir)
if options.landmines_path:
landmines_path = options.landmines_path
else:
landmines_path = os.path.join(options.src_dir, '.landmines')
clobber_if_necessary(landmines, options.src_dir,
os.path.normpath(landmines_path))

return 0

Expand Down

0 comments on commit 52ba2df

Please sign in to comment.