Skip to content

Commit 7f44d4f

Browse files
committed
Remove some old build logic that is unused: AntBuildCommand
1 parent 97401f3 commit 7f44d4f

File tree

2 files changed

+44
-86
lines changed

2 files changed

+44
-86
lines changed

tool/plugin/lib/plugin.dart

Lines changed: 44 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Future<int> main(List<String> args) async {
2222
var runner = BuildCommandRunner();
2323

2424
runner.addCommand(LintCommand(runner));
25-
runner.addCommand(AntBuildCommand(runner));
2625
runner.addCommand(GradleBuildCommand(runner));
2726
runner.addCommand(TestCommand(runner));
2827
runner.addCommand(DeployCommand(runner));
@@ -292,82 +291,14 @@ void _copyResources(Directory from, Directory to) {
292291
}
293292
}
294293

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-
363294
/// Build deployable plugin files. If the --release argument is given
364295
/// then perform additional checks to verify that the release environment
365296
/// is in good order.
366-
abstract class BuildCommand extends ProductCommand {
297+
class GradleBuildCommand extends ProductCommand {
367298
@override
368299
final BuildCommandRunner runner;
369300

370-
BuildCommand(this.runner, String commandName) : super(commandName) {
301+
GradleBuildCommand(this.runner) : super('make') {
371302
argParser.addOption('only-version',
372303
abbr: 'o',
373304
help: 'Only build the specified IntelliJ version; useful for sharding '
@@ -387,10 +318,6 @@ abstract class BuildCommand extends ProductCommand {
387318
String get description => 'Build a deployable version of the Flutter plugin, '
388319
'compiled against the specified artifacts.';
389320

390-
Future<int> externalBuildCommand(BuildSpec spec);
391-
392-
Future<int> savePluginArtifact(BuildSpec spec);
393-
394321
@override
395322
Future<int> doit() async {
396323
final argResults = this.argResults!;
@@ -466,9 +393,51 @@ abstract class BuildCommand extends ProductCommand {
466393
if (argResults.option('only-version') == null) {
467394
checkAndClearAppliedEditCommands();
468395
}
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+
}
469413

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();
470431
return 0;
471432
}
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+
}
472441
}
473442

474443
/// Either the --release or --channel options must be provided.

tool/plugin/test/plugin_test.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,24 +216,13 @@ void main() {
216216

217217
BuildCommandRunner makeTestRunner() {
218218
var runner = BuildCommandRunner();
219-
runner.addCommand(TestBuildCommand(runner));
220219
runner.addCommand(TestMakeCommand(runner));
221220
runner.addCommand(TestTestCommand(runner));
222221
runner.addCommand(TestDeployCommand(runner));
223222
runner.addCommand(TestGenCommand(runner));
224223
return runner;
225224
}
226225

227-
class TestBuildCommand extends AntBuildCommand {
228-
TestBuildCommand(super.runner);
229-
230-
@override
231-
bool get isTesting => true;
232-
233-
@override
234-
Future<int> doit() async => Future(() => 0);
235-
}
236-
237226
class TestMakeCommand extends GradleBuildCommand {
238227
TestMakeCommand(super.runner);
239228

0 commit comments

Comments
 (0)