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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « packages/usage/tool/drone.sh ('k') | packages/usage/tool/travis.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 library usage.grind;
6
7 import 'dart:io';
8
9 import 'package:grinder/grinder.dart';
10
11 final Directory BUILD_DIR = new Directory('build');
12 final Directory BUILD_TEST_DIR = new Directory('build/test');
13
14 void main(List<String> args) {
15 task('init', init);
16 task('build', build, ['init']);
17 task('clean', clean);
18
19 startGrinder(args);
20 }
21
22 /// Do any necessary build set up.
23 void init(GrinderContext context) {
24 // Verify we're running in the project root.
25 if (!getDir('lib').existsSync() || !getFile('pubspec.yaml').existsSync()) {
26 context.fail('This script must be run from the project root.');
27 }
28
29 BUILD_TEST_DIR.createSync(recursive: true);
30 }
31
32 void build(GrinderContext context) {
33 // Compile `test/web_test.dart` to the `build/test` dir; measure its size.
34 File srcFile = new File('test/web_test.dart');
35 Dart2js.compile(context, srcFile, outDir: BUILD_TEST_DIR, minify: true);
36 File outFile = joinFile(BUILD_TEST_DIR, ['web_test.dart.js']);
37
38 context.log('${outFile.path} compiled to ${_printSize(outFile)}');
39 }
40
41 /// Delete all generated artifacts.
42 void clean(GrinderContext context) {
43 // Delete the build/ dir.
44 deleteEntity(BUILD_DIR, context);
45 }
46
47 String _printSize(File file) => '${(file.lengthSync() + 1023) ~/ 1024}k';
OLDNEW
« 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