@@ -24,8 +24,7 @@ main([List<String> args]) => grind(args);
24
24
findTransformers () async {
25
25
var dotPackages = new File ('.packages' );
26
26
if (! dotPackages.existsSync ()) {
27
- print ('No .packages file found in ${Directory .current }' );
28
- exit (1 );
27
+ fail ('No .packages file found in ${Directory .current }' );
29
28
}
30
29
31
30
var foundAnyTransformers = false ;
@@ -39,16 +38,16 @@ findTransformers() async {
39
38
if (pubspec.existsSync ()) {
40
39
var yamlDoc = yaml.loadYaml (pubspec.readAsStringSync ());
41
40
if (yamlDoc['transformers' ] != null ) {
42
- print ('${mapping .first } has transformers!' );
41
+ log ('${mapping .first } has transformers!' );
43
42
foundAnyTransformers = true ;
44
43
}
45
44
} else {
46
- print ('No pubspec found for ${mapping .first }, tried ${pubspec }' );
45
+ log ('No pubspec found for ${mapping .first }, tried ${pubspec }' );
47
46
}
48
47
});
49
48
50
49
if (! foundAnyTransformers) {
51
- print ('No transformers found' );
50
+ log ('No transformers found' );
52
51
}
53
52
}
54
53
@@ -76,20 +75,15 @@ checkVersionMatches() async {
76
75
77
76
@Task ('Checks that CHANGELOG mentions current version' )
78
77
checkChangelogHasVersion () async {
79
- // TODO: use fail() when
80
- // https://github.com/google/grinder.dart/issues/288 lands
81
-
82
78
var changelog = new File ('CHANGELOG.md' );
83
79
if (! changelog.existsSync ()) {
84
- print ('ERROR: No CHANGELOG.md found in ${Directory .current }' );
85
- exit (1 );
80
+ fail ('ERROR: No CHANGELOG.md found in ${Directory .current }' );
86
81
}
87
82
88
83
Pubspec pubspec = await Pubspec .load ();
89
84
90
85
if (! changelog.readAsLinesSync ().contains ('## ${pubspec .version }' )) {
91
- print ('ERROR: CHANGELOG.md does not mention version ${pubspec .version }' );
92
- exit (1 );
86
+ fail ('ERROR: CHANGELOG.md does not mention version ${pubspec .version }' );
93
87
}
94
88
}
95
89
@@ -164,7 +158,6 @@ Future buildSdkDocs() async {
164
158
// if I run grind build-sdk-docs manually.
165
159
// See https://github.com/google/grinder.dart/issues/291
166
160
validateSdkDocs () {
167
- // TODO(keertip): change number to 17 once 1.13 is stable
168
161
const expectedLibCount = 18 ;
169
162
var indexHtml = joinFile (docsDir, ['index.html' ]);
170
163
if (! indexHtml.existsSync ()) {
@@ -258,12 +251,11 @@ _doCheck(String origin, Set<String> visited, String pathToCheck, bool error,
258
251
var fullPath = path.normalize ("$origin $pathToCheck " );
259
252
if (visited.contains (fullPath)) return ;
260
253
visited.add (fullPath);
261
- //print("Visiting $fullPath");
262
254
263
255
File file = new File ("$fullPath " );
264
256
if (! file.existsSync ()) {
265
257
error = true ;
266
- print (' * Not found: $fullPath from $source ' );
258
+ log (' * Not found: $fullPath from $source ' );
267
259
return ;
268
260
}
269
261
Document doc = parse (file.readAsStringSync ());
@@ -272,17 +264,14 @@ _doCheck(String origin, Set<String> visited, String pathToCheck, bool error,
272
264
if (base != null ) {
273
265
baseHref = base .attributes['href' ];
274
266
}
275
- //print(" Base is $baseHref");
276
267
List <Element > links = doc.querySelectorAll ('a' );
277
268
links
278
269
.map ((link) => link.attributes['href' ])
279
270
.where ((href) => href != null )
280
271
.forEach ((href) {
281
272
if (! href.startsWith ('http' ) && ! href.contains ('#' )) {
282
- //print(" Found link: $href");
283
273
var full = '${path .dirname (pathToCheck )}/$baseHref /$href ' ;
284
274
var normalized = path.normalize (full);
285
- //print(" => $full\n => $normalized");
286
275
_doCheck (origin, visited, normalized, error, pathToCheck);
287
276
}
288
277
});
@@ -303,13 +292,7 @@ checkSdkLinks() {
303
292
@Task ('update test_package_docs' )
304
293
updateTestPackageDocs () {
305
294
var options = new RunOptions (workingDirectory: 'testing/test_package' );
306
-
307
- var dir = new Directory ('test_package_docs' );
308
-
309
- if (dir.existsSync ()) {
310
- dir.deleteSync (recursive: true );
311
- }
312
-
295
+ delete (getDir ('test_package_docs' ));
313
296
Dart .run ('../../bin/dartdoc.dart' ,
314
297
arguments: ['--no-include-source' , '--output' , '../test_package_docs' ],
315
298
runOptions: options);
0 commit comments