@@ -22,7 +22,6 @@ Future<int> main(List<String> args) async {
22
22
var runner = BuildCommandRunner ();
23
23
24
24
runner.addCommand (LintCommand (runner));
25
- runner.addCommand (AntBuildCommand (runner));
26
25
runner.addCommand (GradleBuildCommand (runner));
27
26
runner.addCommand (TestCommand (runner));
28
27
runner.addCommand (DeployCommand (runner));
@@ -292,82 +291,14 @@ void _copyResources(Directory from, Directory to) {
292
291
}
293
292
}
294
293
295
- class AntBuildCommand extends BuildCommand {
296
- AntBuildCommand (BuildCommandRunner runner) : super (runner, 'build' );
297
-
298
- @override
299
- Future <int > doit () async {
300
- return GradleBuildCommand (runner).doit ();
301
- }
302
-
303
- @override
304
- Future <int > externalBuildCommand (BuildSpec spec) async {
305
- // Not used
306
- return 0 ;
307
- }
308
-
309
- @override
310
- Future <int > savePluginArtifact (BuildSpec spec) async {
311
- // Not used
312
- return 0 ;
313
- }
314
- }
315
-
316
- class GradleBuildCommand extends BuildCommand {
317
- GradleBuildCommand (BuildCommandRunner runner) : super (runner, 'make' );
318
-
319
- @override
320
- Future <int > externalBuildCommand (BuildSpec spec) async {
321
- var pluginFile = File ('resources/META-INF/plugin.xml' );
322
- var studioFile = File ('resources/META-INF/studio-contribs.xml' );
323
- var pluginSrc = pluginFile.readAsStringSync ();
324
- var studioSrc = studioFile.readAsStringSync ();
325
- try {
326
- await genPluginFiles (spec, 'resources' );
327
- return await runner.buildPlugin (spec, buildVersionNumber (spec));
328
- } finally {
329
- pluginFile.writeAsStringSync (pluginSrc);
330
- studioFile.writeAsStringSync (studioSrc);
331
- }
332
- }
333
-
334
- @override
335
- Future <int > savePluginArtifact (BuildSpec spec) async {
336
- final file = File (releasesFilePath (spec));
337
- final version = buildVersionNumber (spec);
338
- var source = File ('build/distributions/flutter-intellij-$version .zip' );
339
- if (! source.existsSync ()) {
340
- // Setting the plugin name in Gradle should eliminate the need for this,
341
- // but it does not.
342
- // TODO(messick) Find a way to make the Kokoro file name: flutter-intellij-DEV.zip
343
- source = File ('build/distributions/flutter-intellij-kokoro-$version .zip' );
344
- }
345
- _copyFile (
346
- source,
347
- file.parent,
348
- filename: p.basename (file.path),
349
- );
350
- await _stopDaemon ();
351
- return 0 ;
352
- }
353
-
354
- Future <int > _stopDaemon () async {
355
- if (Platform .isWindows) {
356
- return await exec ('.\\ third_party\\ gradlew.bat' , ['--stop' ]);
357
- } else {
358
- return await exec ('./third_party/gradlew' , ['--stop' ]);
359
- }
360
- }
361
- }
362
-
363
294
/// Build deployable plugin files. If the --release argument is given
364
295
/// then perform additional checks to verify that the release environment
365
296
/// is in good order.
366
- abstract class BuildCommand extends ProductCommand {
297
+ class GradleBuildCommand extends ProductCommand {
367
298
@override
368
299
final BuildCommandRunner runner;
369
300
370
- BuildCommand (this .runner, String commandName ) : super (commandName ) {
301
+ GradleBuildCommand (this .runner) : super ('make' ) {
371
302
argParser.addOption ('only-version' ,
372
303
abbr: 'o' ,
373
304
help: 'Only build the specified IntelliJ version; useful for sharding '
@@ -387,10 +318,6 @@ abstract class BuildCommand extends ProductCommand {
387
318
String get description => 'Build a deployable version of the Flutter plugin, '
388
319
'compiled against the specified artifacts.' ;
389
320
390
- Future <int > externalBuildCommand (BuildSpec spec);
391
-
392
- Future <int > savePluginArtifact (BuildSpec spec);
393
-
394
321
@override
395
322
Future <int > doit () async {
396
323
final argResults = this .argResults! ;
@@ -466,9 +393,51 @@ abstract class BuildCommand extends ProductCommand {
466
393
if (argResults.option ('only-version' ) == null ) {
467
394
checkAndClearAppliedEditCommands ();
468
395
}
396
+ return 0 ;
397
+ }
398
+
399
+ @override
400
+ Future <int > externalBuildCommand (BuildSpec spec) async {
401
+ var pluginFile = File ('resources/META-INF/plugin.xml' );
402
+ var studioFile = File ('resources/META-INF/studio-contribs.xml' );
403
+ var pluginSrc = pluginFile.readAsStringSync ();
404
+ var studioSrc = studioFile.readAsStringSync ();
405
+ try {
406
+ await genPluginFiles (spec, 'resources' );
407
+ return await runner.buildPlugin (spec, buildVersionNumber (spec));
408
+ } finally {
409
+ pluginFile.writeAsStringSync (pluginSrc);
410
+ studioFile.writeAsStringSync (studioSrc);
411
+ }
412
+ }
469
413
414
+ @override
415
+ Future <int > savePluginArtifact (BuildSpec spec) async {
416
+ final file = File (releasesFilePath (spec));
417
+ final version = buildVersionNumber (spec);
418
+ var source = File ('build/distributions/flutter-intellij-$version .zip' );
419
+ if (! source.existsSync ()) {
420
+ // Setting the plugin name in Gradle should eliminate the need for this,
421
+ // but it does not.
422
+ // TODO(messick) Find a way to make the Kokoro file name: flutter-intellij-DEV.zip
423
+ source = File ('build/distributions/flutter-intellij-kokoro-$version .zip' );
424
+ }
425
+ _copyFile (
426
+ source,
427
+ file.parent,
428
+ filename: p.basename (file.path),
429
+ );
430
+ await _stopDaemon ();
470
431
return 0 ;
471
432
}
433
+
434
+ Future <int > _stopDaemon () async {
435
+ if (Platform .isWindows) {
436
+ return await exec ('.\\ third_party\\ gradlew.bat' , ['--stop' ]);
437
+ } else {
438
+ return await exec ('./third_party/gradlew' , ['--stop' ]);
439
+ }
440
+ }
472
441
}
473
442
474
443
/// Either the --release or --channel options must be provided.
0 commit comments