| Index: mojo/public/tools/dart_pkg.py
|
| diff --git a/mojo/public/tools/dart_pkg.py b/mojo/public/tools/dart_pkg.py
|
| index d73491f9d6f62401cf762c0b9236c7e38672c8d8..58725148d08edd1ece404fe42b609d7df24e37d8 100755
|
| --- a/mojo/public/tools/dart_pkg.py
|
| +++ b/mojo/public/tools/dart_pkg.py
|
| @@ -105,6 +105,20 @@ def copy_or_link(from_root, to_root, filter_func=None):
|
| copy(from_root, to_root, filter_func)
|
|
|
|
|
| +def list_files(from_root, filter_func=None):
|
| + file_list = []
|
| + for root, dirs, files in os.walk(from_root):
|
| + # filter_func expects paths not names, so wrap it to make them absolute.
|
| + wrapped_filter = None
|
| + if filter_func:
|
| + wrapped_filter = lambda name: filter_func(os.path.join(root, name))
|
| + for name in filter(wrapped_filter, files):
|
| + path = os.path.join(root, name)
|
| + file_list.append(path)
|
| + dirs[:] = filter(wrapped_filter, dirs)
|
| + return file_list
|
| +
|
| +
|
| def remove_broken_symlink(path):
|
| try:
|
| link_path = os.readlink(path)
|
| @@ -168,6 +182,11 @@ def main():
|
| help='.mojom and .mojom.dart sources',
|
| nargs='*',
|
| default=[])
|
| + parser.add_argument('--sdk-ext-directories',
|
| + metavar='sdk_ext_directories',
|
| + help='Directory containing .dart sources',
|
| + nargs='*',
|
| + default=[])
|
| args = parser.parse_args()
|
|
|
| # We must have a pubspec.yaml.
|
| @@ -181,6 +200,16 @@ def main():
|
| target = os.path.join(target_dir, relative_source)
|
| copy_or_link(source, target)
|
|
|
| + # Copy sdk-ext sources into pkg directory
|
| + sdk_ext_dir = os.path.join(target_dir, 'sdk_ext')
|
| + for directory in args.sdk_ext_directories:
|
| + sdk_ext_sources = list_files(directory, dart_filter)
|
| + common_prefix = os.path.commonprefix(sdk_ext_sources)
|
| + for source in sdk_ext_sources:
|
| + relative_source = os.path.relpath(source, common_prefix)
|
| + target = os.path.join(sdk_ext_dir, relative_source)
|
| + copy_or_link(source, target)
|
| +
|
| lib_path = os.path.join(target_dir, "lib")
|
| lib_mojom_path = os.path.join(lib_path, "mojom")
|
|
|
|
|