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

Unified Diff: tools/clean_output_directory.py

Issue 10830302: Add python script for clobbering the output directory of a build on any platform given the mode and… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
« 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/clean_output_directory.py
===================================================================
--- tools/clean_output_directory.py (revision 0)
+++ tools/clean_output_directory.py (revision 0)
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2012, 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.
+#
+
+import optparse
+import shutil
+import sys
+import utils
+
+HOST_OS = utils.GuessOS()
+
+def BuildOptions():
+ result = optparse.OptionParser()
+ result.add_option("-m", "--mode",
+ help='Build variants (comma-separated).',
+ metavar='[all,debug,release]',
+ default='debug')
+ result.add_option("--arch",
+ help='Target architectures (comma-separated).',
+ metavar='[all,ia32,x64,simarm,arm]',
+ default=utils.GuessArchitecture())
+ return result
+
+def ProcessOptions(options):
ricow1 2012/08/14 09:27:41 This is verbatim copy of the ProcessOptions in the
+ if options.arch == 'all':
+ options.arch = 'ia32,x64'
+ if options.mode == 'all':
+ options.mode = 'release,debug'
+ options.mode = options.mode.split(',')
+ options.arch = options.arch.split(',')
+ for mode in options.mode:
+ if not mode in ['debug', 'release']:
+ print "Unknown mode %s" % mode
+ return False
+ for arch in options.arch:
+ if not arch in ['ia32', 'x64', 'simarm', 'arm']:
+ print "Unknown arch %s" % arch
+ return False
+ return True
+
+def Main():
+ parser = BuildOptions()
+ (options, args) = parser.parse_args()
+ if not ProcessOptions(options):
+ parser.print_help()
+ return 1
+
+ # Delete the output for the targets for each requested configuration.
+ for mode in options.mode:
+ for arch in options.arch:
+ build_root = utils.GetBuildRoot(HOST_OS, mode=mode, arch=arch)
+ print "Deleting %s" % (build_root)
+ shutil.rmtree(build_root, ignore_errors=True)
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(Main())
Property changes on: tools/clean_output_directory.py
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
« 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