mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
[ninjalog_uploader] Add BuildTargetFromCommandLine function
This function extracts build target from command line. Bug: 900161 Change-Id: I38d37689a42437de76933ea3c9afb9def5a1253c Reviewed-on: https://chromium-review.googlesource.com/c/1381911 Commit-Queue: Takuto Ikuta <tikuta@chromium.org> Reviewed-by: Shinya Kawanaka <shinyak@chromium.org>
This commit is contained in:
@@ -46,6 +46,34 @@ def ParseGNArgs(gn_args):
|
||||
build_configs[config["name"]] = config["current"]["value"]
|
||||
return build_configs
|
||||
|
||||
def GetBuildTargetFromCommandLine(cmdline):
|
||||
"""Get build targets from commandline."""
|
||||
|
||||
# Skip argv0.
|
||||
idx = 1
|
||||
|
||||
# Skipping all args that involve these flags, and taking all remaining args
|
||||
# as targets.
|
||||
onearg_flags = ('-C', '-f', '-j', '-k', '-l', '-d', '-t', '-w')
|
||||
zeroarg_flags = ('--version', '-n', '-v')
|
||||
|
||||
targets = []
|
||||
|
||||
while idx < len(cmdline):
|
||||
if cmdline[idx] in onearg_flags:
|
||||
idx += 2
|
||||
continue
|
||||
|
||||
if (cmdline[idx][:2] in onearg_flags or
|
||||
cmdline[idx] in zeroarg_flags):
|
||||
idx += 1
|
||||
continue
|
||||
|
||||
targets.append(cmdline[idx])
|
||||
idx += 1
|
||||
|
||||
return targets
|
||||
|
||||
|
||||
def GetMetadata(cmdline, ninjalog):
|
||||
"""Get metadata for uploaded ninjalog."""
|
||||
|
||||
Reference in New Issue
Block a user