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

Side by Side Diff: tools/cr/cr/commands/prepare.py

Issue 1095613002: cr: Add support for GN build file generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 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 unified diff | Download patch
« tools/cr/cr/actions/gn.py ('K') | « tools/cr/cr/commands/init.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 """A module for the prepare command.""" 5 """A module for the prepare command."""
6 6
7 import cr 7 import cr
8 8
9 9
10 class PrepareCommand(cr.Command): 10 class PrepareCommand(cr.Command):
(...skipping 13 matching lines...) Expand all
24 self.description = (""" 24 self.description = ("""
25 This does any preparation needed for the output directory, such as 25 This does any preparation needed for the output directory, such as
26 running gyp. 26 running gyp.
27 """) 27 """)
28 28
29 def Run(self): 29 def Run(self):
30 self.Prepare() 30 self.Prepare()
31 31
32 @classmethod 32 @classmethod
33 def UpdateContext(cls): 33 def UpdateContext(cls):
34 for preparation in PrepareOut.Plugins(): 34 PrepareOut.GetActivePlugin().UpdateContext()
35 preparation.UpdateContext()
36 35
37 @classmethod 36 @classmethod
38 def Prepare(cls): 37 def Prepare(cls):
39 cls.UpdateContext() 38 cls.UpdateContext()
40 for preparation in PrepareOut.Plugins(): 39 PrepareOut.GetActivePlugin().Prepare()
41 preparation.Prepare()
42 40
43 41
44 class PrepareOut(cr.Plugin, cr.Plugin.Type): 42 class PrepareOut(cr.Plugin, cr.Plugin.Type):
45 """Base class for output directory preparation plugins. 43 """Base class for output directory preparation plugins.
46 44
47 See PrepareCommand for details. 45 See PrepareCommand for details.
48 """ 46 """
49 47
48 SELECTOR = 'CR_GENERATOR'
49
50 @classmethod
51 def AddArguments(cls, parser):
52 parser.add_argument(
53 '--generator', dest=cls.SELECTOR,
54 choices=cls.Choices(),
55 default=None,
56 help='Sets the build file generator to use. ' + \
petrcermak 2015/04/17 16:53:14 Again, I think it would be better to use brackets
Sami 2015/04/17 16:57:35 Done.
57 'Overrides %s.' % cls.SELECTOR
58 )
59
50 def UpdateContext(self): 60 def UpdateContext(self):
51 """Update the context if needed. 61 """Update the context if needed.
52 62
53 This is also used by commands that want the environment setup correctly, but 63 This is also used by commands that want the environment setup correctly, but
54 are not going to call Prepare directly (such as sync).""" 64 are not going to call Prepare directly (such as sync)."""
55 65
56 def Prepare(self): 66 def Prepare(self):
57 """All PrepareOut plugins must override this method to do their work.""" 67 """All PrepareOut plugins must override this method to do their work."""
58 raise NotImplementedError('Must be overridden.') 68 raise NotImplementedError('Must be overridden.')
59 69
OLDNEW
« tools/cr/cr/actions/gn.py ('K') | « tools/cr/cr/commands/init.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698