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

Unified Diff: compiler/scripts/dartc_build_wrapper.py

Issue 10091038: Revert "Renamed the 'dartc' launch script to 'dart_analyzer' and adds it to dart-sdk" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « compiler/scripts/dartc.sh ('k') | compiler/scripts/dartc_metrics.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/scripts/dartc_build_wrapper.py
diff --git a/compiler/scripts/dartc_build_wrapper.py b/compiler/scripts/dartc_build_wrapper.py
new file mode 100644
index 0000000000000000000000000000000000000000..e2be328ad006d1bf2aa72278362d833d09ced634
--- /dev/null
+++ b/compiler/scripts/dartc_build_wrapper.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# Copyright (c) 2011, 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 dartc for use from GYP."""
+
+import optparse
+import os
+from os import path
+import shutil
+import subprocess
+import sys
+
+
+def _BuildOptions():
+ op = optparse.OptionParser(usage='usage: %prog [options] FILE')
+ op.add_option('--out')
+ op.add_option('--dartc')
+ op.add_option('--dartc-option', action='append', dest='dartc_options',
+ default=[])
+ op.add_option('--incremental', action='store_false',
+ default=os.getenv('DARTC_INCREMENTAL', default=False))
+ return op
+
+
+def _ParseOptions(cmd_line):
+ op = _BuildOptions()
+ (options, args) = op.parse_args(args=cmd_line)
+ if not options.out:
+ op.error('Flag "--out" not provided')
+ if not options.dartc:
+ op.error('Flag "--dartc" not provided')
+ return (options, args)
+
+
+def main():
+ (options, args) = _ParseOptions(sys.argv[1:])
+ if path.exists(options.out):
+ is_out_of_date = path.getmtime(options.dartc) > path.getmtime(options.out)
+ if is_out_of_date or not options.incremental:
+ print 'Deleting %r.' % options.out
+ shutil.rmtree(options.out)
+ command_array = [options.dartc]
+ command_array.extend(['-out', options.out])
+ command_array.extend(options.dartc_options)
+ command_array.extend(args)
+ print ' '.join([repr(a) for a in command_array])
+ proc = subprocess.Popen(command_array)
+ proc.communicate()
+ sys.exit(proc.wait())
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « compiler/scripts/dartc.sh ('k') | compiler/scripts/dartc_metrics.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698