@@ -13,51 +13,6 @@ import 'task.dart' as task;
13
13
14
14
void main (List <String > args) => grind (args);
15
15
16
- /// Enable the following experiments for language tests.
17
- final List <String > languageExperiments =
18
- (Platform .environment['LANGUAGE_EXPERIMENTS' ] ?? '' ).split (RegExp (r'\s+' ));
19
-
20
- // Directory.systemTemp is not a constant. So wrap it.
21
- Directory createTempSync (String prefix) =>
22
- Directory .systemTemp.createTempSync (prefix);
23
-
24
- Directory get testPackageFlutterPlugin => Directory (
25
- p.joinAll (['testing' , 'flutter_packages' , 'test_package_flutter_plugin' ]));
26
-
27
- final Directory _testPackageDocsDir = createTempSync ('test_package' );
28
-
29
- final Directory _testPackageExperimentsDocsDir =
30
- createTempSync ('test_package_experiments' );
31
-
32
- final _whitespacePattern = RegExp (r'\s+' );
33
-
34
- final List <String > _extraDartdocParameters = [
35
- ...? Platform .environment['DARTDOC_PARAMS' ]? .split (_whitespacePattern),
36
- ];
37
-
38
- final Directory flutterDirDevTools =
39
- Directory (p.join (task.flutterDir.path, 'dev' , 'tools' ));
40
-
41
- @Task ('Run quick presubmit checks.' )
42
- void presubmit () async {
43
- await task.analyzeTestPackages ();
44
- await task.analyzePackage ();
45
- await task.validateFormat ();
46
- await task.validateBuild ();
47
- await task.runTryPublish ();
48
- await task.runTest ();
49
- }
50
-
51
- @Task ('Run tests, self-test dartdoc, and run the publish test' )
52
- @Depends (presubmit)
53
- Future <void > buildbot () async {
54
- await task.runTest ();
55
- await task.validateDartdocDocs ();
56
- }
57
-
58
- @Task ('Generate docs for the Dart SDK' )
59
- Future <void > buildSdkDocs () async => await task.docSdk ();
60
-
61
16
/// Creates a clean version of dartdoc (based on the current directory, assumed
62
17
/// to be a git repository), configured to use packages from the Dart SDK.
63
18
///
@@ -127,129 +82,10 @@ Future<void> testWithAnalyzerSdk() async {
127
82
}
128
83
}
129
84
130
- Future <Iterable <Map <String , Object ?>>> _buildTestPackageDocs (
131
- String outputDir, String cwd,
132
- {List <String > params = const [],
133
- String label = '' ,
134
- String ? testPackagePath}) async {
135
- if (label != '' ) label = '-$label ' ;
136
- testPackagePath ?? = task.testPackage.absolute.path;
137
- var launcher = SubprocessLauncher ('build-test-package-docs$label ' );
138
- var testPackagePubGet = launcher.runStreamed (
139
- Platform .resolvedExecutable, ['pub' , 'get' ],
140
- workingDirectory: testPackagePath);
141
- var dartdocPubGet = launcher.runStreamed (
142
- Platform .resolvedExecutable, ['pub' , 'get' ],
143
- workingDirectory: cwd);
144
- await Future .wait ([testPackagePubGet, dartdocPubGet]);
145
- return await launcher.runStreamed (
146
- Platform .resolvedExecutable,
147
- [
148
- '--enable-asserts' ,
149
- p.join (cwd, 'bin' , 'dartdoc.dart' ),
150
- '--output' ,
151
- outputDir,
152
- '--example-path-prefix' ,
153
- 'examples' ,
154
- '--include-source' ,
155
- '--json' ,
156
- '--link-to-remote' ,
157
- '--pretty-index-json' ,
158
- ...params,
159
- ..._extraDartdocParameters,
160
- ],
161
- workingDirectory: testPackagePath);
162
- }
163
-
164
- @Task ('Build generated test package docs from the experiment test package' )
165
- @Depends (clean)
166
- Future <void > buildTestExperimentsPackageDocs () async {
167
- await _buildTestPackageDocs (
168
- _testPackageExperimentsDocsDir.absolute.path, Directory .current.path,
169
- testPackagePath: task.testPackageExperiments.absolute.path,
170
- params: [
171
- '--enable-experiment' ,
172
- 'non-nullable,generic-metadata' ,
173
- '--no-link-to-remote'
174
- ]);
175
- }
176
-
177
- @Task ('Serve experimental test package on port 8003.' )
178
- @Depends (buildTestExperimentsPackageDocs)
179
- Future <void > serveTestExperimentsPackageDocs () async =>
180
- await task.servePackageDocs (
181
- name: Platform .environment['PACKAGE_NAME' ]! ,
182
- version: Platform .environment['PACKAGE_VERSION' ],
183
- );
184
-
185
- @Task ('Build test package docs (HTML) with inherited docs and source code' )
186
- @Depends (clean)
187
- Future <void > buildTestPackageDocs () async {
188
- await _buildTestPackageDocs (
189
- _testPackageDocsDir.absolute.path, Directory .current.path);
190
- }
191
-
192
- @Task ('Serve test package docs locally with dhttpd on port 8002' )
193
- @Depends (buildTestPackageDocs)
194
- Future <void > serveTestPackageDocs () async {
195
- await startTestPackageDocsServer ();
196
- }
197
-
198
- Future <void > startTestPackageDocsServer () async {
199
- log ('launching dhttpd on port 8002 for SDK' );
200
- var launcher = SubprocessLauncher ('serve-test-package-docs' );
201
- await launcher.runStreamed (Platform .resolvedExecutable, [
202
- 'pub' ,
203
- 'global' ,
204
- 'run' ,
205
- 'dhttpd' ,
206
- '--port' ,
207
- '8002' ,
208
- '--path' ,
209
- _testPackageDocsDir.absolute.path,
210
- ]);
211
- }
212
-
213
- @Task ('Compare warnings in Dartdoc for Flutter' )
214
- Future <void > compareFlutterWarnings () async =>
215
- await task.compareFlutterWarnings ();
216
-
217
- @Task ('Build flutter docs' )
218
- Future <void > buildFlutterDocs () async => await task.docFlutter ();
219
-
220
85
@Task (
221
86
'Build an arbitrary pub package based on PACKAGE_NAME and PACKAGE_VERSION '
222
87
'environment variables' )
223
88
Future <String > buildPubPackage () async => await task.docPackage (
224
89
name: Platform .environment['PACKAGE_NAME' ]! ,
225
90
version: Platform .environment['PACKAGE_VERSION' ],
226
91
);
227
-
228
- @Task ('Rebuild generated files' )
229
- @Depends (clean)
230
- Future <void > build () async => task.buildAll ();
231
-
232
- @Task ('Clean up test directories and delete build cache' )
233
- Future <void > clean () async {
234
- for (var e in _nonRootPubData) {
235
- e.deleteSync (recursive: true );
236
- }
237
- }
238
-
239
- Iterable <FileSystemEntity > get _nonRootPubData {
240
- // This involves deleting things, so be careful.
241
- if (! File (p.join ('tool' , 'grind.dart' )).existsSync ()) {
242
- throw FileSystemException ('wrong CWD, run from root of dartdoc package' );
243
- }
244
- return Directory ('.' )
245
- .listSync (recursive: true )
246
- .where ((e) => p.dirname (e.path) != '.' )
247
- .where ((e) => < String > ['.dart_tool' , '.packages' , 'pubspec.lock' ]
248
- .contains (p.basename (e.path)));
249
- }
250
-
251
- @Task ('Generate docs for dartdoc without link-to-remote' )
252
- Future <void > testDartdoc () async => await task.validateDartdocDocs ();
253
-
254
- @Task ('Validate the SDK doc build.' )
255
- Future <void > validateSdkDocs () async => await task.validateSdkDocs ();
0 commit comments