| OLD | NEW |
| 1 import "dart:io"; | 1 import "dart:io"; |
| 2 | 2 |
| 3 /** | 3 /** |
| 4 * This build script watches for changes to any .dart files and copies the root | 4 * This build script watches for changes to any .dart files and copies the root |
| 5 * packages directory to the app/packages directory. This works around an issue | 5 * packages directory to the app/packages directory. This works around an issue |
| 6 * with Chrome apps and symlinks and allows you to use pub with Chrome apps. | 6 * with Chrome apps and symlinks and allows you to use pub with Chrome apps. |
| 7 */ | 7 */ |
| 8 void main() { | 8 void main(List<String> args) { |
| 9 List<String> args = new Options().arguments; | |
| 10 | |
| 11 bool fullBuild = args.contains("--full"); | 9 bool fullBuild = args.contains("--full"); |
| 12 bool dartFilesChanged = args.any((arg) { | 10 bool dartFilesChanged = args.any((arg) { |
| 13 return !arg.startsWith("--changed=app/packages") && arg.endsWith(".dart"); | 11 return !arg.startsWith("--changed=app/packages") && arg.endsWith(".dart"); |
| 14 }); | 12 }); |
| 15 | 13 |
| 16 if (fullBuild || dartFilesChanged || args.isEmpty) { | 14 if (fullBuild || dartFilesChanged || args.isEmpty) { |
| 17 copyDirectory(new Uri.file('packages/'), new Uri.file('app/packages/')); | 15 copyDirectory(new Uri.file('packages/'), new Uri.file('app/packages/')); |
| 18 } | 16 } |
| 19 } | 17 } |
| 20 | 18 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 File srcFile = new File(src.toFilePath()); | 34 File srcFile = new File(src.toFilePath()); |
| 37 File destFile = new File(dest.resolve(src.pathSegments.last).toFilePath()); | 35 File destFile = new File(dest.resolve(src.pathSegments.last).toFilePath()); |
| 38 | 36 |
| 39 if (!destFile.existsSync() || | 37 if (!destFile.existsSync() || |
| 40 srcFile.lastModifiedSync() != destFile.lastModifiedSync()) { | 38 srcFile.lastModifiedSync() != destFile.lastModifiedSync()) { |
| 41 new Directory(dest.toFilePath()).createSync(recursive: true); | 39 new Directory(dest.toFilePath()).createSync(recursive: true); |
| 42 | 40 |
| 43 destFile.writeAsBytesSync(srcFile.readAsBytesSync()); | 41 destFile.writeAsBytesSync(srcFile.readAsBytesSync()); |
| 44 } | 42 } |
| 45 } | 43 } |
| OLD | NEW |