Skip to content

Commit f9d7f33

Browse files
authored
Remove code to generate presubmit yaml (#8400)
We are no longer using multiple versions, so now `bin/plugin generate` will only be needed to generate [live templates](https://github.com/flutter/flutter-intellij/tree/30791f99a02d24a84151685f474e5370d1d9849f/resources/liveTemplates)
1 parent f3acef4 commit f9d7f33

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

tool/plugin/lib/plugin.dart

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -78,43 +78,6 @@ List<String> findJavaFiles(String path) {
7878
.toList();
7979
}
8080

81-
bool genPresubmitYaml(List<BuildSpec> specs) {
82-
// This assumes the file contains 'steps:', which seems reasonable.
83-
var file = File(p.join(rootPath, '.github', 'workflows', 'presubmit.yaml'));
84-
var versions = [];
85-
for (var spec in specs) {
86-
if (spec.channel == 'stable' && !spec.untilBuild.contains('SNAPSHOT')) {
87-
versions.add(spec.version);
88-
}
89-
}
90-
91-
var templateFile = File(
92-
p.join(rootPath, '.github', 'workflows', 'presubmit.yaml.template'),
93-
);
94-
var templateContents = templateFile.readAsStringSync();
95-
// If we need to make many changes consider something like genPluginXml().
96-
templateContents = templateContents.replaceFirst(
97-
'@VERSIONS@',
98-
versions.join(', '),
99-
);
100-
var header =
101-
"# Do not edit; instead, modify ${p.basename(templateFile.path)},"
102-
" and run './bin/plugin generate'.\n\n";
103-
var contents = header + templateContents;
104-
log('writing ${p.relative(file.path)}');
105-
var templateIndex = contents.indexOf('steps:');
106-
if (templateIndex < 0) {
107-
log('presubmit template cannot be generated');
108-
return false;
109-
}
110-
var fileContents = file.readAsStringSync();
111-
var fileIndex = fileContents.indexOf('steps:');
112-
var newContent =
113-
contents.substring(0, templateIndex) + fileContents.substring(fileIndex);
114-
file.writeAsStringSync(newContent, flush: true);
115-
return true;
116-
}
117-
11881
bool isTravisFileValid() {
11982
var travisPath = p.join(rootPath, '.github/workflows/presubmit.yaml');
12083
var travisFile = File(travisPath);
@@ -497,16 +460,11 @@ class GenerateCommand extends ProductCommand {
497460

498461
@override
499462
String get description =>
500-
'Generate plugin.xml, .github/workflows/presubmit.yaml, '
501-
'and resources/liveTemplates/flutter_miscellaneous.xml files for the '
502-
'Flutter plugin.\nThe plugin.xml.template and product-matrix.json are '
503-
'used as input.';
463+
'Generate resources/liveTemplates/flutter_miscellaneous.xml files for '
464+
'the Flutter plugin.';
504465

505466
@override
506467
Future<int> doit() async {
507-
if (!genPresubmitYaml(specs)) {
508-
return 1;
509-
}
510468
generateLiveTemplates();
511469
if (isReleaseMode) {
512470
if (!await performReleaseChecks(this)) {

0 commit comments

Comments
 (0)