@@ -33,6 +33,10 @@ expectFileContains(String path, List<Pattern> items) {
33
33
}
34
34
}
35
35
36
+ /// The pub cache inherited by grinder.
37
+ final String defaultPubCache =
38
+ Platform .environment['PUB_CACHE' ] ?? resolveTildePath ('~/.pub-cache' );
39
+
36
40
/// Run no more than the number of processors available in parallel.
37
41
final MultiFutureTracker testFutures = new MultiFutureTracker (
38
42
Platform .environment.containsKey ('TRAVIS' )
@@ -183,11 +187,11 @@ Future buildSdkDocs() async {
183
187
184
188
class WarningsCollection {
185
189
final String tempDir;
186
- final Map <String , int > _warningKeyCounts ;
190
+ final Map <String , int > warningKeyCounts ;
187
191
final String branch;
188
192
final String pubCachePath;
189
193
WarningsCollection (this .tempDir, this .pubCachePath, this .branch)
190
- : this ._warningKeyCounts = new Map () {}
194
+ : this .warningKeyCounts = new Map () {}
191
195
192
196
static const String kPubCachePathReplacement = '_xxxPubDirectoryxxx_' ;
193
197
static const String kTempDirReplacement = '_xxxTempDirectoryxxx_' ;
@@ -208,8 +212,8 @@ class WarningsCollection {
208
212
209
213
void add (String text) {
210
214
String key = _toKey (text);
211
- _warningKeyCounts .putIfAbsent (key, () => 0 );
212
- _warningKeyCounts [key]++ ;
215
+ warningKeyCounts .putIfAbsent (key, () => 0 );
216
+ warningKeyCounts [key]++ ;
213
217
}
214
218
215
219
/// Output formatter for comparing warnings. [this] is the original.
@@ -220,19 +224,19 @@ class WarningsCollection {
220
224
Set <String > onlyCurrent = new Set ();
221
225
Set <String > identical = new Set ();
222
226
Set <String > allKeys = new Set .from ([]
223
- ..addAll (_warningKeyCounts .keys)
224
- ..addAll (current._warningKeyCounts .keys));
227
+ ..addAll (warningKeyCounts .keys)
228
+ ..addAll (current.warningKeyCounts .keys));
225
229
226
230
for (String key in allKeys) {
227
- if (_warningKeyCounts .containsKey (key) &&
228
- ! current._warningKeyCounts .containsKey (key)) {
231
+ if (warningKeyCounts .containsKey (key) &&
232
+ ! current.warningKeyCounts .containsKey (key)) {
229
233
onlyOriginal.add (key);
230
- } else if (! _warningKeyCounts .containsKey (key) &&
231
- current._warningKeyCounts .containsKey (key)) {
234
+ } else if (! warningKeyCounts .containsKey (key) &&
235
+ current.warningKeyCounts .containsKey (key)) {
232
236
onlyCurrent.add (key);
233
- } else if (_warningKeyCounts .containsKey (key) &&
234
- current._warningKeyCounts .containsKey (key) &&
235
- _warningKeyCounts [key] != current._warningKeyCounts [key]) {
237
+ } else if (warningKeyCounts .containsKey (key) &&
238
+ current.warningKeyCounts .containsKey (key) &&
239
+ warningKeyCounts [key] != current.warningKeyCounts [key]) {
236
240
quantityChangedOuts.add (key);
237
241
} else {
238
242
identical.add (key);
@@ -253,7 +257,7 @@ class WarningsCollection {
253
257
printBuffer.writeln ('*** $title : Identical warning quantity changed' );
254
258
for (String key in quantityChangedOuts) {
255
259
printBuffer.writeln (
256
- "* Appeared ${_warningKeyCounts [key ]} times in $branch , ${current ._warningKeyCounts [key ]} in ${current .branch }:" );
260
+ "* Appeared ${warningKeyCounts [key ]} times in $branch , ${current .warningKeyCounts [key ]} in ${current .branch }:" );
257
261
printBuffer.writeln (current._fromKey (key));
258
262
}
259
263
}
@@ -813,26 +817,38 @@ Future serveDartdocFlutterPluginDocs() async {
813
817
pluginPackageDocsDir.path, 8005 , 'serve-dartdoc-flutter-plugin-docs' );
814
818
}
815
819
816
- @Task ('Build docs for a package that requires flutter with remote linking' )
817
- buildDartdocFlutterPluginDocs () async {
820
+ Future <WarningsCollection > _buildDartdocFlutterPluginDocs () async {
818
821
FlutterRepo flutterRepo = await FlutterRepo .fromExistingFlutterRepo (
819
822
await cleanFlutterRepo, 'docs-flutter-plugin' );
820
823
821
- await flutterRepo.launcher.runStreamed (
822
- Platform .resolvedExecutable,
823
- [
824
- '--checked' ,
825
- pathLib.join (Directory .current.path, 'bin' , 'dartdoc.dart' ),
826
- '--link-to-remote' ,
827
- '--output' ,
828
- pluginPackageDocsDir.path
829
- ],
830
- workingDirectory: pluginPackage.path);
824
+ return jsonMessageIterableToWarnings (
825
+ await flutterRepo.launcher.runStreamed (
826
+ Platform .resolvedExecutable,
827
+ [
828
+ '--checked' ,
829
+ pathLib.join (Directory .current.path, 'bin' , 'dartdoc.dart' ),
830
+ '--json' ,
831
+ '--link-to-remote' ,
832
+ '--output' ,
833
+ pluginPackageDocsDir.path
834
+ ],
835
+ workingDirectory: pluginPackage.path),
836
+ pluginPackageDocsDir.path,
837
+ defaultPubCache,
838
+ 'HEAD' );
839
+ }
840
+
841
+ @Task ('Build docs for a package that requires flutter with remote linking' )
842
+ buildDartdocFlutterPluginDocs () async {
843
+ await _buildDartdocFlutterPluginDocs ();
831
844
}
832
845
833
846
@Task ('Verify docs for a package that requires flutter with remote linking' )
834
- @Depends (buildDartdocFlutterPluginDocs)
835
847
testDartdocFlutterPlugin () async {
848
+ WarningsCollection warnings = await _buildDartdocFlutterPluginDocs ();
849
+ if (! warnings.warningKeyCounts.isEmpty) {
850
+ fail ('No warnings should exist in : ${warnings .warningKeyCounts }' );
851
+ }
836
852
// Verify that links to Dart SDK and Flutter SDK go to the flutter site.
837
853
expectFileContains (
838
854
pathLib.join (
0 commit comments