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