Revert "Cronet: Simplify repackage rules"
This reverts commit b74cdf4b03c3748352b6c7641a5701cd1958d511. Reason for revert: Broke compile of remoting_me2me_host_archive (see bug) Original change's description: > Cronet: Simplify repackage rules > > * Use dist_jar() rather than a custom script > * Avoids needing to extract .jars. > * Avoids needing to reference ".javac.jar" files, which > are somewhat of an implementation detail. > > * Added jar_excluded_patterns support to dist_jar() > > * Merges zip.py and dist_jar.py, since they were doing the > same thing. > > Spot checked that these two jars are the same before/after: > * cronet/cronet_impl_common_java.jar > * cronet/cronet_impl_native_java.jar > > Change-Id: I4d5a5f495ce0376ef2e53b6d4e3c9ebbc3d75ae1 > Reviewed-on: https://chromium-review.googlesource.com/c/1349872 > Reviewed-by: Paul Jensen <pauljensen@chromium.org> > Reviewed-by: Eric Stevenson <estevenson@chromium.org> > Commit-Queue: agrieve <agrieve@chromium.org> > Cr-Commit-Position: refs/heads/master@{#612210} TBR=pauljensen@chromium.org,agrieve@chromium.org,estevenson@chromium.org Bug: 910311 Change-Id: I0d06a36a1694e378bdfafda21f63fd2e5f258239 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/1355887 Reviewed-by: agrieve <agrieve@chromium.org> Commit-Queue: agrieve <agrieve@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#612347} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 8adb2d699d485be7080541f9b37fffea60ef1983
This commit is contained in:
Родитель
beb19f47db
Коммит
e19b43e9a6
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Archives a set of files.
|
||||
"""
|
||||
|
||||
import ast
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, 'gyp'))
|
||||
from util import build_utils
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser()
|
||||
build_utils.AddDepfileOption(parser)
|
||||
|
||||
parser.add_option('--inputs', help='List of files to archive.')
|
||||
parser.add_option('--output', help='Path to output archive.')
|
||||
parser.add_option('--base-dir',
|
||||
help='If provided, the paths in the archive will be '
|
||||
'relative to this directory', default='.')
|
||||
|
||||
options, _ = parser.parse_args()
|
||||
|
||||
inputs = ast.literal_eval(options.inputs)
|
||||
output = options.output
|
||||
base_dir = options.base_dir
|
||||
|
||||
with build_utils.AtomicOutput(output) as f:
|
||||
build_utils.DoZip(inputs, f, base_dir)
|
||||
|
||||
if options.depfile:
|
||||
build_utils.WriteDepfile(options.depfile, output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Merges a list of jars into a single jar."""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from util import build_utils
|
||||
|
||||
|
||||
def main(args):
|
||||
args = build_utils.ExpandFileArgs(args)
|
||||
parser = argparse.ArgumentParser()
|
||||
build_utils.AddDepfileOption(parser)
|
||||
parser.add_argument('--output', required=True, help='Path to output jar.')
|
||||
parser.add_argument('--jars', required=True, help='GN list of jar inputs.')
|
||||
options = parser.parse_args(args)
|
||||
|
||||
input_jars = build_utils.ParseGnList(options.jars)
|
||||
build_utils.MergeZips(options.output, input_jars)
|
||||
|
||||
if options.depfile:
|
||||
build_utils.WriteDepfile(options.depfile, options.output, input_jars,
|
||||
add_pydeps=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
|
@ -1,7 +1,7 @@
|
|||
# Generated by running:
|
||||
# build/print_python_deps.py --root build/android/gyp --output build/android/gyp/zip.pydeps build/android/gyp/zip.py
|
||||
# build/print_python_deps.py --root build/android/gyp --output build/android/gyp/create_dist_jar.pydeps build/android/gyp/create_dist_jar.py
|
||||
../../gn_helpers.py
|
||||
create_dist_jar.py
|
||||
util/__init__.py
|
||||
util/build_utils.py
|
||||
util/md5_check.py
|
||||
zip.py
|
|
@ -1,71 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
"""Archives a set of files."""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
from util import build_utils
|
||||
|
||||
|
||||
def main(args):
|
||||
args = build_utils.ExpandFileArgs(args)
|
||||
parser = argparse.ArgumentParser(args)
|
||||
parser.add_argument('--input-files', help='GN-list of files to zip.')
|
||||
parser.add_argument(
|
||||
'--input-files-base-dir',
|
||||
help='Paths in the archive will be relative to this directory')
|
||||
parser.add_argument('--input-zips', help='GN-list of zips to merge.')
|
||||
parser.add_argument(
|
||||
'--input-zips-excluded-globs',
|
||||
help='GN-list of globs for paths to exclude.')
|
||||
parser.add_argument('--output', required=True, help='Path to output archive.')
|
||||
compress_group = parser.add_mutually_exclusive_group()
|
||||
compress_group.add_argument(
|
||||
'--compress', action='store_true', help='Compress entries')
|
||||
compress_group.add_argument(
|
||||
'--no-compress',
|
||||
action='store_false',
|
||||
dest='compress',
|
||||
help='Do not compress entries')
|
||||
build_utils.AddDepfileOption(parser)
|
||||
options = parser.parse_args(args)
|
||||
|
||||
with build_utils.AtomicOutput(options.output) as f:
|
||||
with zipfile.ZipFile(f.name, 'w') as out_zip:
|
||||
depfile_deps = None
|
||||
if options.input_files:
|
||||
files = build_utils.ParseGnList(options.input_files)
|
||||
build_utils.DoZip(
|
||||
files,
|
||||
out_zip,
|
||||
options.input_files_base_dir,
|
||||
compress_fn=lambda _: options.compress)
|
||||
|
||||
if options.input_zips:
|
||||
files = build_utils.ParseGnList(options.input_zips)
|
||||
depfile_deps = files
|
||||
path_transform = None
|
||||
if options.input_zips_excluded_globs:
|
||||
globs = build_utils.ParseGnList(options.input_zips_excluded_globs)
|
||||
path_transform = (
|
||||
lambda p: None if build_utils.MatchesGlob(p, globs) else p)
|
||||
build_utils.MergeZips(
|
||||
out_zip,
|
||||
files,
|
||||
path_transform=path_transform,
|
||||
compress=options.compress)
|
||||
|
||||
# Depfile used only by dist_jar().
|
||||
if options.depfile:
|
||||
build_utils.WriteDepfile(
|
||||
options.depfile, options.output, inputs=depfile_deps, add_pydeps=False)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv[1:])
|
|
@ -1447,8 +1447,6 @@ if (enable_java_templates) {
|
|||
# implementation .jars.
|
||||
# use_unprocessed_jars: Use unprocessed / undesugared .jars.
|
||||
# direct_deps_only: Do not recurse on deps.
|
||||
# jar_excluded_patterns (optional)
|
||||
# List of globs for paths to exclude.
|
||||
#
|
||||
# Example
|
||||
# dist_jar("lib_fatjar") {
|
||||
|
@ -1511,7 +1509,7 @@ if (enable_java_templates) {
|
|||
_rebased_build_config = rebase_path(_build_config, root_build_dir)
|
||||
action_with_pydeps(_jar_target_name) {
|
||||
forward_variables_from(invoker, [ "data" ])
|
||||
script = "//build/android/gyp/zip.py"
|
||||
script = "//build/android/gyp/create_dist_jar.py"
|
||||
depfile = "$target_gen_dir/$target_name.d"
|
||||
deps = _deps
|
||||
|
||||
|
@ -1528,16 +1526,15 @@ if (enable_java_templates) {
|
|||
rebase_path(depfile, root_build_dir),
|
||||
"--output",
|
||||
rebase_path(invoker.output, root_build_dir),
|
||||
"--no-compress",
|
||||
]
|
||||
|
||||
if (_direct_deps_only) {
|
||||
if (_use_interface_jars) {
|
||||
args += [ "--input-zips=@FileArg($_rebased_build_config:javac:interface_classpath)" ]
|
||||
} else if (_use_unprocessed_jars) {
|
||||
args += [
|
||||
"--input-zips=@FileArg($_rebased_build_config:javac:classpath)",
|
||||
"--jars=@FileArg($_rebased_build_config:javac:interface_classpath)",
|
||||
]
|
||||
} else if (_use_unprocessed_jars) {
|
||||
args += [ "--jars=@FileArg($_rebased_build_config:javac:classpath)" ]
|
||||
} else {
|
||||
assert(
|
||||
false,
|
||||
|
@ -1545,17 +1542,13 @@ if (enable_java_templates) {
|
|||
}
|
||||
} else {
|
||||
if (_use_interface_jars) {
|
||||
args += [ "--input-zips=@FileArg($_rebased_build_config:dist_jar:all_interface_jars)" ]
|
||||
args += [ "--jars=@FileArg($_rebased_build_config:dist_jar:all_interface_jars)" ]
|
||||
} else if (_use_unprocessed_jars) {
|
||||
args += [ "--input-zips=@FileArg($_rebased_build_config:deps_info:javac_full_classpath)" ]
|
||||
args += [ "--jars=@FileArg($_rebased_build_config:deps_info:javac_full_classpath)" ]
|
||||
} else {
|
||||
args += [ "--input-zips=@FileArg($_rebased_build_config:deps_info:java_runtime_classpath)" ]
|
||||
args += [ "--jars=@FileArg($_rebased_build_config:deps_info:java_runtime_classpath)" ]
|
||||
}
|
||||
}
|
||||
if (defined(invoker.jar_excluded_patterns)) {
|
||||
args +=
|
||||
[ "--input-zips-excluded-globs=${invoker.jar_excluded_patterns}" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,49 +2,54 @@
|
|||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("python.gni")
|
||||
|
||||
# Creates a zip archive of the inputs.
|
||||
#
|
||||
# output (required)
|
||||
# Path to output zip.
|
||||
# inputs (required)
|
||||
# List of input files to zip.
|
||||
# List of input files relative to the current directory.
|
||||
#
|
||||
# output (required)
|
||||
# File name to write.
|
||||
#
|
||||
# base_dir (optional)
|
||||
# If provided, the archive paths will be relative to this directory.
|
||||
# Applies only to |inputs|.
|
||||
#
|
||||
# deps, public_deps, data, data_deps, testonly, visibility
|
||||
# deps, public_deps, data_deps, testonly, visibility (optional)
|
||||
# Normal meaning.
|
||||
template("zip") {
|
||||
action_with_pydeps(target_name) {
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"data",
|
||||
"data_deps",
|
||||
"deps",
|
||||
"public_deps",
|
||||
"testonly",
|
||||
"visibility",
|
||||
])
|
||||
script = "//build/android/gyp/zip.py"
|
||||
action(target_name) {
|
||||
script = "//build/android/gn/zip.py"
|
||||
depfile = "$target_gen_dir/$target_name.d"
|
||||
inputs = invoker.inputs
|
||||
outputs = [
|
||||
invoker.output,
|
||||
]
|
||||
|
||||
args = [
|
||||
"--output",
|
||||
rebase_path(invoker.output, root_build_dir),
|
||||
]
|
||||
assert(defined(invoker.inputs))
|
||||
rebase_inputs = rebase_path(invoker.inputs, root_build_dir)
|
||||
|
||||
_rebased_inputs = rebase_path(invoker.inputs, root_build_dir)
|
||||
args += [ "--input-files=$_rebased_inputs" ]
|
||||
assert(defined(invoker.output))
|
||||
rebase_output = rebase_path(invoker.output, root_build_dir)
|
||||
|
||||
args = [
|
||||
"--depfile",
|
||||
rebase_path(depfile, root_build_dir),
|
||||
"--inputs=$rebase_inputs",
|
||||
"--output=$rebase_output",
|
||||
]
|
||||
if (defined(invoker.base_dir)) {
|
||||
args += [
|
||||
"--input-files-base-dir",
|
||||
"--base-dir",
|
||||
rebase_path(invoker.base_dir, root_build_dir),
|
||||
]
|
||||
}
|
||||
|
||||
forward_variables_from(invoker,
|
||||
[
|
||||
"testonly",
|
||||
"deps",
|
||||
"public_deps",
|
||||
"data_deps",
|
||||
"visibility",
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче