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

Side by Side Diff: samples/build_dart_simple/build.dart

Issue 14259002: Fix dartc tests and pub after IOSink change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library build_dart_simple; 5 library build_dart_simple;
6 6
7 import "dart:io"; 7 import "dart:io";
8 8
9 /** 9 /**
10 * This minimal build script copies the contents of .foo files to .foobar files. 10 * This minimal build script copies the contents of .foo files to .foobar files.
11 * In order to be invoked automatically by the Editor, this script must be named 11 * In order to be invoked automatically by the Editor, this script must be named
12 * 'build.dart' and placed in the root of a project. 12 * 'build.dart' and placed in the root of a project.
13 */ 13 */
14 void main() { 14 void main() {
15 for (String arg in new Options().arguments) { 15 for (String arg in new Options().arguments) {
16 if (arg.startsWith("--changed=")) { 16 if (arg.startsWith("--changed=")) {
17 String file = arg.substring("--changed=".length); 17 String file = arg.substring("--changed=".length);
18 18
19 if (file.endsWith(".foo")) { 19 if (file.endsWith(".foo")) {
20 _processFile(file); 20 _processFile(file);
21 } 21 }
22 } 22 }
23 } 23 }
24 } 24 }
25 25
26 void _processFile(String file) { 26 void _processFile(String file) {
27 String contents = new File(file).readAsStringSync(); 27 String contents = new File(file).readAsStringSync();
28 28
29 if (contents != null) { 29 if (contents != null) {
30 IOSink<File> out = new File("${file}bar").openWrite(); 30 IOSink out = new File("${file}bar").openWrite();
31 out.write("// processed from ${file}:\n${contents}"); 31 out.write("// processed from ${file}:\n${contents}");
32 out.close(); 32 out.close();
33 } 33 }
34 } 34 }
OLDNEW
« no previous file with comments | « samples/build_dart/build.dart ('k') | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698