Make list_files.py and list_dart_files.py return absolute paths

This makes doing an SDK build in the Fuchsia tree easier

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2564413004 .
This commit is contained in:
Zachary Anderson 2016-12-12 13:09:26 -08:00
parent cd116d861b
commit a858542c89
6 changed files with 13 additions and 21 deletions

View file

@ -88,9 +88,7 @@ action("create_sdk") {
], ],
"list lines") "list lines")
inputs = rebase_path(sdk_lib_files, "", "sdk/lib") + inputs = sdk_lib_files + preamble_files + sdk_bin_files +
rebase_path(preamble_files, "", "sdk/lib") +
rebase_path(sdk_bin_files, "", "sdk/bin") +
[ [
"sdk/lib/dart_client.platform", "sdk/lib/dart_client.platform",
"sdk/lib/dart_server.platform", "sdk/lib/dart_server.platform",

View file

@ -16,7 +16,6 @@ template("make_third_party_pkg_files_stamp") {
pattern = invoker.pattern pattern = invoker.pattern
} }
path = path path = path
new_base = "//"
output = "$target_gen_dir/third_party_pkg_files_$id.stamp" output = "$target_gen_dir/third_party_pkg_files_$id.stamp"
} }
} }

View file

@ -411,10 +411,10 @@ if (!defined(is_fuchsia) || !is_fuchsia) {
script = "../../tools/patch_sdk.py" script = "../../tools/patch_sdk.py"
# We list all files which make up the sdk (modulo patches) and get them back # We list all files which make up the sdk (modulo patches) and get them
# as a GN list object. # back as a GN list object.
shared_sdk_sources = exec_script("../../tools/list_dart_files.py", shared_sdk_sources = exec_script("../../tools/list_dart_files.py",
[ "../../sdk/lib" ], [ rebase_path("../../sdk/lib") ],
"list lines") "list lines")
# We list the `patch_sdk.dart` tool here because the [script] (which is # We list the `patch_sdk.dart` tool here because the [script] (which is
@ -423,8 +423,8 @@ if (!defined(is_fuchsia) || !is_fuchsia) {
"../../tools/patch_sdk.dart", "../../tools/patch_sdk.dart",
] ]
# Files below are not patches, they will not be in [concatenation_files] but # Files below are not patches, they will not be in [concatenation_files]
# the `patch_sdk.dart` script will copy them into the patched sdk. # but the `patch_sdk.dart` script will copy them into the patched sdk.
inputs += [ inputs += [
"../lib/typed_data.dart", "../lib/typed_data.dart",
"../bin/builtin.dart", "../bin/builtin.dart",

View file

@ -16,6 +16,8 @@ import sys
def main(argv): def main(argv):
directory = argv[1] directory = argv[1]
if not os.path.isabs(directory):
directory = os.path.realpath(directory)
pattern = None pattern = None
if len(argv) > 2: if len(argv) > 2:
@ -34,7 +36,7 @@ def main(argv):
for filename in files: for filename in files:
if filename.endswith('.dart') and not filename.endswith('_test.dart'): if filename.endswith('.dart') and not filename.endswith('_test.dart'):
fullname = os.path.relpath(os.path.join(root, filename)) fullname = os.path.join(directory, root, filename)
fullname = fullname.replace(os.sep, '/') fullname = fullname.replace(os.sep, '/')
print fullname print fullname

View file

@ -17,11 +17,13 @@ import sys
def main(argv): def main(argv):
pattern = re.compile(argv[1]) pattern = re.compile(argv[1])
for directory in argv[2:]: for directory in argv[2:]:
if not os.path.isabs(directory):
directory = os.path.realpath(directory)
for root, directories, files in os.walk(directory): for root, directories, files in os.walk(directory):
if '.git' in directories: if '.git' in directories:
directories.remove('.git') directories.remove('.git')
for filename in files: for filename in files:
fullname = os.path.relpath(os.path.join(root, filename)) fullname = os.path.join(directory, root, filename)
fullname = fullname.replace(os.sep, '/') fullname = fullname.replace(os.sep, '/')
if re.search(pattern, fullname): if re.search(pattern, fullname):
print fullname print fullname

View file

@ -7,14 +7,6 @@ _dart_root = rebase_path("..")
template("create_timestamp_file") { template("create_timestamp_file") {
assert(defined(invoker.path), "Must specify 'path'") assert(defined(invoker.path), "Must specify 'path'")
assert(defined(invoker.output), "Must specify 'output'") assert(defined(invoker.output), "Must specify 'output'")
new_base = "."
if (defined(invoker.new_base)) {
new_base = invoker.new_base
}
current_base = "."
if (defined(invoker.current_base)) {
current_base = invoker.current_base
}
path = invoker.path path = invoker.path
output = invoker.output output = invoker.output
action(target_name) { action(target_name) {
@ -25,8 +17,7 @@ template("create_timestamp_file") {
files = exec_script("$_dart_root/tools/list_dart_files.py", files = exec_script("$_dart_root/tools/list_dart_files.py",
list_args, list_args,
"list lines") "list lines")
inputs = [ "$_dart_root/tools/list_dart_files.py" ] + inputs = [ "$_dart_root/tools/list_dart_files.py" ] + files
rebase_path(files, new_base, current_base)
outputs = [ outputs = [
output, output,
] ]