diff options
author | iancottrell@chromium.org <iancottrell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 19:38:05 +0000 |
---|---|---|
committer | iancottrell@chromium.org <iancottrell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-01 19:38:05 +0000 |
commit | 0e635cbc59db094462c0a6dce7a3abed73227d1a (patch) | |
tree | 675ddb51d9b04f193fd476a462976d9e1fe75fca /tools/cr | |
parent | 3af120aca0b88e24f45dfec0fdd509cf769be0df (diff) | |
download | chromium_src-0e635cbc59db094462c0a6dce7a3abed73227d1a.zip chromium_src-0e635cbc59db094462c0a6dce7a3abed73227d1a.tar.gz chromium_src-0e635cbc59db094462c0a6dce7a3abed73227d1a.tar.bz2 |
Prepare the environment before gclient sync so the gyp does the right thing
BUG=
Review URL: https://codereview.chromium.org/212603015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260927 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/cr')
-rw-r--r-- | tools/cr/cr/actions/gyp.py | 6 | ||||
-rw-r--r-- | tools/cr/cr/commands/prepare.py | 12 | ||||
-rw-r--r-- | tools/cr/cr/commands/sync.py | 1 |
3 files changed, 17 insertions, 2 deletions
diff --git a/tools/cr/cr/actions/gyp.py b/tools/cr/cr/actions/gyp.py index b761348..800453a 100644 --- a/tools/cr/cr/actions/gyp.py +++ b/tools/cr/cr/actions/gyp.py @@ -18,17 +18,19 @@ class GypPrepareOut(cr.PrepareOut): GYP_DEF_target_arch='{CR_ENVSETUP_ARCH}', ) - def Prepare(self): + def UpdateContext(self): # Collapse GYP_DEFINES from all GYP_DEF prefixes gyp_defines = cr.context.Find('GYP_DEFINES') or '' for key, value in cr.context.exported.items(): if key.startswith(GYP_DEFINE_PREFIX): gyp_defines += ' %s=%s' % (key[len(GYP_DEFINE_PREFIX):], value) cr.context['GYP_DEFINES'] = gyp_defines.strip() + if cr.context.verbose >= 1: + print cr.context.Substitute('GYP_DEFINES = {GYP_DEFINES}') + def Prepare(self): if cr.context.verbose >= 1: print cr.context.Substitute('Invoking gyp with {GYP_GENERATOR_FLAGS}') - print cr.context.Substitute('GYP_DEFINES = {GYP_DEFINES}') cr.Host.Execute( '{CR_SRC}/build/gyp_chromium', diff --git a/tools/cr/cr/commands/prepare.py b/tools/cr/cr/commands/prepare.py index a9418d9..ba3956a 100644 --- a/tools/cr/cr/commands/prepare.py +++ b/tools/cr/cr/commands/prepare.py @@ -30,7 +30,13 @@ class PrepareCommand(cr.Command): self.Prepare() @classmethod + def UpdateContext(cls): + for preparation in PrepareOut.Plugins(): + preparation.UpdateContext() + + @classmethod def Prepare(cls): + cls.UpdateContext() for preparation in PrepareOut.Plugins(): preparation.Prepare() @@ -41,6 +47,12 @@ class PrepareOut(cr.Plugin, cr.Plugin.Type): See PrepareCommand for details. """ + def UpdateContext(self): + """Update the context if needed. + + This is also used by commands that want the environment setup correctly, but + are not going to call Prepare directly (such as sync).""" + def Prepare(self): """All PrepareOut plugins must override this method to do their work.""" raise NotImplementedError('Must be overridden.') diff --git a/tools/cr/cr/commands/sync.py b/tools/cr/cr/commands/sync.py index c7e6e70..90f6abe 100644 --- a/tools/cr/cr/commands/sync.py +++ b/tools/cr/cr/commands/sync.py @@ -41,6 +41,7 @@ class SyncCommand(cr.Command): @staticmethod def Sync(args): + cr.PrepareCommand.UpdateContext() # TODO(iancottrell): we should probably run the python directly, # rather than the shell wrapper # TODO(iancottrell): try to help out when the local state is not a good |