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

Side by Side Diff: packages/usage/tool/grind.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library usage.grind; 5 library usage.grind;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:grinder/grinder.dart'; 9 import 'package:grinder/grinder.dart';
10 10
11 final Directory _buildExampleDir = new Directory('build/example'); 11 final Directory _buildExampleDir = new Directory('build/example');
12 12
13 main(List<String> args) => grind(args); 13 main(List<String> args) => grind(args);
14 14
15 @Task() 15 @Task('Do any necessary build set up')
16 void init() => _buildExampleDir.createSync(recursive: true); 16 void init() {
17 // Verify we're running in the project root.
18 if (!getDir('lib').existsSync() || !getFile('pubspec.yaml').existsSync()) {
19 context.fail('This script must be run from the project root.');
20 }
21
22 _buildExampleDir.createSync(recursive: true);
23 }
17 24
18 @Task() 25 @Task()
19 @Depends(init) 26 @Depends(init)
20 void build() { 27 void build() {
21 // Compile `test/web_test.dart` to the `build/test` dir; measure its size. 28 // Compile `test/web_test.dart` to the `build/test` dir; measure its size.
22 File srcFile = new File('example/example.dart'); 29 File srcFile = new File('example/example.dart');
23 Dart2js.compile(srcFile, 30 Dart2js.compile(srcFile, outDir: _buildExampleDir, minify: true);
24 outDir: _buildExampleDir,
25 minify: true,
26 extraArgs: ['--conditional-directives']);
27 File outFile = joinFile(_buildExampleDir, ['example.dart.js']); 31 File outFile = joinFile(_buildExampleDir, ['example.dart.js']);
28 32
29 log('${outFile.path} compiled to ${_printSize(outFile)}'); 33 context.log('${outFile.path} compiled to ${_printSize(outFile)}');
30 } 34 }
31 35
32 @Task() 36 @Task('Delete all generated artifacts')
33 void clean() => delete(buildDir); 37 void clean() {
38 // Delete the build/ dir.
39 delete(buildDir);
40 }
34 41
35 String _printSize(File file) => '${(file.lengthSync() + 1023) ~/ 1024}k'; 42 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