Commit a866c351 authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

[Lorenz] Add gn_path optional parameter to generate graph script

This allows the recipe to specify which gn should be run.

Bug: 1098864
Change-Id: Ia7d770b1783ca4d0d44596f7f82481f92da8d16a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2357453
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Reviewed-by: default avatarMohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798715}
parent 30d9990c
...@@ -97,12 +97,13 @@ def _run_jdeps(jdeps_path: str, filepath: pathlib.Path): ...@@ -97,12 +97,13 @@ def _run_jdeps(jdeps_path: str, filepath: pathlib.Path):
return jdeps_res.stdout return jdeps_res.stdout
def _run_gn_desc_list_dependencies(build_output_dir: str, target: str): def _run_gn_desc_list_dependencies(build_output_dir: str, target: str,
gn_path: str):
"""Runs gn desc to list all jars that a target depends on. """Runs gn desc to list all jars that a target depends on.
This includes direct and indirect dependencies.""" This includes direct and indirect dependencies."""
gn_desc_res = subprocess.run( gn_desc_res = subprocess.run(
['gn', 'desc', '--all', build_output_dir, target, 'deps'], [gn_path, 'desc', '--all', build_output_dir, target, 'deps'],
capture_output=True, capture_output=True,
text=True, text=True,
check=True) check=True)
...@@ -172,11 +173,16 @@ def main(): ...@@ -172,11 +173,16 @@ def main():
'--jdeps-path', '--jdeps-path',
default=JDEPS_PATH, default=JDEPS_PATH,
help='Path to the jdeps executable.') help='Path to the jdeps executable.')
arg_parser.add_argument('-g',
'--gn-path',
default='gn',
help='Path to the gn executable.')
arguments = arg_parser.parse_args() arguments = arg_parser.parse_args()
print('Getting list of dependency jars...') print('Getting list of dependency jars...')
gn_desc_output = _run_gn_desc_list_dependencies(arguments.build_output_dir, gn_desc_output = _run_gn_desc_list_dependencies(arguments.build_output_dir,
arguments.target) arguments.target,
arguments.gn_path)
target_jars: JarTargetList = list_original_targets_and_jars( target_jars: JarTargetList = list_original_targets_and_jars(
gn_desc_output, arguments.build_output_dir) gn_desc_output, arguments.build_output_dir)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment