From 64acfebb879cd3378d4fa7279d015bd14f6e335f Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 22 Jul 2025 15:13:37 -0700 Subject: [PATCH 1/5] Remove xml templates and template writing code --- resources/META-INF/plugin.xml | 7 +- resources/META-INF/plugin_template.xml | 381 ------------------ resources/META-INF/studio-contribs.xml | 2 - .../META-INF/studio-contribs_template.xml | 39 -- tool/plugin/lib/plugin.dart | 65 --- tool/plugin/test/plugin_test.dart | 1 - 6 files changed, 2 insertions(+), 493 deletions(-) delete mode 100644 resources/META-INF/plugin_template.xml delete mode 100644 resources/META-INF/studio-contribs_template.xml diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml index 972c55143..00891ec8a 100644 --- a/resources/META-INF/plugin.xml +++ b/resources/META-INF/plugin.xml @@ -1,5 +1,3 @@ - - io.flutter @@ -21,9 +19,9 @@ Google Custom Languages - SNAPSHOT + $VERSION - + com.intellij.modules.platform com.intellij.modules.lang @@ -49,7 +47,6 @@ com.intellij.modules.androidstudio - diff --git a/resources/META-INF/plugin_template.xml b/resources/META-INF/plugin_template.xml deleted file mode 100644 index 6d95a4914..000000000 --- a/resources/META-INF/plugin_template.xml +++ /dev/null @@ -1,381 +0,0 @@ - - - io.flutter - Flutter - - Support for developing Flutter applications. Flutter gives developers an easy and productive - way to build and deploy cross-platform, high-performance mobile apps for both Android and iOS. - Installing this plugin will also install the Dart plugin.

-
-

For some tools, this plugin uses Chromium through JxBrowser to display content from the web. - JxBrowser complies with LGPL and offers an option to replace Chromium with another component. - To do this:

