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

Unified Diff: scripts/slave/recipe_modules/chromium_android/api.py

Issue 23431038: [chromium_android recipes] Cleanup envsetup step and cleanup step names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Address comments Created 7 years, 3 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
Index: scripts/slave/recipe_modules/chromium_android/api.py
diff --git a/scripts/slave/recipe_modules/chromium_android/api.py b/scripts/slave/recipe_modules/chromium_android/api.py
index 8166eb34c2386148cfb74d3d85dc59bbdcf74545..9291c35ddd5737159b9de0c7f974d673e7d867a8 100644
--- a/scripts/slave/recipe_modules/chromium_android/api.py
+++ b/scripts/slave/recipe_modules/chromium_android/api.py
@@ -7,6 +7,22 @@ from slave import recipe_api
class AndroidApi(recipe_api.RecipeApi):
def __init__(self, **kwargs):
super(AndroidApi, self).__init__(**kwargs)
+ self._env = dict()
+ self._build_internal_android = None
+ self._internal_dir = None
+
+ def get_env(self):
+ env_dict = dict(self._env)
+ for env_var, value in self.c.extra_env.iteritems():
+ if isinstance(value, list):
+ env_dict[env_var] = self.m.path.checkout(*value)
+ else:
+ env_dict[env_var] = value
+ # TODO(sivachandra): Use os.pathsep equivalent instead of ':' when it
+ # provided by one of the recipe modules.
+ env_dict['PATH'] = (self._build_internal_android + ':' +
+ self._env.get('PATH', ''))
+ return env_dict
def init_and_sync(self):
internal = self.m.properties['internal']
@@ -18,7 +34,7 @@ class AndroidApi(recipe_api.RecipeApi):
gclient_custom_deps = self.m.properties.get('gclient_custom_deps')
if internal:
- self.internal_dir = repo_name.split('/', 1)[-1]
+ self._internal_dir = repo_name.split('/', 1)[-1]
self.set_config(bot_id,
INTERNAL=internal,
@@ -49,18 +65,19 @@ class AndroidApi(recipe_api.RecipeApi):
self.m.path.add_checkout(manual_checkout_path)
self.m.path.choose_checkout(manual_checkout_path)
- self.build_internal_android = self.m.path.build_internal(
+ self._build_internal_android = self.m.path.build_internal(
'scripts', 'slave', 'android')
- for env_var, value in self.c.extra_env.items():
- if isinstance(value, list):
- self.c.extra_env[env_var] = self.m.path.checkout(*value)
+ gyp_defs = self.m.chromium.c.gyp_env.GYP_DEFINES
+ for gyp_def, val in gyp_defs.items():
+ if isinstance(val, list):
+ gyp_defs[gyp_def] = self.m.path.checkout(*val)
if internal:
yield self.m.step(
- 'Get AppManifestVars',
+ 'get app_manifest_vars',
[self.m.path.checkout(
- self.internal_dir, 'build', 'dump_app_manifest_vars.py'),
+ self._internal_dir, 'build', 'dump_app_manifest_vars.py'),
'-b', self.m.properties['buildername'],
'-v', self.m.path.checkout('chrome', 'VERSION'),
self.m.json.output()]
@@ -77,25 +94,16 @@ class AndroidApi(recipe_api.RecipeApi):
if self.c.target_arch:
envsetup_cmd += ['--target-arch=%s' % self.c.target_arch]
- init_env = {}
- if self.m.properties.get('internal'):
- init_env = {
- 'EXTRA_LANDMINES_SCRIPT': self.m.path.checkout(
- self.internal_dir, 'build', 'get_internal_landmines.py')
- }
- init_env.update(self.c.extra_env.as_jsonish())
-
- # TODO(sivachandra): make envsetup_cmd_to_json only output salient
- # differences in environment.
cmd = ([self.m.path.checkout('build', 'env_dump.py'),
self.m.json.output()] + envsetup_cmd)
- yield self.m.step('envsetup', cmd, env=init_env)
+ yield self.m.step('envsetup', cmd, env=self.get_env())
- self.env = self.m.step_history.last_step().json.output
- # TODO(sivachandra): Use os.pathsep equivalent instead of ':' when it
- # provided by one of the recipe modules.
- self.env['PATH'] += (self.build_internal_android + ':' +
- self.env.get('PATH'))
+ env_diff = self.m.step_history.last_step().json.output
+ for key, value in env_diff.iteritems():
+ if key.startswith('GYP_'):
+ continue
+ else:
+ self._env[key] = value
def clean_local_files(self):
target = self.m.properties.get('target', 'Debug')
@@ -123,37 +131,40 @@ class AndroidApi(recipe_api.RecipeApi):
repos.append(self.c.REPO_NAME)
# TODO(sivachandra): Disable subannottations after cleaning up
# tree_truth.sh.
- yield self.m.step('Tree Truth Steps',
+ yield self.m.step('tree truth steps',
[self.m.path.checkout('build', 'tree_truth.sh'),
self.m.path.checkout()] + repos,
allow_subannottations=True)
def runhooks(self):
- return self.m.gclient.runhooks(env=self.env)
+ run_hooks_env = self.get_env()
+ if self.m.properties.get('internal'):
+ run_hooks_env['EXTRA_LANDMINES_SCRIPT'] = self.m.path.checkout(
+ self._internal_dir, 'build', 'get_internal_landmines.py')
+ return self.m.chromium.runhooks(env=run_hooks_env)
def compile(self, target='Debug'):
- return self.m.chromium.compile(env=self.env)
+ return self.m.chromium.compile(env=self.get_env())
def findbugs(self):
cmd = [self.m.path.checkout('build', 'android', 'findbugs_diff.py')]
if self.c.INTERNAL:
cmd.extend(
['-b',
- self.m.path.checkout(self.internal_dir, 'bin', 'findbugs_filter'),
+ self.m.path.checkout(self._internal_dir, 'bin', 'findbugs_filter'),
'-o', 'com.google.android.apps.chrome.-,org.chromium.-'])
-
- return self.m.step('findbugs_internal', cmd, env=self.env)
+ return self.m.step('findbugs internal', cmd, env=self.get_env())
def checkdeps(self):
return self.m.step(
'checkdeps',
[self.m.path.checkout('tools', 'checkdeps', 'checkdeps.py'),
- '--root=%s' % self.internal_dir],
- env=self.env)
+ '--root=%s' % self._internal_dir],
+ env=self.get_env())
def lint(self):
if self.c.INTERNAL:
return self.m.step(
'lint',
- [self.m.path.checkout(self.internal_dir, 'bin', 'lint.py')],
- env=self.env)
+ [self.m.path.checkout(self._internal_dir, 'bin', 'lint.py')],
+ env=self.get_env())

Powered by Google App Engine
This is Rietveld 408576698