| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Utility for dart_pkg and dart_pkg_app rules""" | 7 """Utility for dart_pkg and dart_pkg_app rules""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import errno | 10 import errno |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 args.sdk_ext_files)) | 306 args.sdk_ext_files)) |
| 307 for source in args.sdk_ext_files: | 307 for source in args.sdk_ext_files: |
| 308 relative_source = os.path.relpath(source, common_source_prefix) | 308 relative_source = os.path.relpath(source, common_source_prefix) |
| 309 target = os.path.join(sdk_ext_dir, relative_source) | 309 target = os.path.join(sdk_ext_dir, relative_source) |
| 310 copy_or_link(source, target) | 310 copy_or_link(source, target) |
| 311 | 311 |
| 312 # Symlink packages/ | 312 # Symlink packages/ |
| 313 package_path = os.path.join(args.package_root, args.package_name) | 313 package_path = os.path.join(args.package_root, args.package_name) |
| 314 link(lib_path, package_path) | 314 link(lib_path, package_path) |
| 315 | 315 |
| 316 # TODO(zra): Remove when bindings are generated by the mojom package and | |
| 317 # checked in. | |
| 318 # Copy generated bindings back to the source directory. | |
| 319 if not args.read_only: | |
| 320 generated_bindings = list_files(lib_path, mojom_dart_filter) | |
| 321 for binding in generated_bindings: | |
| 322 lib_rel_path = os.path.relpath(binding, lib_path) | |
| 323 dest = os.path.join(common_source_prefix, 'lib', lib_rel_path) | |
| 324 remove_if_exists(dest) | |
| 325 copy(binding, dest) | |
| 326 | |
| 327 # Link dart-pkg/$package/packages to dart-pkg/packages | 316 # Link dart-pkg/$package/packages to dart-pkg/packages |
| 328 link_if_possible(args.package_root, target_packages_dir) | 317 link_if_possible(args.package_root, target_packages_dir) |
| 329 | 318 |
| 330 # Remove any broken symlinks in target_dir and package root. | 319 # Remove any broken symlinks in target_dir and package root. |
| 331 remove_broken_symlinks(target_dir) | 320 remove_broken_symlinks(target_dir) |
| 332 remove_broken_symlinks(args.package_root) | 321 remove_broken_symlinks(args.package_root) |
| 333 | 322 |
| 334 # If any entrypoints are defined, write them to disk so that the analyzer | 323 # If any entrypoints are defined, write them to disk so that the analyzer |
| 335 # test can find them. | 324 # test can find them. |
| 336 with open(args.entries_file, 'w') as f: | 325 with open(args.entries_file, 'w') as f: |
| 337 for entrypoint in entrypoint_targets: | 326 for entrypoint in entrypoint_targets: |
| 338 f.write(entrypoint + '\n') | 327 f.write(entrypoint + '\n') |
| 339 | 328 |
| 340 # Write stamp file. | 329 # Write stamp file. |
| 341 with open(args.stamp_file, 'w'): | 330 with open(args.stamp_file, 'w'): |
| 342 pass | 331 pass |
| 343 | 332 |
| 344 return 0 | 333 return 0 |
| 345 | 334 |
| 346 if __name__ == '__main__': | 335 if __name__ == '__main__': |
| 347 sys.exit(main()) | 336 sys.exit(main()) |
| OLD | NEW |