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

Unified Diff: packages/usage/tool/grind.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/usage/tool/drone.sh ('k') | packages/usage/tool/travis.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/usage/tool/grind.dart
diff --git a/packages/usage/tool/grind.dart b/packages/usage/tool/grind.dart
index f93261b41d895f34a32515a442e51c8adce8b20b..f1d8121abe7a5b798bbb6bb6fff49d5b028c9880 100644
--- a/packages/usage/tool/grind.dart
+++ b/packages/usage/tool/grind.dart
@@ -12,24 +12,31 @@ final Directory _buildExampleDir = new Directory('build/example');
main(List<String> args) => grind(args);
-@Task()
-void init() => _buildExampleDir.createSync(recursive: true);
+@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()
@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,
- extraArgs: ['--conditional-directives']);
+ Dart2js.compile(srcFile, outDir: _buildExampleDir, minify: true);
File outFile = joinFile(_buildExampleDir, ['example.dart.js']);
- log('${outFile.path} compiled to ${_printSize(outFile)}');
+ context.log('${outFile.path} compiled to ${_printSize(outFile)}');
}
-@Task()
-void clean() => delete(buildDir);
+@Task('Delete all generated artifacts')
+void clean() {
+ // Delete the build/ dir.
+ delete(buildDir);
+}
String _printSize(File file) => '${(file.lengthSync() + 1023) ~/ 1024}k';
« no previous file with comments | « packages/usage/tool/drone.sh ('k') | packages/usage/tool/travis.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698