| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 from datetime import datetime | 7 from datetime import datetime |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 copy_or_link(src_path('sky/engine/bindings/builtin.dart'), | 167 copy_or_link(src_path('sky/engine/bindings/builtin.dart'), |
| 168 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart')) | 168 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart')) |
| 169 bindings_path = os.path.join(build_dir, 'gen/sky/bindings') | 169 bindings_path = os.path.join(build_dir, 'gen/sky/bindings') |
| 170 # dart_sky.dart has many supporting files: | 170 # dart_sky.dart has many supporting files: |
| 171 copy(bindings_path, sdk_path('packages/sky/sdk_additions'), | 171 copy(bindings_path, sdk_path('packages/sky/sdk_additions'), |
| 172 dart_filter) | 172 dart_filter) |
| 173 | 173 |
| 174 # Mojo package, lots of overlap with gen, must be copied: | 174 # Mojo package, lots of overlap with gen, must be copied: |
| 175 copy(src_path('mojo/public'), sdk_path('packages/mojo/lib/public'), | 175 copy(src_path('mojo/public'), sdk_path('packages/mojo/lib/public'), |
| 176 dart_filter) | 176 dart_filter) |
| 177 mojom_dirs = [ os.path.join(build_dir, 'gen/dart-gen/mojom') ] | 177 |
| 178 mojom_dirs += args.extra_mojom_dirs | 178 # By convention the generated .mojom.dart files in a pub package |
| 179 for mojom_dir in mojom_dirs: | 179 # go under $PACKAGE/lib/mojom. |
| 180 copy(mojom_dir, sdk_path('packages/mojom/lib/'), gen_filter) | 180 # The mojo package owns all the .mojom.dart files that are not in the 'sky' |
| 181 # mojom module. |
| 182 def non_sky_gen_filter(path): |
| 183 if os.path.isdir(path) and path.endswith('sky'): |
| 184 return False |
| 185 return gen_filter(path) |
| 186 mojo_package_mojom_dir = sdk_path('packages/mojo/lib/mojom') |
| 187 copy(os.path.join(build_dir, 'gen/dart-gen/mojom'), mojo_package_mojom_dir, |
| 188 non_sky_gen_filter) |
| 189 |
| 190 # The Sky package owns the .mojom.dart files in the 'sky' mojom module. |
| 191 def sky_gen_filter(path): |
| 192 if os.path.isfile(path) and not os.path.dirname(path).endswith('sky'): |
| 193 return False |
| 194 return gen_filter(path) |
| 195 sky_package_mojom_dir = sdk_path('packages/sky/lib/mojom') |
| 196 copy(os.path.join(build_dir, 'gen/dart-gen/mojom'), sky_package_mojom_dir, |
| 197 sky_gen_filter) |
| 181 | 198 |
| 182 # Mojo SDK additions: | 199 # Mojo SDK additions: |
| 183 copy_or_link(src_path('mojo/public/dart/bindings.dart'), | 200 copy_or_link(src_path('mojo/public/dart/bindings.dart'), |
| 184 sdk_path('packages/mojo/sdk_additions/dart_mojo_bindings.dart')) | 201 sdk_path('packages/mojo/sdk_additions/dart_mojo_bindings.dart')) |
| 185 copy_or_link(src_path('mojo/public/dart/core.dart'), | 202 copy_or_link(src_path('mojo/public/dart/core.dart'), |
| 186 sdk_path('packages/mojo/sdk_additions/dart_mojo_core.dart')) | 203 sdk_path('packages/mojo/sdk_additions/dart_mojo_core.dart')) |
| 187 | 204 |
| 188 if not skip_apks: | 205 if not skip_apks: |
| 189 ensure_dir_exists(sdk_path('packages/sky/apks')) | 206 ensure_dir_exists(sdk_path('packages/sky/apks')) |
| 190 shutil.copy(os.path.join(build_dir, 'apks', 'SkyDemo.apk'), | 207 shutil.copy(os.path.join(build_dir, 'apks', 'SkyDemo.apk'), |
| 191 sdk_path('packages/sky/apks')) | 208 sdk_path('packages/sky/apks')) |
| 192 | 209 |
| 193 if generate_licenses: | 210 if generate_licenses: |
| 194 with open(sdk_path('LICENSES.sky'), 'w') as license_file: | 211 with open(sdk_path('LICENSES.sky'), 'w') as license_file: |
| 195 subprocess.check_call([src_path('tools/licenses.py'), 'credits'], | 212 subprocess.check_call([src_path('tools/licenses.py'), 'credits'], |
| 196 stdout=license_file) | 213 stdout=license_file) |
| 197 | 214 |
| 198 copy_or_link(src_path('AUTHORS'), sdk_path('packages/mojo/AUTHORS')) | 215 copy_or_link(src_path('AUTHORS'), sdk_path('packages/mojo/AUTHORS')) |
| 199 copy_or_link(src_path('LICENSE'), sdk_path('packages/mojo/LICENSE')) | 216 copy_or_link(src_path('LICENSE'), sdk_path('packages/mojo/LICENSE')) |
| 200 copy_or_link(src_path('AUTHORS'), sdk_path('packages/sky/AUTHORS')) | 217 copy_or_link(src_path('AUTHORS'), sdk_path('packages/sky/AUTHORS')) |
| 201 copy_or_link(src_path('LICENSE'), sdk_path('packages/sky/LICENSE')) | 218 copy_or_link(src_path('LICENSE'), sdk_path('packages/sky/LICENSE')) |
| 202 | 219 |
| 203 if args.fake_pub_get_into: | 220 if args.fake_pub_get_into: |
| 204 packages_dir = os.path.abspath(args.fake_pub_get_into) | 221 packages_dir = os.path.abspath(args.fake_pub_get_into) |
| 205 ensure_dir_exists(packages_dir) | 222 ensure_dir_exists(packages_dir) |
| 206 make_relative_symlink(sdk_path('packages/mojo/lib'), | 223 make_relative_symlink(sdk_path('packages/mojo/lib'), |
| 207 os.path.join(packages_dir, 'mojo')) | 224 os.path.join(packages_dir, 'mojo')) |
| 208 make_relative_symlink(sdk_path('packages/mojom/lib'), | |
| 209 os.path.join(packages_dir, 'mojom')) | |
| 210 make_relative_symlink(sdk_path('packages/sky/lib'), | 225 make_relative_symlink(sdk_path('packages/sky/lib'), |
| 211 os.path.join(packages_dir, 'sky')) | 226 os.path.join(packages_dir, 'sky')) |
| 212 | 227 |
| 228 mojom_dirs = [ mojo_package_mojom_dir, sky_package_mojom_dir ] |
| 229 mojom_dirs += args.extra_mojom_dirs |
| 230 for mojom_dir in mojom_dirs: |
| 231 copy(mojom_dir, os.path.join(packages_dir, 'mojom'), gen_filter) |
| 232 |
| 213 if should_commit: | 233 if should_commit: |
| 214 # Kinda a hack to make a prettier build dir for the commit: | 234 # Kinda a hack to make a prettier build dir for the commit: |
| 215 script_path = os.path.relpath(os.path.abspath(__file__), SRC_ROOT) | 235 script_path = os.path.relpath(os.path.abspath(__file__), SRC_ROOT) |
| 216 rel_build_dir = os.path.relpath(build_dir, SRC_ROOT) | 236 rel_build_dir = os.path.relpath(build_dir, SRC_ROOT) |
| 217 revision = git_revision() | 237 revision = git_revision() |
| 218 commit_url = "https://github.com/domokit/mojo/commit/%s" % revision | 238 commit_url = "https://github.com/domokit/mojo/commit/%s" % revision |
| 219 pattern = """Autogenerated from %s | 239 pattern = """Autogenerated from %s |
| 220 Using %s and build output from %s. | 240 Using %s and build output from %s. |
| 221 """ | 241 """ |
| 222 commit_message = pattern % (commit_url, script_path, rel_build_dir) | 242 commit_message = pattern % (commit_url, script_path, rel_build_dir) |
| 223 subprocess.check_call(['git', 'add', '.'], cwd=sdk_root) | 243 subprocess.check_call(['git', 'add', '.'], cwd=sdk_root) |
| 224 subprocess.check_call([ | 244 subprocess.check_call([ |
| 225 'git', 'commit', | 245 'git', 'commit', |
| 226 '-m', commit_message | 246 '-m', commit_message |
| 227 ], cwd=sdk_root) | 247 ], cwd=sdk_root) |
| 228 | 248 |
| 229 time_delta = datetime.now() - start_time | 249 time_delta = datetime.now() - start_time |
| 230 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds()) | 250 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds()) |
| 231 | 251 |
| 232 | 252 |
| 233 if __name__ == '__main__': | 253 if __name__ == '__main__': |
| 234 main() | 254 main() |
| OLD | NEW |