Chromium Code Reviews| Index: scripts/slave/recipes/android_webview_aosp.py |
| diff --git a/scripts/slave/recipes/android_webview_aosp.py b/scripts/slave/recipes/android_webview_aosp.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..100da18ab4972732328b1e8f048b2d6e9187fe92 |
| --- /dev/null |
| +++ b/scripts/slave/recipes/android_webview_aosp.py |
| @@ -0,0 +1,218 @@ |
| +# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import os |
| + |
| +try: |
| + import json # pylint: disable=F0401 |
| +except ImportError: |
| + import simplejson as json |
| + |
| +def deps_blacklist(path_to_whitelist_script, path_to_deps_file): |
| + local_vars = {} |
| + execfile(path_to_whitelist_script, {'os': os}, local_vars) |
| + deps_whitelist = local_vars['DepsWhitelist']() |
| + return deps_whitelist.get_aosp_bot_deps_blacklist(path_to_deps_file) |
| + |
| +def GetFactoryProperties(api, factory_properties, build_properties): |
| + android_repo_url = factory_properties.get('android_repo_url') |
| + android_repo_sync_flags = factory_properties.get('android_repo_sync_flags', |
| + ['-j16', '-d', '-f']) |
| + android_repo_resync_projects = factory_properties.get( |
| + 'android_repo_resync_projects') |
| + android_repo_branch = factory_properties.get('android_repo_branch') |
| + android_ndk_pin_revision = factory_properties.get('android_ndk_pin_revision') |
| + |
| + android_lunch_flavor = 'full-eng' |
| + slave_android_root_name = 'android-src' |
| + slave_android_build_path = api.slave_build_path(slave_android_root_name) |
| + slave_android_out_path = api.slave_build_path(slave_android_root_name, 'out') |
| + chromium_in_android_subpath = 'external/chromium_org' |
| + slave_chromium_in_android_path = api.slave_build_path( |
| + slave_android_root_name, chromium_in_android_subpath) |
| + slave_repo_in_android_path = api.slave_build_path(slave_android_root_name, |
| + '.repo', 'repo', 'repo') |
| + slave_repo_copy_dir = api.slave_build_path('repo_copy') |
| + slave_repo_copy_path = api.slave_build_path('repo_copy', 'repo') |
| + |
| + steps = api.Steps(build_properties) |
| + steps.use_mirror = False |
| + |
| + # This depends on __str__ being run delayed (at the time the command is about |
| + # to be executred, not at the time the command stream is generated). |
| + # TODO: better way? |
| + class TrimmedDepsSpec(object): |
| + def __init__(self): |
| + pass |
| + |
| + def __str__(self): |
| + custom_deps = deps_blacklist( |
| + api.slave_build_path('src2', 'android_webview', 'buildbot', |
| + 'deps_whitelist.py'), |
| + api.slave_build_path('src', 'DEPS')) |
| + trimmed_spec = { |
| + 'solutions': [{ |
| + 'name' : 'src', |
| + 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), |
| + 'safesync_url': '', |
| + 'custom_deps': custom_deps, |
| + }], |
| + 'target_os': ['android'], |
| + } |
| + return json.dumps(trimmed_spec) |
| + |
| + with_lunch_command = [api.slave_build_path('src2', 'android_webview', |
| + 'buildbot', 'with_lunch'), |
| + slave_android_build_path, |
| + android_lunch_flavor] |
| + |
| + # For the android_webview AOSP build we want to only include whitelisted |
| + # DEPS. This is to detect the addition of unexpected new deps to the webview. |
| + spec = { |
| + 'solutions': [{ |
| + 'name' : 'src', |
| + 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), |
| + 'deps_file': '', |
| + 'safesync_url': '', |
| + }], |
| + 'target_os': ['android'], |
| + } |
| + |
| + sync_with_trimmed_deps_step = [ |
| + steps.step('sync with trimmed deps', |
| + [api.build_path('scripts', 'slave', 'annotated_checkout.py'), |
| + '--type', 'gclient', |
| + '--spec', TrimmedDepsSpec()]), |
| + ] |
| + |
| + # The version of repo checked into depot_tools doesn't support switching |
| + # between branches correctly due to |
| + # https://code.google.com/p/git-repo/issues/detail?id=46 which is why we use |
| + # the copy of repo from the Android tree. |
| + # The copy of repo from depot_tools is only used to bootstrap the Android |
| + # tree checkout. |
| + repo_init_step = [] |
| + |
| + repo_path = api.depot_tools_path('repo') |
| + if os.path.exists(slave_repo_in_android_path): |
| + repo_path = slave_repo_copy_path |
| + if not os.path.exists(slave_repo_copy_dir): |
| + repo_init_step.append( |
| + steps.step('mkdir repo copy dir', |
| + ['mkdir', '-p', slave_repo_copy_dir])) |
| + repo_init_step.append( |
| + steps.step('use repo from Android source tree', |
| + ['cp', slave_repo_in_android_path, |
| + slave_repo_copy_path])) |
| + |
| + if not os.path.exists(slave_android_build_path): |
| + repo_init_step.append( |
| + steps.step('mkdir android source root', |
| + ['mkdir', slave_android_root_name], |
| + cwd=api.SLAVE_BUILD_ROOT)) |
| + |
| + # repo init can interactively ask about some user details which is why we |
| + # echo the newlines and the 'y'. |
| + repo_init_step.append( |
| + steps.step('repo init', ['echo', '\n\ny\n'], pipes=[[ |
|
mkosiba (inactive)
2013/05/07 13:30:19
is this the best way to supply the repo init comma
|
| + repo_path, |
| + 'init', |
| + '-u', android_repo_url, |
| + '-b', android_repo_branch]], |
| + cwd=slave_android_build_path)) |
| + |
| + repo_sync_step = [ |
| + steps.step('repo sync', |
| + [repo_path, 'sync'] + android_repo_sync_flags, |
| + cwd=slave_android_build_path), |
| + ] |
| + |
| + local_manifest_ndk_pin_revision = [] |
| + if android_ndk_pin_revision: |
| + local_manifest_ndk_pin_revision = ['--ndk-revision', |
| + android_ndk_pin_revision] |
| + local_manifest_ndk_pin_revision = ['--ndk-revision', |
| + android_ndk_pin_revision] |
| + generate_local_manifest_step = [ |
| + steps.step('generate local manifest', [ |
| + api.slave_build_path( |
| + 'src2', 'android_webview', 'buildbot', |
| + 'generate_local_manifest.py'), |
| + slave_android_build_path, chromium_in_android_subpath] + |
| + local_manifest_ndk_pin_revision), |
| + steps.step('repo re-sync', [repo_path, 'sync', '-l'], |
| + cwd=slave_android_build_path), |
| + ] |
| + |
| + # If the repo sync flag override specifies a smart sync manifest, then this |
| + # makes it possible to sync specific projects past the smart sync manifest |
| + # to the most up-to-date version. |
| + android_repo_resync_projects_step = [] |
| + if android_repo_resync_projects: |
| + for project in android_repo_resync_projects: |
| + android_repo_resync_projects_step.append( |
| + steps.step('repo re-sync project ' + project, |
| + [repo_path, 'sync', project], |
| + cwd=slave_android_build_path)) |
| + |
| + |
| + remove_potentially_stale_android_chromium_org = [] |
| + if os.path.exists(slave_chromium_in_android_path): |
| + remove_potentially_stale_android_chromium_org = [ |
| + steps.step('remove potentially stale chromium_org', |
| + ['rm', '-rf', slave_chromium_in_android_path]), |
| + ] |
| + |
| + symlink_chromium_into_android_tree_step = [ |
| + steps.step('symlink chromium source into android tree', |
| + ['ln', '-s', api.slave_build_path('src'), |
| + slave_chromium_in_android_path]), |
| + ] |
| + |
| + gyp_webview_step = [ |
| + steps.step('gyp_webview', with_lunch_command + [ |
| + api.slave_build_path( |
| + slave_android_root_name, 'external', 'chromium_org', |
| + 'android_webview', 'tools', 'gyp_webview')], |
| + cwd=slave_chromium_in_android_path), |
| + ] |
| + |
| + # The Android.mk build system handles deps differently than the 'regular' |
| + # Chromium makefiles which can lead to targets not being rebuilt. |
| + # Fixing this is actually quite hard so we make this bot always clobber. |
| + clobber_step = [ |
| + steps.step('clobber', ['rm', '-rf', slave_android_out_path + '/*']), |
| + ] |
| + |
| + compile_compiler_option = [] |
| + if os.path.exists(api.build_path('goma')): |
| + compile_compiler_option = ['--compiler', 'goma', |
| + '--goma-dir', api.build_path('goma')] |
| + compile_step = [ |
| + steps.step('compile', with_lunch_command + |
| + [api.build_path('scripts', 'slave', 'compile.py'), |
| + 'libwebviewchromium', 'android_webview_java', |
| + '--build-dir', api.slave_build_path(), |
| + '--src-dir', slave_android_build_path, |
| + '--target-output-dir', slave_android_out_path, |
| + '--build-tool', 'make-android', |
| + '--verbose'] + compile_compiler_option, |
| + cwd=api.SLAVE_BUILD_ROOT), |
| + ] |
| + |
| + return { |
| + 'checkout': 'gclient', |
| + 'gclient_spec': spec, |
| + 'steps': ( |
| + sync_with_trimmed_deps_step + |
| + repo_init_step + |
| + repo_sync_step + generate_local_manifest_step + |
| + remove_potentially_stale_android_chromium_org + |
| + symlink_chromium_into_android_tree_step + |
| + gyp_webview_step + |
| + clobber_step + |
| + compile_step |
| + ), |
| + } |
| + |