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

Unified Diff: tools/cr/cr/commands/prepare.py

Issue 83043003: [cr tool] Adding the prepare command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Quote change Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/commands/prepare.py
diff --git a/tools/cr/cr/commands/prepare.py b/tools/cr/cr/commands/prepare.py
new file mode 100644
index 0000000000000000000000000000000000000000..57abccef6bbf64be7cbe181710de8bde6f1a1035
--- /dev/null
+++ b/tools/cr/cr/commands/prepare.py
@@ -0,0 +1,48 @@
+# Copyright 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.
+
+"""A module for the prepare command."""
+
+import cr
+
+
+class PrepareCommand(cr.Command):
+ """The implementation of the prepare command.
+
+ The prepare command is used to perform the steps needed to get an output
+ directory ready to use. These should not be the kind of things that need to
+ happen every time you build something, but the rarer things that you re-do
+ only when you get or add new source files, or change your build options.
+ This delegates all it's behavior to implementations of PrepareOut. These will
+ (mostly) be in the cr.actions package.
+ """
+
+ def __init__(self):
+ super(PrepareCommand, self).__init__()
+ self.help = 'Prepares an output directory'
+ self.description = ("""
+ This does any preparation needed for the output directory, such as
+ running gyp.
+ """)
+
+ def Run(self, context):
+ self.Prepare(context)
+
+ @classmethod
+ def Prepare(cls, context):
+ for preparation in PrepareOut.Plugins():
+ preparation.Prepare(context)
+
+
+class PrepareOut(cr.Plugin, cr.Plugin.Type):
+ """Base class for output directory preparation plugins.
+
+ See PrepareCommand for details.
+ """
+
+ def Prepare(self, context):
+ """All PrepareOut plugins must override this method to do their work."""
+ _ = context
+ raise NotImplementedError('Must be overridden.')
+
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698