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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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
new file mode 100644
index 0000000000000000000000000000000000000000..da63dc2e34f4f7b274b7a8e56bf81f8629975ab4
--- /dev/null
+++ b/packages/usage/tool/grind.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library usage.grind;
+
+import 'dart:io';
+
+import 'package:grinder/grinder.dart';
+
+final Directory BUILD_DIR = new Directory('build');
+final Directory BUILD_TEST_DIR = new Directory('build/test');
+
+void main(List<String> args) {
+ task('init', init);
+ task('build', build, ['init']);
+ task('clean', clean);
+
+ startGrinder(args);
+}
+
+/// Do any necessary build set up.
+void init(GrinderContext context) {
+ // 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.');
+ }
+
+ BUILD_TEST_DIR.createSync(recursive: true);
+}
+
+void build(GrinderContext context) {
+ // Compile `test/web_test.dart` to the `build/test` dir; measure its size.
+ File srcFile = new File('test/web_test.dart');
+ Dart2js.compile(context, srcFile, outDir: BUILD_TEST_DIR, minify: true);
+ File outFile = joinFile(BUILD_TEST_DIR, ['web_test.dart.js']);
+
+ context.log('${outFile.path} compiled to ${_printSize(outFile)}');
+}
+
+/// Delete all generated artifacts.
+void clean(GrinderContext context) {
+ // Delete the build/ dir.
+ deleteEntity(BUILD_DIR, context);
+}
+
+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