| OLD | NEW |
| 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; | 5 library build_dart; |
| 6 | 6 |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "package:args/args.dart"; | 8 import "package:args/args.dart"; |
| 9 | 9 |
| 10 bool cleanBuild; | 10 bool cleanBuild; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 void _processFile(String arg) { | 111 void _processFile(String arg) { |
| 112 if (arg.endsWith(".foo")) { | 112 if (arg.endsWith(".foo")) { |
| 113 print("processing: ${arg}"); | 113 print("processing: ${arg}"); |
| 114 | 114 |
| 115 File file = new File(arg); | 115 File file = new File(arg); |
| 116 | 116 |
| 117 String contents = file.readAsStringSync(); | 117 String contents = file.readAsStringSync(); |
| 118 | 118 |
| 119 File outFile = new File("${arg}bar"); | 119 File outFile = new File("${arg}bar"); |
| 120 | 120 |
| 121 IOSink<File> out = outFile.openWrite(); | 121 IOSink out = outFile.openWrite(); |
| 122 out.writeln("// processed from ${file.path}:"); | 122 out.writeln("// processed from ${file.path}:"); |
| 123 if (contents != null) { | 123 if (contents != null) { |
| 124 out.write(contents); | 124 out.write(contents); |
| 125 } | 125 } |
| 126 out.close(); | 126 out.close(); |
| 127 | 127 |
| 128 _findErrors(arg); | 128 _findErrors(arg); |
| 129 | 129 |
| 130 print("wrote: ${outFile.path}"); | 130 print("wrote: ${outFile.path}"); |
| 131 } | 131 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * If this file is a generated file (based on the extension), delete it. | 151 * If this file is a generated file (based on the extension), delete it. |
| 152 */ | 152 */ |
| 153 void _maybeClean(File file) { | 153 void _maybeClean(File file) { |
| 154 if (file.path.endsWith(".foobar")) { | 154 if (file.path.endsWith(".foobar")) { |
| 155 file.delete(); | 155 file.delete(); |
| 156 } | 156 } |
| 157 } | 157 } |
| OLD | NEW |