| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 copy_or_link(src_path('sky/engine/bindings/builtin.dart'), | 163 copy_or_link(src_path('sky/engine/bindings/builtin.dart'), |
| 164 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart')) | 164 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart')) |
| 165 bindings_path = os.path.join(build_dir, 'gen/sky/bindings') | 165 bindings_path = os.path.join(build_dir, 'gen/sky/bindings') |
| 166 # dart_sky.dart has many supporting files: | 166 # dart_sky.dart has many supporting files: |
| 167 copy(bindings_path, sdk_path('packages/sky/sdk_additions'), | 167 copy(bindings_path, sdk_path('packages/sky/sdk_additions'), |
| 168 dart_filter) | 168 dart_filter) |
| 169 | 169 |
| 170 # Mojo package, lots of overlap with gen, must be copied: | 170 # Mojo package, lots of overlap with gen, must be copied: |
| 171 copy(src_path('mojo/public'), sdk_path('packages/mojo/lib/public'), | 171 copy(src_path('mojo/public'), sdk_path('packages/mojo/lib/public'), |
| 172 dart_filter) | 172 dart_filter) |
| 173 copy(os.path.join(build_dir, 'gen/dart-gen/keyboard'), |
| 174 sdk_path('packages/keyboard/lib'), gen_filter) |
| 173 copy(os.path.join(build_dir, 'gen/dart-gen/mojo'), | 175 copy(os.path.join(build_dir, 'gen/dart-gen/mojo'), |
| 174 sdk_path('packages/mojo/lib'), gen_filter) | 176 sdk_path('packages/mojo/lib'), gen_filter) |
| 175 | 177 |
| 176 # Mojo SDK additions: | 178 # Mojo SDK additions: |
| 177 copy_or_link(src_path('mojo/public/dart/bindings.dart'), | 179 copy_or_link(src_path('mojo/public/dart/bindings.dart'), |
| 178 sdk_path('packages/mojo/sdk_additions/dart_mojo_bindings.dart')) | 180 sdk_path('packages/mojo/sdk_additions/dart_mojo_bindings.dart')) |
| 179 copy_or_link(src_path('mojo/public/dart/core.dart'), | 181 copy_or_link(src_path('mojo/public/dart/core.dart'), |
| 180 sdk_path('packages/mojo/sdk_additions/dart_mojo_core.dart')) | 182 sdk_path('packages/mojo/sdk_additions/dart_mojo_core.dart')) |
| 181 | 183 |
| 182 if not skip_apks: | 184 if not skip_apks: |
| 183 ensure_dir_exists(sdk_path('packages/sky/apks')) | 185 ensure_dir_exists(sdk_path('packages/sky/apks')) |
| 184 shutil.copy(os.path.join(build_dir, 'apks', 'SkyDemo.apk'), | 186 shutil.copy(os.path.join(build_dir, 'apks', 'SkyDemo.apk'), |
| 185 sdk_path('packages/sky/apks')) | 187 sdk_path('packages/sky/apks')) |
| 186 | 188 |
| 187 if generate_licenses: | 189 if generate_licenses: |
| 188 with open(sdk_path('LICENSES.sky'), 'w') as license_file: | 190 with open(sdk_path('LICENSES.sky'), 'w') as license_file: |
| 189 subprocess.check_call([src_path('tools/licenses.py'), 'credits'], | 191 subprocess.check_call([src_path('tools/licenses.py'), 'credits'], |
| 190 stdout=license_file) | 192 stdout=license_file) |
| 191 | 193 |
| 192 copy_or_link(src_path('AUTHORS'), sdk_path('packages/mojo/AUTHORS')) | 194 copy_or_link(src_path('AUTHORS'), sdk_path('packages/mojo/AUTHORS')) |
| 193 copy_or_link(src_path('LICENSE'), sdk_path('packages/mojo/LICENSE')) | 195 copy_or_link(src_path('LICENSE'), sdk_path('packages/mojo/LICENSE')) |
| 194 copy_or_link(src_path('AUTHORS'), sdk_path('packages/sky/AUTHORS')) | 196 copy_or_link(src_path('AUTHORS'), sdk_path('packages/sky/AUTHORS')) |
| 195 copy_or_link(src_path('LICENSE'), sdk_path('packages/sky/LICENSE')) | 197 copy_or_link(src_path('LICENSE'), sdk_path('packages/sky/LICENSE')) |
| 196 | 198 |
| 197 if args.fake_pub_get_into: | 199 if args.fake_pub_get_into: |
| 198 packages_dir = os.path.abspath(args.fake_pub_get_into) | 200 packages_dir = os.path.abspath(args.fake_pub_get_into) |
| 199 ensure_dir_exists(packages_dir) | 201 ensure_dir_exists(packages_dir) |
| 202 make_relative_symlink(sdk_path('packages/keyboard/lib'), |
| 203 os.path.join(packages_dir, 'keyboard')) |
| 200 make_relative_symlink(sdk_path('packages/mojo/lib'), | 204 make_relative_symlink(sdk_path('packages/mojo/lib'), |
| 201 os.path.join(packages_dir, 'mojo')) | 205 os.path.join(packages_dir, 'mojo')) |
| 202 make_relative_symlink(sdk_path('packages/sky/lib'), | 206 make_relative_symlink(sdk_path('packages/sky/lib'), |
| 203 os.path.join(packages_dir, 'sky')) | 207 os.path.join(packages_dir, 'sky')) |
| 204 | 208 |
| 205 if should_commit: | 209 if should_commit: |
| 206 # Kinda a hack to make a prettier build dir for the commit: | 210 # Kinda a hack to make a prettier build dir for the commit: |
| 207 script_path = os.path.relpath(os.path.abspath(__file__), SRC_ROOT) | 211 script_path = os.path.relpath(os.path.abspath(__file__), SRC_ROOT) |
| 208 rel_build_dir = os.path.relpath(build_dir, SRC_ROOT) | 212 rel_build_dir = os.path.relpath(build_dir, SRC_ROOT) |
| 209 revision = git_revision() | 213 revision = git_revision() |
| 210 commit_url = "https://github.com/domokit/mojo/commit/%s" % revision | 214 commit_url = "https://github.com/domokit/mojo/commit/%s" % revision |
| 211 pattern = """Autogenerated from %s | 215 pattern = """Autogenerated from %s |
| 212 Using %s and build output from %s. | 216 Using %s and build output from %s. |
| 213 """ | 217 """ |
| 214 commit_message = pattern % (commit_url, script_path, rel_build_dir) | 218 commit_message = pattern % (commit_url, script_path, rel_build_dir) |
| 215 subprocess.check_call(['git', 'add', '.'], cwd=sdk_root) | 219 subprocess.check_call(['git', 'add', '.'], cwd=sdk_root) |
| 216 subprocess.check_call([ | 220 subprocess.check_call([ |
| 217 'git', 'commit', | 221 'git', 'commit', |
| 218 '-m', commit_message | 222 '-m', commit_message |
| 219 ], cwd=sdk_root) | 223 ], cwd=sdk_root) |
| 220 | 224 |
| 221 time_delta = datetime.now() - start_time | 225 time_delta = datetime.now() - start_time |
| 222 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds()) | 226 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds()) |
| 223 | 227 |
| 224 | 228 |
| 225 if __name__ == '__main__': | 229 if __name__ == '__main__': |
| 226 main() | 230 main() |
| OLD | NEW |