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

Unified Diff: dart/utils/compiler/build_helper.dart

Issue 9969209: Make dart2js executable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
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 | « no previous file | dart/utils/compiler/compiler.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/utils/compiler/build_helper.dart
diff --git a/dart/utils/compiler/build_helper.dart b/dart/utils/compiler/build_helper.dart
index 3ba94722b908c6e68da0fd3105e3f0d1d4fe07ce..b0116994e7f589bab402dc9081ec5c3b07d9e114 100644
--- a/dart/utils/compiler/build_helper.dart
+++ b/dart/utils/compiler/build_helper.dart
@@ -29,21 +29,37 @@ writeScript(Uri uri, List<String> chunks) {
}
stream.closeSync();
- // TODO(ahe): Make script executable.
// TODO(ahe): Also make a .bat file for Windows.
+
+ if (new Platform().operatingSystem() != 'windows') {
+ onExit(int exitCode, String stdout, String stderr) {
+ if (exitCode != 0) {
+ print(stdout);
+ print(stderr);
+ exit(exitCode);
+ }
+ }
+ new Process.run('/bin/chmod', ['+x', uri.path], null, onExit);
+ }
}
buildScript(Uri uri) {
+ String dart2jsPath =
+ uri.resolve('../../lib/compiler/implementation/dart2js.dart').path;
+ String libraryRoot = uri.resolve('../../').path;
return """
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
kasperl 2012/04/17 15:19:39 Would it make sense to throw this string into a to
ahe 2012/04/17 16:08:15 I'm using string interpolation. The best I can do
+// 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('dart:io');
-#import('${uri.resolve('../../lib/compiler/implementation/dart2js.dart').path}');
+#import('$dart2jsPath');
class Helper {
void run() {
try {
- List<String> argv = ['--library-root=${uri.resolve('../../').path}'];
+ List<String> argv = ['--library-root=$libraryRoot'];
argv.addAll(new Options().arguments);
compile(argv);
} catch (var exception, var trace) {
« no previous file with comments | « no previous file | dart/utils/compiler/compiler.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698