Index: packages/usage/tool/grind.dart |
diff --git a/packages/usage/tool/grind.dart b/packages/usage/tool/grind.dart |
index f1d8121abe7a5b798bbb6bb6fff49d5b028c9880..f93261b41d895f34a32515a442e51c8adce8b20b 100644 |
--- a/packages/usage/tool/grind.dart |
+++ b/packages/usage/tool/grind.dart |
@@ -12,31 +12,24 @@ final Directory _buildExampleDir = new Directory('build/example'); |
main(List<String> args) => grind(args); |
-@Task('Do any necessary build set up') |
-void init() { |
- // Verify we're running in the project root. |
- if (!getDir('lib').existsSync() || !getFile('pubspec.yaml').existsSync()) { |
- context.fail('This script must be run from the project root.'); |
- } |
- |
- _buildExampleDir.createSync(recursive: true); |
-} |
+@Task() |
+void init() => _buildExampleDir.createSync(recursive: true); |
@Task() |
@Depends(init) |
void build() { |
// Compile `test/web_test.dart` to the `build/test` dir; measure its size. |
File srcFile = new File('example/example.dart'); |
- Dart2js.compile(srcFile, outDir: _buildExampleDir, minify: true); |
+ Dart2js.compile(srcFile, |
+ outDir: _buildExampleDir, |
+ minify: true, |
+ extraArgs: ['--conditional-directives']); |
File outFile = joinFile(_buildExampleDir, ['example.dart.js']); |
- context.log('${outFile.path} compiled to ${_printSize(outFile)}'); |
+ log('${outFile.path} compiled to ${_printSize(outFile)}'); |
} |
-@Task('Delete all generated artifacts') |
-void clean() { |
- // Delete the build/ dir. |
- delete(buildDir); |
-} |
+@Task() |
+void clean() => delete(buildDir); |
String _printSize(File file) => '${(file.lengthSync() + 1023) ~/ 1024}k'; |