| 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 /** | 5 /** |
| 6 * Common logic to make it easy to create a `build.dart` for your project. | 6 * Common logic to make it easy to create a `build.dart` for your project. |
| 7 * | 7 * |
| 8 * The `build.dart` script is invoked automatically by the Editor whenever a | 8 * The `build.dart` script is invoked automatically by the Editor whenever a |
| 9 * file in the project changes. It must be placed in the root of a project | 9 * file in the project changes. It must be placed in the root of a project |
| 10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'. | 10 * (where pubspec.yaml lives) and should be named exactly 'build.dart'. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 tasks.add(lastTask); | 104 tasks.add(lastTask); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 return tasks.future.then((r) => r.where((v) => v != null)); | 107 return tasks.future.then((r) => r.where((v) => v != null)); |
| 108 }, printTime: printTime, useColors: useColors); | 108 }, printTime: printTime, useColors: useColors); |
| 109 } | 109 } |
| 110 | 110 |
| 111 String _outDir(String file) => path.join(path.dirname(file), 'out'); | 111 String _outDir(String file) => path.join(path.dirname(file), 'out'); |
| 112 | 112 |
| 113 /** Tell whether [filePath] is a generated file. */ | 113 /** Tell whether [filePath] is a generated file. */ |
| 114 bool _isGeneratedFile(String filePath, List<Directory> outputOnlyDirs) { | 114 bool _isGeneratedFile(String filePath, List<String> outputOnlyDirs) { |
| 115 var dirPrefix = path.dirname(filePath); | 115 var dirPrefix = path.dirname(filePath); |
| 116 for (var outDir in outputOnlyDirs) { | 116 for (var outDir in outputOnlyDirs) { |
| 117 if (dirPrefix.startsWith(outDir)) return true; | 117 if (dirPrefix.startsWith(outDir)) return true; |
| 118 } | 118 } |
| 119 return path.basename(filePath).startsWith('_'); | 119 return path.basename(filePath).startsWith('_'); |
| 120 } | 120 } |
| 121 | 121 |
| 122 /** Tell whether [filePath] is an input file. */ | 122 /** Tell whether [filePath] is an input file. */ |
| 123 bool _isInputFile(String filePath, List<String> outputOnlyDirs) { | 123 bool _isInputFile(String filePath, List<String> outputOnlyDirs) { |
| 124 var ext = path.extension(filePath); | 124 var ext = path.extension(filePath); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (args["help"]) { | 157 if (args["help"]) { |
| 158 print('A build script that invokes the web-ui compiler (dwc).'); | 158 print('A build script that invokes the web-ui compiler (dwc).'); |
| 159 print('Usage: dart build.dart [options] [-- [dwc-options]]'); | 159 print('Usage: dart build.dart [options] [-- [dwc-options]]'); |
| 160 print('\nThese are valid options expected by build.dart:'); | 160 print('\nThese are valid options expected by build.dart:'); |
| 161 print(parser.getUsage()); | 161 print(parser.getUsage()); |
| 162 print('\nThese are valid options expected by dwc:'); | 162 print('\nThese are valid options expected by dwc:'); |
| 163 dwc.run(['-h']).then((_) => exit(0)); | 163 dwc.run(['-h']).then((_) => exit(0)); |
| 164 } | 164 } |
| 165 return args; | 165 return args; |
| 166 } | 166 } |
| OLD | NEW |