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

Unified Diff: dart/tools/only_in_release_mode.py

Issue 13784002: Only build apidoc in release mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
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
Index: dart/tools/only_in_release_mode.py
diff --git a/dart/tools/only_in_release_mode.py b/dart/tools/only_in_release_mode.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c7514d9a8fe3887b97050192325bbbb23742ccc
--- /dev/null
+++ b/dart/tools/only_in_release_mode.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+"""
+Wrapper around a build action that should only be executed in "release" mode.
+
+The following options are accepted:
+
+ --mode=[release,debug]
+
+ --outputs=files...
+
+If mode is not 'release', the script will create the files listed in
+outputs. If mode is release, the script will execute the remaining
+command line arguments as a command.
kustermann 2013/04/08 12:30:54 Would be nice if you can include an example here e
ahe 2013/04/08 12:42:46 Done.
+"""
+
+import optparse
+import subprocess
+import sys
+
+
+def BuildOptions():
+ result = optparse.OptionParser()
+ result.add_option('-m', '--mode')
+ result.add_option('-o', '--outputs')
+ return result
+
+
+def Main():
+ (options, arguments) = BuildOptions().parse_args()
+ if options.mode != 'release':
+ print >> sys.stderr, 'Not running %s in mode=%s' % (arguments,
+ options.mode)
+ for output in options.outputs.strip('"').split('" "'):
+ with open(output, 'w'):
kustermann 2013/04/08 12:30:54 Add a comment (or a print statement) saying that y
ahe 2013/04/08 12:42:46 Done.
+ pass
+ return 0
+ else:
+ try:
+ subprocess.check_call(arguments)
+ except subprocess.CalledProcessError as e:
+ return e.returncode
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(Main())
« no previous file with comments | « dart/tools/build.py ('k') | dart/utils/apidoc/apidoc.gyp » ('j') | dart/utils/apidoc/apidoc.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698