diff --git a/BUILD.gn b/BUILD.gn index a027a2e6150..7d1f7fd8764 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -70,12 +70,13 @@ action("create_sdk") { ] sdk_lib_files = exec_script("tools/list_dart_files.py", - [ rebase_path("sdk/lib") ], + [ "absolute", rebase_path("sdk/lib") ], "list lines") preamble_files = exec_script("tools/list_files.py", [ + "absolute", "", rebase_path("sdk/lib/_internal/js_runtime/lib/preambles"), ], @@ -83,14 +84,13 @@ action("create_sdk") { sdk_bin_files = exec_script("tools/list_files.py", [ + "absolute", "", rebase_path("sdk/bin"), ], "list lines") - inputs = rebase_path(sdk_lib_files, "", "sdk/lib") + - rebase_path(preamble_files, "", "sdk/lib") + - rebase_path(sdk_bin_files, "", "sdk/bin") + + inputs = sdk_lib_files + preamble_files + sdk_bin_files + [ "sdk/lib/dart_client.platform", "sdk/lib/dart_server.platform", diff --git a/create_sdk.gyp b/create_sdk.gyp index b1b9361ddda..9e41ef91ee6 100644 --- a/create_sdk.gyp +++ b/create_sdk.gyp @@ -23,15 +23,15 @@ 'inputs': [ # Xcode can only handle a certain amount of files in one list # (also depending on the length of the path from where you run). - ' + python tools/list_dart_files.py {absolute, relative} """ import os @@ -15,11 +19,16 @@ import sys def main(argv): - directory = argv[1] + mode = argv[1] + if mode not in ['absolute', 'relative']: + raise Exception("First argument must be 'absolute' or 'relative'") + directory = argv[2] + if mode in 'absolute' and not os.path.isabs(directory): + directory = os.path.realpath(directory) pattern = None - if len(argv) > 2: - pattern = re.compile(argv[2]) + if len(argv) > 3: + pattern = re.compile(argv[3]) for root, directories, files in os.walk(directory): # We only care about actual source files, not generated code or tests. @@ -34,7 +43,10 @@ def main(argv): for filename in files: if filename.endswith('.dart') and not filename.endswith('_test.dart'): - fullname = os.path.relpath(os.path.join(root, filename)) + if mode in 'absolute': + fullname = os.path.join(directory, root, filename) + else: + fullname = os.path.relpath(os.path.join(root, filename)) fullname = fullname.replace(os.sep, '/') print fullname diff --git a/tools/list_files.py b/tools/list_files.py index ad277e853f0..b63d6ab0e32 100755 --- a/tools/list_files.py +++ b/tools/list_files.py @@ -5,8 +5,12 @@ """Tool for listing files whose name match a pattern. +If the first argument is 'relative', the script produces paths relative to the +current working directory. If the first argument is 'absolute', the script +produces absolute paths. + Usage: - python tools/list_files.py PATTERN DIRECTORY... + python tools/list_files.py {absolute, relative} PATTERN DIRECTORY... """ import os @@ -15,13 +19,21 @@ import sys def main(argv): - pattern = re.compile(argv[1]) - for directory in argv[2:]: + mode = argv[1] + if mode not in ['absolute', 'relative']: + raise Exception("First argument must be 'absolute' or 'relative'") + pattern = re.compile(argv[2]) + for directory in argv[3:]: + if mode in 'absolute' and not os.path.isabs(directory): + directory = os.path.realpath(directory) for root, directories, files in os.walk(directory): if '.git' in directories: directories.remove('.git') for filename in files: - fullname = os.path.relpath(os.path.join(root, filename)) + if mode in 'absolute': + fullname = os.path.join(directory, root, filename) + else: + fullname = os.path.relpath(os.path.join(root, filename)) fullname = fullname.replace(os.sep, '/') if re.search(pattern, fullname): print fullname diff --git a/utils/compiler/compiler.gyp b/utils/compiler/compiler.gyp index 63c4daeb36d..272dd0aa137 100644 --- a/utils/compiler/compiler.gyp +++ b/utils/compiler/compiler.gyp @@ -20,7 +20,10 @@ 'inputs': [ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)', '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart', - '