| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'depot_tools/bot_update', | 8 'depot_tools/bot_update', |
| 9 'depot_tools/gclient', | 9 'depot_tools/gclient', |
| 10 'file', | 10 'file', |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 gn_cmd.extend(args) | 39 gn_cmd.extend(args) |
| 40 api.step('gn %s' % ' '.join(args), gn_cmd) | 40 api.step('gn %s' % ' '.join(args), gn_cmd) |
| 41 | 41 |
| 42 | 42 |
| 43 def AddFiles(api, pkg, relative_paths): | 43 def AddFiles(api, pkg, relative_paths): |
| 44 for path in relative_paths: | 44 for path in relative_paths: |
| 45 pkg.add_file(pkg.root.join(path), archive_name=api.path.basename(path)) | 45 pkg.add_file(pkg.root.join(path), archive_name=api.path.basename(path)) |
| 46 | 46 |
| 47 | 47 |
| 48 def UploadArtifacts(api, platform, file_paths, archive_name='artifacts.zip'): | 48 def UploadArtifacts(api, platform, file_paths, archive_name='artifacts.zip'): |
| 49 with MakeTempDir(api) as temp_dir: | 49 dir_label = '%s UploadArtifacts %s' % (platform, archive_name) |
| 50 with MakeTempDir(api, dir_label) as temp_dir: |
| 50 local_zip = temp_dir.join('artifacts.zip') | 51 local_zip = temp_dir.join('artifacts.zip') |
| 51 remote_name = '%s/%s' % (platform, archive_name) | 52 remote_name = '%s/%s' % (platform, archive_name) |
| 52 remote_zip = GetCloudPath(api, remote_name) | 53 remote_zip = GetCloudPath(api, remote_name) |
| 53 pkg = api.zip.make_package(api.path['checkout'], local_zip) | 54 pkg = api.zip.make_package(api.path['checkout'], local_zip) |
| 54 AddFiles(api, pkg, file_paths) | 55 AddFiles(api, pkg, file_paths) |
| 55 | 56 |
| 56 pkg.zip('Zip %s Artifacts' % platform) | 57 pkg.zip('Zip %s %s' % (platform, archive_name)) |
| 57 api.gsutil.upload(local_zip, BUCKET_NAME, remote_zip, | 58 api.gsutil.upload(local_zip, BUCKET_NAME, remote_zip, |
| 58 name='upload "%s"' % remote_name) | 59 name='upload "%s"' % remote_name) |
| 59 | 60 |
| 60 | 61 |
| 61 def UploadDartPackage(api, package_name): | 62 def UploadDartPackage(api, package_name): |
| 62 with MakeTempDir(api) as temp_dir: | 63 dir_label = 'UploadDartPackage %s' % package_name |
| 64 with MakeTempDir(api, dir_label) as temp_dir: |
| 63 local_zip = temp_dir.join('%s.zip' % package_name) | 65 local_zip = temp_dir.join('%s.zip' % package_name) |
| 64 remote_name = '%s.zip' % package_name | 66 remote_name = '%s.zip' % package_name |
| 65 remote_zip = GetCloudPath(api, remote_name) | 67 remote_zip = GetCloudPath(api, remote_name) |
| 66 parent_dir = api.path['checkout'].join( | 68 parent_dir = api.path['checkout'].join( |
| 67 'out/android_debug/dist/packages') | 69 'out/android_debug/dist/packages') |
| 68 pkg = api.zip.make_package(parent_dir, local_zip) | 70 pkg = api.zip.make_package(parent_dir, local_zip) |
| 69 pkg.add_directory(parent_dir.join(package_name)) | 71 pkg.add_directory(parent_dir.join(package_name)) |
| 70 pkg.zip('Zip %s Package' % package_name) | 72 pkg.zip('Zip %s Package' % package_name) |
| 71 api.gsutil.upload(local_zip, BUCKET_NAME, remote_zip, | 73 api.gsutil.upload(local_zip, BUCKET_NAME, remote_zip, |
| 72 name='upload %s' % remote_name) | 74 name='upload %s' % remote_name) |
| 73 | 75 |
| 74 | 76 |
| 75 # TODO(eseidel): Would be nice to have this on api.path or api.file. | 77 # TODO(eseidel): Would be nice to have this on api.path or api.file. |
| 76 @contextlib.contextmanager | 78 @contextlib.contextmanager |
| 77 def MakeTempDir(api): | 79 def MakeTempDir(api, label): |
| 78 try: | 80 try: |
| 79 temp_dir = api.path.mkdtemp('tmp') | 81 temp_dir = api.path.mkdtemp('tmp') |
| 80 yield temp_dir | 82 yield temp_dir |
| 81 finally: | 83 finally: |
| 82 api.file.rmtree('temp dir', temp_dir) | 84 api.file.rmtree('temp dir for %s' % label, temp_dir) |
| 83 | 85 |
| 84 | 86 |
| 85 def AnalyzeDartUI(api): | 87 def AnalyzeDartUI(api): |
| 86 RunGN(api, '--unoptimized') | 88 RunGN(api, '--unoptimized') |
| 87 Build(api, 'host_debug_unopt', 'generate_dart_ui') | 89 Build(api, 'host_debug_unopt', 'generate_dart_ui') |
| 88 | 90 |
| 89 checkout = api.path['checkout'] | 91 checkout = api.path['checkout'] |
| 90 api.step('analyze dart_ui', ['/bin/sh', 'travis/analyze.sh'], cwd=checkout) | 92 api.step('analyze dart_ui', ['/bin/sh', 'travis/analyze.sh'], cwd=checkout) |
| 91 | 93 |
| 92 | 94 |
| 93 def BuildLinuxAndroidx86(api): | 95 def BuildLinuxAndroidx86(api): |
| 94 for x86_variant, abi in [('x64', 'x86_64'), ('x86', 'x86')]: | 96 for x86_variant, abi in [('x64', 'x86_64'), ('x86', 'x86')]: |
| 95 RunGN(api, '--android', '--android-cpu=' + x86_variant) | 97 RunGN(api, '--android', '--android-cpu=' + x86_variant) |
| 96 out_dir = 'android_debug_' + x86_variant | 98 out_dir = 'android_debug_' + x86_variant |
| 97 Build(api, out_dir) | 99 Build(api, out_dir) |
| 98 UploadArtifacts(api, 'android-' + x86_variant, [ | 100 folder = 'android-' + x86_variant |
| 101 UploadArtifacts(api, folder, [ |
| 99 'build/android/ant/chromium-debug.keystore', | 102 'build/android/ant/chromium-debug.keystore', |
| 100 'out/%s/apks/SkyShell.apk' % out_dir, | 103 'out/%s/apks/SkyShell.apk' % out_dir, |
| 101 ('out/%s/gen/sky/shell/shell/shell/libs/%s/libsky_shell.so' % | 104 ('out/%s/gen/sky/shell/shell/shell/libs/%s/libsky_shell.so' % |
| 102 (out_dir, abi)), | 105 (out_dir, abi)), |
| 103 'out/%s/icudtl.dat' % out_dir, | 106 'out/%s/icudtl.dat' % out_dir, |
| 104 'out/%s/gen/sky/shell/shell/classes.dex.jar' % out_dir, | 107 'out/%s/gen/sky/shell/shell/classes.dex.jar' % out_dir, |
| 105 ]) | 108 ]) |
| 109 UploadArtifacts(api, folder, [ |
| 110 'out/%s/libsky_shell.so' % out_dir |
| 111 ], archive_name='symbols.zip') |
| 106 | 112 |
| 107 | 113 |
| 108 def AddPathPrefix(api, prefix, paths): | 114 def AddPathPrefix(api, prefix, paths): |
| 109 return map(lambda path: api.path.join(prefix, path), paths) | 115 return map(lambda path: api.path.join(prefix, path), paths) |
| 110 | 116 |
| 111 | 117 |
| 112 def BuildLinuxAndroidArm(api): | 118 def BuildLinuxAndroidArm(api): |
| 113 out_paths = [ | 119 out_paths = [ |
| 114 'apks/SkyShell.apk', | 120 'apks/SkyShell.apk', |
| 115 'flutter.jar', | 121 'flutter.jar', |
| 116 'flutter.mojo', | 122 'flutter.mojo', |
| 117 'gen/sky/shell/shell/shell/libs/armeabi-v7a/libsky_shell.so', | 123 'gen/sky/shell/shell/shell/libs/armeabi-v7a/libsky_shell.so', |
| 118 'icudtl.dat', | 124 'icudtl.dat', |
| 119 'gen/sky/shell/shell/classes.dex.jar', | 125 'gen/sky/shell/shell/classes.dex.jar', |
| 120 ] | 126 ] |
| 121 RunGN(api, '--android', '--enable-gcm') | 127 RunGN(api, '--android', '--enable-gcm') |
| 122 Build(api, 'android_debug', ':dist', 'gcm') | 128 Build(api, 'android_debug', ':dist', 'gcm') |
| 123 UploadArtifacts(api, 'android-arm', [ | 129 UploadArtifacts(api, 'android-arm', [ |
| 124 'build/android/ant/chromium-debug.keystore', | 130 'build/android/ant/chromium-debug.keystore', |
| 125 ] + AddPathPrefix(api, 'out/android_debug', out_paths)) | 131 ] + AddPathPrefix(api, 'out/android_debug', out_paths)) |
| 132 UploadArtifacts(api, 'android-arm', [ |
| 133 'out/android_debug/libsky_shell.so' |
| 134 ], archive_name='symbols.zip') |
| 126 | 135 |
| 127 # Build and upload engines for the runtime modes that use AOT compilation. | 136 # Build and upload engines for the runtime modes that use AOT compilation. |
| 128 for runtime_mode in ['profile', 'release']: | 137 for runtime_mode in ['profile', 'release']: |
| 129 build_output_dir = 'android_' + runtime_mode | 138 build_output_dir = 'android_' + runtime_mode |
| 130 upload_dir = 'android-arm-' + runtime_mode | 139 upload_dir = 'android-arm-' + runtime_mode |
| 131 | 140 |
| 132 RunGN(api, '--android', '--runtime-mode=' + runtime_mode) | 141 RunGN(api, '--android', '--runtime-mode=' + runtime_mode) |
| 133 Build(api, build_output_dir) | 142 Build(api, build_output_dir) |
| 134 | 143 |
| 135 UploadArtifacts(api, upload_dir, [ | 144 UploadArtifacts(api, upload_dir, [ |
| 136 'build/android/ant/chromium-debug.keystore', | 145 'build/android/ant/chromium-debug.keystore', |
| 137 'dart/runtime/bin/dart_io_entries.txt', | 146 'dart/runtime/bin/dart_io_entries.txt', |
| 138 'sky/engine/bindings/dart_vm_entry_points.txt', | 147 'sky/engine/bindings/dart_vm_entry_points.txt', |
| 139 'sky/engine/bindings/dart_vm_entry_points_android.txt', | 148 'sky/engine/bindings/dart_vm_entry_points_android.txt', |
| 140 ] + AddPathPrefix(api, 'out/%s' % build_output_dir, out_paths)) | 149 ] + AddPathPrefix(api, 'out/%s' % build_output_dir, out_paths)) |
| 141 | 150 |
| 142 # Upload artifacts used for AOT compilation on Linux hosts. | 151 # Upload artifacts used for AOT compilation on Linux hosts. |
| 143 UploadArtifacts(api, upload_dir, [ | 152 UploadArtifacts(api, upload_dir, [ |
| 144 'out/%s/clang_x86/gen_snapshot' % build_output_dir, | 153 'out/%s/clang_x86/gen_snapshot' % build_output_dir, |
| 145 ], archive_name='linux-x64.zip') | 154 ], archive_name='linux-x64.zip') |
| 155 UploadArtifacts(api, 'upload_dir', [ |
| 156 'out/%s/libsky_shell.so' % build_output_dir |
| 157 ], archive_name='symbols.zip') |
| 146 | 158 |
| 147 UploadDartPackage(api, 'sky_engine') | 159 UploadDartPackage(api, 'sky_engine') |
| 148 UploadDartPackage(api, 'sky_services') | 160 UploadDartPackage(api, 'sky_services') |
| 149 | 161 |
| 150 def UploadService(name, out_dir): | 162 def UploadService(name, out_dir): |
| 151 def Upload(from_path, to_path): | 163 def Upload(from_path, to_path): |
| 152 api.gsutil.upload(from_path, BUCKET_NAME, GetCloudPath(api, to_path), | 164 api.gsutil.upload(from_path, BUCKET_NAME, GetCloudPath(api, to_path), |
| 153 name='upload %s' % api.path.basename(to_path)) | 165 name='upload %s' % api.path.basename(to_path)) |
| 154 | 166 |
| 155 def ServicesOut(path): | 167 def ServicesOut(path): |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 BuildIOS(api) | 320 BuildIOS(api) |
| 309 | 321 |
| 310 | 322 |
| 311 def GenTests(api): | 323 def GenTests(api): |
| 312 # A valid commit to flutter/engine, to make the gsutil urls look real. | 324 # A valid commit to flutter/engine, to make the gsutil urls look real. |
| 313 for platform in ('mac', 'linux'): | 325 for platform in ('mac', 'linux'): |
| 314 yield (api.test(platform) + api.platform(platform, 64) | 326 yield (api.test(platform) + api.platform(platform, 64) |
| 315 + api.properties(mastername='client.flutter', | 327 + api.properties(mastername='client.flutter', |
| 316 buildername='%s Engine' % platform.capitalize(), | 328 buildername='%s Engine' % platform.capitalize(), |
| 317 slavename='fake-m1', clobber='')) | 329 slavename='fake-m1', clobber='')) |
| OLD | NEW |