Skip to content

Commit 140f16c

Browse files
authored
[CQ] remove (stale) deploy plugin command (#7929)
## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
1 parent 350b1ff commit 140f16c

File tree

3 files changed

+4
-198
lines changed

3 files changed

+4
-198
lines changed

tool/plugin/lib/plugin.dart

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Future<int> main(List<String> args) async {
2424
runner.addCommand(LintCommand(runner));
2525
runner.addCommand(GradleBuildCommand(runner));
2626
runner.addCommand(TestCommand(runner));
27-
runner.addCommand(DeployCommand(runner));
2827
runner.addCommand(GenerateCommand(runner));
2928
runner.addCommand(VerifyCommand(runner));
3029
runner.addCommand(RunIdeCommand(runner));
@@ -476,89 +475,6 @@ class GradleBuildCommand extends ProductCommand {
476475
}
477476
}
478477

479-
/// Either the --release or --channel options must be provided.
480-
/// The permanent token is read from the file specified by Kokoro.
481-
class DeployCommand extends ProductCommand {
482-
@override
483-
final BuildCommandRunner runner;
484-
485-
DeployCommand(this.runner) : super('deploy');
486-
487-
@override
488-
String get description => 'Upload the Flutter plugin to the JetBrains site.';
489-
490-
@override
491-
Future<int> doit() async {
492-
if (isReleaseMode) {
493-
if (!await performReleaseChecks(this)) {
494-
return 1;
495-
}
496-
} else if (!isDevChannel) {
497-
log('Deploy must have a --release or --channel=dev argument');
498-
return 1;
499-
}
500-
501-
var token = readTokenFromKeystore('FLUTTER_KEYSTORE_NAME');
502-
var value = 0;
503-
var originalDir = Directory.current;
504-
for (var spec in specs) {
505-
if (spec.channel != channel) continue;
506-
var filePath = releasesFilePath(spec);
507-
log("uploading $filePath");
508-
var file = File(filePath);
509-
changeDirectory(file.parent);
510-
var pluginNumber = pluginRegistryIds[spec.pluginId];
511-
value = await upload(
512-
p.basename(file.path),
513-
pluginNumber!,
514-
token,
515-
spec.channel,
516-
);
517-
if (value != 0) {
518-
return value;
519-
}
520-
}
521-
changeDirectory(originalDir);
522-
return value;
523-
}
524-
525-
void changeDirectory(Directory dir) {
526-
Directory.current = dir.path;
527-
}
528-
529-
Future<int> upload(
530-
String filePath,
531-
String pluginNumber,
532-
String token,
533-
String channel,
534-
) async {
535-
if (!File(filePath).existsSync()) {
536-
throw 'File not found: $filePath';
537-
}
538-
// See https://plugins.jetbrains.com/docs/marketplace/plugin-upload.html#PluginUploadAPI-POST
539-
// Trying to run curl directly doesn't work; something odd happens to the quotes.
540-
var cmd = '''
541-
curl
542-
-i
543-
--header "Authorization: Bearer $token"
544-
-F pluginId=$pluginNumber
545-
-F file=@$filePath
546-
-F channel=$channel
547-
https://plugins.jetbrains.com/plugin/uploadPlugin
548-
''';
549-
550-
var args = ['-c', cmd.split('\n').join(' ')];
551-
final processResult = await Process.run('sh', args);
552-
if (processResult.exitCode != 0) {
553-
log('Upload failed: ${processResult.stderr} for file: $filePath');
554-
}
555-
final out = processResult.stdout as String;
556-
var message = out.trim().split('\n').last.trim();
557-
log(message);
558-
return processResult.exitCode;
559-
}
560-
}
561-
562478
/// Generate the plugin.xml from the plugin.xml.template file. If the --release
563479
/// argument is given, create a git branch and commit the new file to it,
564480
/// assuming the release checks pass.

tool/plugin/lib/runner.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import 'util.dart';
1212

1313
class BuildCommandRunner extends CommandRunner<int> {
1414
BuildCommandRunner()
15-
: super(
16-
'plugin',
17-
'A script to build, test, and deploy the Flutter IntelliJ plugin.',
18-
) {
15+
: super(
16+
'plugin',
17+
'A script to build and test the Flutter IntelliJ plugin.',
18+
) {
1919
argParser.addOption(
2020
'release',
2121
abbr: 'r',

tool/plugin/test/plugin_test.dart

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ void main() {
2121
expect(TestCommand(BuildCommandRunner()).name, "test");
2222
});
2323

24-
test('deploy', () {
25-
expect(DeployCommand(BuildCommandRunner()).name, "deploy");
26-
});
27-
2824
test('generate', () {
2925
expect(GenerateCommand(BuildCommandRunner()).name, "generate");
3026
});
@@ -87,13 +83,6 @@ void main() {
8783
});
8884
});
8985

90-
test('deploy', () async {
91-
var runner = makeTestRunner();
92-
await runner.run(["-r19", "-d../..", "deploy"]).whenComplete(() {
93-
buildSpecAssertions(runner, "deploy");
94-
});
95-
});
96-
9786
test('verify', () async {
9887
var runner = makeTestRunner();
9988
await runner.run(["-r19", "-d../..", "verify"]).whenComplete(() {
@@ -102,75 +91,6 @@ void main() {
10291
});
10392
});
10493

105-
group('release', () {
106-
test('simple', () async {
107-
var runner = makeTestRunner();
108-
late TestDeployCommand cmd;
109-
await runner.run(["-r19", "-d../..", "deploy"]).whenComplete(() {
110-
cmd = (runner.commands['deploy'] as TestDeployCommand);
111-
});
112-
expect(cmd.isReleaseValid, true);
113-
});
114-
115-
test('minor', () async {
116-
var runner = makeTestRunner();
117-
late TestDeployCommand cmd;
118-
await runner.run(["-r19.2", "-d../..", "deploy"]).whenComplete(() {
119-
cmd = (runner.commands['deploy'] as TestDeployCommand);
120-
});
121-
expect(cmd.isReleaseValid, true);
122-
});
123-
124-
test('patch invalid', () async {
125-
var runner = makeTestRunner();
126-
late TestDeployCommand cmd;
127-
await runner.run(["-r19.2.1", "-d../..", "deploy"]).whenComplete(() {
128-
cmd = (runner.commands['deploy'] as TestDeployCommand);
129-
});
130-
expect(cmd.isReleaseValid, false);
131-
});
132-
133-
test('non-numeric', () async {
134-
var runner = makeTestRunner();
135-
late TestDeployCommand cmd;
136-
await runner.run(["-rx19.2", "-d../..", "deploy"]).whenComplete(() {
137-
cmd = (runner.commands['deploy'] as TestDeployCommand);
138-
});
139-
expect(cmd.isReleaseValid, false);
140-
});
141-
});
142-
143-
group('deploy', () {
144-
test('clean', () async {
145-
var dir = Directory.current;
146-
var runner = makeTestRunner();
147-
await runner
148-
.run(["-r=19", "-d../..", "deploy", "--no-as", "--no-ij"])
149-
.whenComplete(() {
150-
expect(Directory.current.path, equals(dir.path));
151-
});
152-
});
153-
154-
test('without --release', () async {
155-
var runner = makeTestRunner();
156-
late TestDeployCommand cmd;
157-
await runner.run(["-d../..", "deploy"]).whenComplete(() {
158-
cmd = (runner.commands['deploy'] as TestDeployCommand);
159-
});
160-
expect(cmd.paths, orderedEquals([]));
161-
});
162-
163-
test('release paths', () async {
164-
var runner = makeTestRunner();
165-
late TestDeployCommand cmd;
166-
await runner.run(["--release=19", "-d../..", "deploy"]).whenComplete(() {
167-
cmd = (runner.commands['deploy'] as TestDeployCommand);
168-
});
169-
var specs = cmd.specs.where((s) => s.isStableChannel).toList();
170-
expect(cmd.paths.length, specs.length);
171-
});
172-
});
173-
17494
group('build', () {
17595
test('plugin.xml', () async {
17696
var runner = makeTestRunner();
@@ -255,41 +175,11 @@ BuildCommandRunner makeTestRunner() {
255175
var runner = BuildCommandRunner();
256176
runner.addCommand(TestMakeCommand(runner));
257177
runner.addCommand(TestTestCommand(runner));
258-
runner.addCommand(TestDeployCommand(runner));
259178
runner.addCommand(TestGenCommand(runner));
260179
runner.addCommand(TestVerifyCommand(runner));
261180
return runner;
262181
}
263182

264-
class TestDeployCommand extends DeployCommand {
265-
List<String> paths = <String>[];
266-
List<String> plugins = <String>[];
267-
268-
TestDeployCommand(super.runner);
269-
270-
@override
271-
bool get isTesting => true;
272-
273-
@override
274-
void changeDirectory(Directory dir) {}
275-
276-
String readTokenFile() {
277-
return "token";
278-
}
279-
280-
@override
281-
Future<int> upload(
282-
String filePath,
283-
String pluginNumber,
284-
String token,
285-
String channel,
286-
) {
287-
paths.add(filePath);
288-
plugins.add(pluginNumber);
289-
return Future(() => 0);
290-
}
291-
}
292-
293183
class TestGenCommand extends GenerateCommand {
294184
TestGenCommand(super.runner);
295185

0 commit comments

Comments
 (0)