Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: scripts/slave/recipes/android_webview_aosp.py

Issue 14602020: Add an AOSP builder recipe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« scripts/slave/recipe_util.py ('K') | « scripts/slave/recipe_util.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d4dc08636e0220c1ea994df50c3705f30026011d
--- /dev/null
+++ b/scripts/slave/recipes/android_webview_aosp.py
@@ -0,0 +1,252 @@
+# 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 readDepsFile(deps_file_path):
+ class FileImplStub(object):
+ def __init__(self, file_location):
+ pass
+
+ @staticmethod
+ def GetPath():
+ return ''
+
+ @staticmethod
+ def GetFilename():
+ return ''
+
+ @staticmethod
+ def GetRevision():
+ return None
+
+ def FromStub(__, _=None):
+ return ''
+
+ class VarImpl(object):
+ def __init__(self, custom_vars, local_scope):
+ self._custom_vars = custom_vars
+ self._local_scope = local_scope
+
+ def Lookup(self, var_name):
+ """Implements the Var syntax."""
+ if var_name in self._custom_vars:
+ return self._custom_vars[var_name]
+ elif var_name in self._local_scope.get("vars", {}):
+ return self._local_scope["vars"][var_name]
+ raise Exception("Var is not defined: %s" % var_name)
+
+ local_scope = {}
+ var = VarImpl({}, local_scope)
+ global_scope = {
+ 'File': FileImplStub,
+ 'From': FromStub,
+ 'Var': var.Lookup,
+ 'deps_os': {},
+ }
+ execfile(deps_file_path, global_scope, local_scope)
+ deps = local_scope.get('deps', {})
+ deps_os = local_scope.get('deps_os', {})
+ for os_specific_deps in deps_os.itervalues():
+ deps.update(os_specific_deps)
+ return deps.keys()
+
+def readWhitelistFile(whitelist_file_path):
+ whitelisted_deps = open(whitelist_file_path).readlines()
+ def ignore_filter(line):
+ return (not line.startswith('#') and line)
+ return filter(ignore_filter, map(str.strip, whitelisted_deps))
+
+def depsBlacklist(deps_file_path, whitelist_file_path):
+ all_deps = readDepsFile(deps_file_path)
+ whitelisted_deps = readWhitelistFile(whitelist_file_path)
+ deps_blacklist = set(all_deps).difference(set(whitelisted_deps))
+ return dict(map(lambda(x): (x, None), deps_blacklist))
+
+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'
+ android_slave_subfolder = 'android-src'
+ android_slave_build_path = api.slave_build_path(android_slave_subfolder)
+ android_slave_out_path = api.slave_build_path(android_slave_subfolder, 'out')
+ chromium_in_android_subpath = 'external/chromium_org'
+ chromium_in_android_path = api.slave_build_path(android_slave_subfolder,
+ chromium_in_android_subpath)
+
+ 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):
mkosiba (inactive) 2013/05/07 13:30:19 would like feedback on this. Is it OK to implement
+ def __init__(self):
+ pass
+
+ def __str__(self):
+ custom_deps = depsBlacklist(
+ api.slave_build_path('src', 'DEPS'),
+ api.slave_build_path('src2', 'android_webview', 'buildbot',
+ 'deps_whitelist'))
+ 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'),
+ android_slave_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 need
+ # to take care to init repo only once.
+ repo_init_once_step = []
+ if not os.path.exists(android_slave_build_path):
+ repo_init_once_step.append(
+ steps.step('mkdir android source root',
+ ['mkdir', android_slave_subfolder],
+ cwd=api.SLAVE_BUILD_ROOT))
+
+ if not os.path.exists(api.slave_build_path(android_slave_subfolder, '.repo')):
+ repo_init_once_step.append(
+ steps.step('repo init', [
+ api.depot_tools_path('repo'),
+ 'init',
+ '-u', android_repo_url,
+ '-b', android_repo_branch],
+ cwd=android_slave_build_path))
+
+ repo_sync_step = [
+ steps.step('repo sync',
+ [api.depot_tools_path('repo'), 'sync'] + android_repo_sync_flags,
+ cwd=android_slave_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'),
+ android_slave_build_path, chromium_in_android_subpath] +
+ local_manifest_ndk_pin_revision),
+ steps.step('repo re-sync', [api.depot_tools_path('repo'), 'sync', '-l'],
+ cwd=android_slave_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,
+ [api.depot_tools_path('repo'), 'sync', project],
+ cwd=android_slave_build_path))
+
+
+ remove_potentially_stale_android_chromium_org = []
+ if os.path.exists(chromium_in_android_path):
+ remove_potentially_stale_android_chromium_org = [
+ steps.step('remove potentially stale chromium_org',
+ ['rm', '-rf', 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'),
+ chromium_in_android_path]),
+ ]
+
+ gyp_webview_step = [
+ steps.step('gyp_webview', with_lunch_command + [
+ api.slave_build_path(
+ android_slave_subfolder, 'external', 'chromium_org',
+ 'android_webview', 'tools', 'gyp_webview')],
+ cwd=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', android_slave_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', android_slave_build_path,
+ '--target-output-dir', android_slave_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_once_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
+ ),
+ }
+
« scripts/slave/recipe_util.py ('K') | « scripts/slave/recipe_util.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698