-
  • Find the JxBrowser files stored in the plugins directory, under /flutter-intellij/jxbrowser.
  • -
  • The LGPL requirements are at from JxBrowser, here you can also download the build script to relink with modified components.
  • - ]]> -
    - - Google - - Custom Languages - @VERSION@ - - - - com.intellij.modules.platform - com.intellij.modules.lang - com.intellij.modules.xdebugger - org.jetbrains.plugins.yaml - Dart - Git4Idea - - - - - - com.intellij.modules.java - com.intellij.modules.coverage - - - com.google.tools.ij.aiplugin - - - org.jetbrains.android - - - - @DEPEND@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    diff --git a/resources/META-INF/studio-contribs.xml b/resources/META-INF/studio-contribs.xml index d331491f1..09ca99832 100644 --- a/resources/META-INF/studio-contribs.xml +++ b/resources/META-INF/studio-contribs.xml @@ -1,5 +1,3 @@ - - diff --git a/resources/META-INF/studio-contribs_template.xml b/resources/META-INF/studio-contribs_template.xml deleted file mode 100644 index 09ca99832..000000000 --- a/resources/META-INF/studio-contribs_template.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tool/plugin/lib/plugin.dart b/tool/plugin/lib/plugin.dart index 2e0a99d13..9459cd95f 100644 --- a/tool/plugin/lib/plugin.dart +++ b/tool/plugin/lib/plugin.dart @@ -78,32 +78,6 @@ List findJavaFiles(String path) { .toList(); } -Future genPluginFiles(BuildSpec spec, String destDir) async { - await genPluginXml(spec, destDir, 'META-INF/plugin.xml'); - await genPluginXml(spec, destDir, 'META-INF/studio-contribs.xml'); - return true; -} - -Future genPluginXml(BuildSpec spec, String destDir, String path) async { - var templatePath = - '${path.substring(0, path.length - '.xml'.length)}_template.xml'; - var file = await File( - p.join(rootPath, destDir, path), - ).create(recursive: true); - log('writing ${p.relative(file.path)}'); - var dest = file.openWrite(); - dest.writeln( - "", - ); - dest.writeln(); - await utf8.decoder - .bind(File(p.join(rootPath, 'resources', templatePath)).openRead()) - .transform(LineSplitter()) - .forEach((l) => dest.writeln(substituteTemplateVariables(l, spec))); - await dest.close(); - await dest.done; -} - bool genPresubmitYaml(List specs) { // This assumes the file contains 'steps:', which seems reasonable. var file = File(p.join(rootPath, '.github', 'workflows', 'presubmit.yaml')); @@ -236,43 +210,6 @@ List> readProductMatrix() { return (map['list'] as List).cast>(); } -String substituteTemplateVariables(String line, BuildSpec spec) { - String valueOf(String name) { - switch (name) { - case 'SINCE': - return spec.sinceBuild; - case 'UNTIL': - return spec.untilBuild; - case 'VERSION': - var releaseNo = buildVersionNumber(spec); - return '$releaseNo'; - case 'DEPEND': - // If found, this is the module that triggers loading the Android Studio - // support. The public sources and the installable plugin use different ones. - return spec.isSynthetic - ? 'com.intellij.modules.androidstudio' - : 'com.android.tools.apk'; - default: - throw 'unknown template variable: $name'; - } - } - - var start = line.indexOf('@'); - while (start >= 0 && start < line.length) { - var end = line.indexOf('@', start + 1); - if (end > 0) { - var name = line.substring(start + 1, end); - line = line.replaceRange(start, end + 1, valueOf(name)); - if (end < line.length - 1) { - start = line.indexOf('@', end + 1); - } - } else { - break; // Some commit message has a '@' in it. - } - } - return line; -} - void _copyFile(File file, Directory to, {String filename = ''}) { if (!file.existsSync()) { throw "${file.path} does not exist"; @@ -430,7 +367,6 @@ class GradleBuildCommand extends ProductCommand { var pluginSrc = pluginFile.readAsStringSync(); var studioSrc = studioFile.readAsStringSync(); try { - await genPluginFiles(spec, 'resources'); return await runner.buildPlugin(spec, buildVersionNumber(spec)); } finally { pluginFile.writeAsStringSync(pluginSrc); @@ -575,7 +511,6 @@ class GenerateCommand extends ProductCommand { Future doit() async { var json = readProductMatrix(); var spec = SyntheticBuildSpec.fromJson(json.first, release, specs); - await genPluginFiles(spec, 'resources'); if (!genPresubmitYaml(specs)) { return 1; } diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index eeddbabe1..6e2334479 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -184,7 +184,6 @@ void main() { }); var spec = cmd.specs[0]; await removeAll('../../build/classes'); - await genPluginFiles(spec, 'build/classes'); var file = File("../../build/classes/META-INF/plugin.xml"); expect(file.existsSync(), isTrue); var content = file.readAsStringSync(); From c2938aca27ff1e856c851780280113a9d8f0f41e Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 22 Jul 2025 15:33:09 -0700 Subject: [PATCH 2/5] Clean up unused spec --- tool/plugin/lib/plugin.dart | 2 -- tool/plugin/test/plugin_test.dart | 1 - 2 files changed, 3 deletions(-) diff --git a/tool/plugin/lib/plugin.dart b/tool/plugin/lib/plugin.dart index 9459cd95f..a0fd5330f 100644 --- a/tool/plugin/lib/plugin.dart +++ b/tool/plugin/lib/plugin.dart @@ -509,8 +509,6 @@ class GenerateCommand extends ProductCommand { @override Future doit() async { - var json = readProductMatrix(); - var spec = SyntheticBuildSpec.fromJson(json.first, release, specs); if (!genPresubmitYaml(specs)) { return 1; } diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index 6e2334479..b1ec9bdb3 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -182,7 +182,6 @@ void main() { await runner.run(["-d../..", "make"]).whenComplete(() { cmd = (runner.commands['make'] as TestMakeCommand); }); - var spec = cmd.specs[0]; await removeAll('../../build/classes'); var file = File("../../build/classes/META-INF/plugin.xml"); expect(file.existsSync(), isTrue); From dae6458e1fa67edd4e8cf3eb6a04a46c2e0c18c8 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 22 Jul 2025 15:50:35 -0700 Subject: [PATCH 3/5] Clean up cmd --- tool/plugin/test/plugin_test.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index b1ec9bdb3..ad1511e81 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -178,10 +178,7 @@ void main() { group('build', () { test('plugin.xml', () async { var runner = makeTestRunner(); - late TestMakeCommand cmd; - await runner.run(["-d../..", "make"]).whenComplete(() { - cmd = (runner.commands['make'] as TestMakeCommand); - }); + await runner.run(["-d../..", "make"]); await removeAll('../../build/classes'); var file = File("../../build/classes/META-INF/plugin.xml"); expect(file.existsSync(), isTrue); From 10908273aa26a345f193b5f2729408ec0fce9669 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 22 Jul 2025 15:58:47 -0700 Subject: [PATCH 4/5] Delete test for plugin.xml generation --- tool/plugin/test/plugin_test.dart | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index ad1511e81..5eb91941f 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -176,18 +176,6 @@ void main() { }); group('build', () { - test('plugin.xml', () async { - var runner = makeTestRunner(); - await runner.run(["-d../..", "make"]); - await removeAll('../../build/classes'); - var file = File("../../build/classes/META-INF/plugin.xml"); - expect(file.existsSync(), isTrue); - var content = file.readAsStringSync(); - expect(content.length, greaterThan(10000)); - var loc = content.indexOf('@'); - expect(loc, -1); - }); - test('only-version', () async { ProductCommand command = makeTestRunner().commands['make'] as ProductCommand; From 0f83cc43263fb354e0d3ca35c6513e2e3272ae87 Mon Sep 17 00:00:00 2001 From: Helin Shiah Date: Tue, 22 Jul 2025 16:02:44 -0700 Subject: [PATCH 5/5] Remove unused import --- tool/plugin/test/plugin_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index 5eb91941f..0afa6b17f 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -6,7 +6,6 @@ import 'dart:io'; import 'package:plugin_tool/plugin.dart'; import 'package:plugin_tool/runner.dart'; -import 'package:plugin_tool/util.dart'; import 'package:plugin_tool/verify.dart'; import 'package:string_validator/string_validator.dart' as validator; import 'package:test/test.dart';