Commit 7a07b224 authored by agrieve's avatar agrieve Committed by Commit bot

GN: Add depfile for java_cpp_enum

BUG=558194

Review URL: https://codereview.chromium.org/1451223004

Cr-Commit-Position: refs/heads/master@{#360527}
parent 113c3bc1
......@@ -306,6 +306,7 @@ def AssertFilesList(output_paths, assert_files_list):
def DoMain(argv):
usage = 'usage: %prog [options] [output_dir] input_file(s)...'
parser = optparse.OptionParser(usage=usage)
build_utils.AddDepfileOption(parser)
parser.add_option('--assert_file', action="append", default=[],
dest="assert_files_list", help='Assert that the given '
......@@ -320,6 +321,22 @@ def DoMain(argv):
action='store_true')
options, args = parser.parse_args(argv)
if options.srcjar:
if not args:
parser.error('Need to specify at least one input file')
input_paths = args
else:
if len(args) < 2:
parser.error(
'Need to specify output directory and at least one input file')
output_dir = args[0]
input_paths = args[1:]
if options.depfile:
python_deps = build_utils.GetPythonDependencies()
build_utils.WriteDepfile(options.depfile, input_paths + python_deps)
if options.srcjar:
if options.print_output_only:
parser.error('--print_output_only does not work with --srcjar')
......@@ -327,17 +344,12 @@ def DoMain(argv):
parser.error('--assert_file does not work with --srcjar')
with zipfile.ZipFile(options.srcjar, 'w', zipfile.ZIP_STORED) as srcjar:
for output_path, data in DoGenerate(args):
for output_path, data in DoGenerate(input_paths):
srcjar.writestr(build_utils.CreateHermeticZipInfo(output_path), data)
else:
# TODO(agrieve): Delete this non-srcjar branch once GYP is gone.
if len(args) < 2:
parser.error(
'Need to specify output directory and at least one input file')
output_dir = args[0]
output_paths = []
for output_path, data in DoGenerate(args[1:]):
for output_path, data in DoGenerate(input_paths):
full_path = os.path.join(output_dir, output_path)
output_paths.append(full_path)
if not options.print_output_only:
......
......@@ -348,13 +348,19 @@ template("java_cpp_enum") {
])
script = "//build/android/gyp/java_cpp_enum.py"
depfile = "$target_gen_dir/$target_name.d"
_srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
_rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir)
_rebased_sources = rebase_path(invoker.sources, root_build_dir)
args = [ "--srcjar=$_rebased_srcjar_path" ] + _rebased_sources
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--srcjar=$_rebased_srcjar_path",
] + _rebased_sources
outputs = [
depfile,
_srcjar_path,
]
}
......
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