diff --git a/product-matrix.json b/product-matrix.json deleted file mode 100644 index 853790930f..0000000000 --- a/product-matrix.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "list": [ - { - "channel": "stable", - "comments": "IntelliJ 2024.3, Android Studio Meerkat 2024.3", - "name": "2024.3", - "version": "2024.3", - "ijVersion": "2024.3", - "ideaProduct": "android-studio", - "ideaVersion": "2024.3.1.10", - "baseVersion": "243.22562.59", - "dartPluginVersion": "243.21565.120", - "androidPluginVersion": "", - "sinceBuild": "243", - "untilBuild": "243.*", - "isUnitTestTarget": "true", - "javaVersion": "21" - }, - { - "channel": "stable", - "comments": "IntelliJ 2025.1, Android Studio Narwhal 2025.1", - "name": "2025.1", - "version": "2025.1", - "ijVersion": "2025.1", - "ideaProduct": "android-studio", - "ideaVersion": "2025.1.2.5", - "baseVersion": "251.23774.16", - "dartPluginVersion": "251.23774.16", - "androidPluginVersion": "", - "sinceBuild": "251", - "untilBuild": "253.*", - "isUnitTestTarget": "false", - "javaVersion": "21" - } - ] -} \ No newline at end of file diff --git a/tool/plugin/lib/build_spec.dart b/tool/plugin/lib/build_spec.dart index 61b4abf035..ce5688fc04 100644 --- a/tool/plugin/lib/build_spec.dart +++ b/tool/plugin/lib/build_spec.dart @@ -132,35 +132,3 @@ class BuildSpec { } } -/// This represents a BuildSpec that is used to generate the plugin.xml -/// that is used during development. It needs to span all possible versions. -/// The product-matrix.json file lists the versions in increasing build order. -/// The first one is the earliest version used during development and the -/// last one is the latest used during development. This BuildSpec combines -/// those two. -class SyntheticBuildSpec extends BuildSpec { - late final BuildSpec alternate; - - SyntheticBuildSpec.fromJson( - super.json, - super.releaseNum, - List specs, - ) : super.fromJson() { - try { - // 'isUnitTestTarget' should always be in the spec for the latest IntelliJ (not AS). - alternate = specs.firstWhere((s) => s.isUnitTestTarget); - } on StateError catch (_) { - log('No build spec defines "isUnitTestTarget"'); - exit(1); - } - } - - @override - String get sinceBuild => alternate.sinceBuild; - - @override - String get untilBuild => alternate.untilBuild; - - @override - bool get isSynthetic => true; -} diff --git a/tool/plugin/lib/plugin.dart b/tool/plugin/lib/plugin.dart index 5a48e2672b..123bfc2862 100644 --- a/tool/plugin/lib/plugin.dart +++ b/tool/plugin/lib/plugin.dart @@ -2,7 +2,6 @@ // code is governed by a BSD-style license that can be found in the LICENSE file. import 'dart:async'; -import 'dart:convert'; import 'dart:io'; import 'package:args/args.dart'; @@ -11,7 +10,6 @@ import 'package:git/git.dart'; import 'package:path/path.dart' as p; import 'build_spec.dart'; -import 'edit.dart'; import 'globals.dart'; import 'lint.dart'; import 'runner.dart'; @@ -21,7 +19,6 @@ Future main(List args) async { var runner = BuildCommandRunner(); runner.addCommand(LintCommand(runner)); - runner.addCommand(TestCommand(runner)); runner.addCommand(DeployCommand(runner)); runner.addCommand(GenerateCommand(runner)); @@ -47,15 +44,6 @@ void copyResources({required String from, required String to}) { _copyResources(Directory(from), Directory(to)); } -List createBuildSpecs(ProductCommand command) { - var specs = []; - var input = readProductMatrix(); - for (var json in input) { - specs.add(BuildSpec.fromJson(json, command.release)); - } - return specs; -} - List findJars(String path) { final dir = Directory(path); return dir @@ -74,18 +62,10 @@ List findJavaFiles(String path) { .toList(); } -bool isTravisFileValid() { - var travisPath = p.join(rootPath, '.github/workflows/presubmit.yaml'); - var travisFile = File(travisPath); - if (!travisFile.existsSync()) { - return false; - } - var matrixPath = p.join(rootPath, 'product-matrix.json'); - var matrixFile = File(matrixPath); - if (!matrixFile.existsSync()) { - throw 'product-matrix.json is missing'; - } - return isNewer(travisFile, matrixFile); +bool isPresubmitFileValid() { + var presubmitPath = p.join(rootPath, '.github/workflows/presubmit.yaml'); + var presubmitFile = File(presubmitPath); + return presubmitFile.existsSync(); } Future jar(String directory, String outFile) async { @@ -130,7 +110,7 @@ Future performReleaseChecks(ProductCommand cmd) async { name.lastIndexOf(RegExp(r"\.[0-9]")) == name.length - 2; } if (result) { - if (isTravisFileValid()) { + if (isPresubmitFileValid()) { return result; } else { log('the presubmit.yaml file needs updating: plugin generate'); @@ -162,13 +142,6 @@ Future performReleaseChecks(ProductCommand cmd) async { return false; } -List> readProductMatrix() { - var contents = - File(p.join(rootPath, 'product-matrix.json')).readAsStringSync(); - var map = json.decode(contents); - return (map['list'] as List).cast>(); -} - void _copyFile(File file, Directory to, {String filename = ''}) { if (!file.existsSync()) { throw "${file.path} does not exist"; @@ -278,12 +251,7 @@ https://plugins.jetbrains.com/plugin/uploadPlugin } } -/// Generate the plugin.xml from the plugin.xml.template file. If the --release -/// argument is given, create a git branch and commit the new file to it, -/// assuming the release checks pass. -/// -/// Note: The product-matrix.json file includes a build spec for the EAP version -/// at the end. When the EAP version is released that needs to be updated. +/// This is only used to generate live templates for the Flutter plugin. class GenerateCommand extends ProductCommand { @override final BuildCommandRunner runner; @@ -353,7 +321,6 @@ class GenerateCommand extends ProductCommand { abstract class ProductCommand extends Command { @override final String name; - late List specs; ProductCommand(this.name) { addProductFlags(argParser, name[0].toUpperCase() + name.substring(1)); @@ -448,7 +415,6 @@ abstract class ProductCommand extends Command { @override Future run() async { await _initGlobals(); - await _initSpecs(); try { return await doit(); } catch (ex, stack) { @@ -471,17 +437,6 @@ abstract class ProductCommand extends Command { lastReleaseDate = await dateOfLastRelease(); } } - - Future _initSpecs() async { - specs = createBuildSpecs(this); - for (var i = 0; i < specs.length; i++) { - if (isDevChannel) { - specs[i].buildForDev(); - } - await specs[i].initChangeLog(); - } - return specs.length; - } } /// A crude rename utility. The IntelliJ feature does not work on the case @@ -597,66 +552,3 @@ class RenamePackageCommand extends ProductCommand { } } } - -/// Build the tests if necessary then run them and return any failure code. -class TestCommand extends ProductCommand { - @override - final BuildCommandRunner runner; - - TestCommand(this.runner) : super('test') { - argParser.addFlag( - 'skip', - negatable: false, - help: 'Do not run tests, just unpack artifaccts', - abbr: 's', - ); - argParser.addFlag('setup', abbr: 'p', defaultsTo: true); - } - - @override - String get description => 'Run the tests for the Flutter plugin.'; - - @override - Future doit() async { - final javaHome = Platform.environment['JAVA_HOME']; - if (javaHome == null) { - log('ERROR: JAVA_HOME environment variable not set - this is needed by gradle.'); - return 1; - } - - log('JAVA_HOME=$javaHome'); - - // Case 1: Handle skipping tests - if (argResults != null && argResults!.flag('skip')) { - log('Skipping unit tests as requested.'); - return 0; - } - - // Filter for all unit test targets - final unitTestTargets = specs.where((s) => s.isUnitTestTarget).toList(); - - // Case 2: Zero unit test targets - if (unitTestTargets.isEmpty) { - log('ERROR: No unit test target found in the specifications. Cannot run tests.'); - return 1; - } - - // Case 3: More than one unit test target - if (unitTestTargets.length > 1) { - final targetNames = unitTestTargets.map((s) => s.name).join(', '); - log('ERROR: More than one unit test target found: $targetNames. Please specify which one to run, or ensure only one exists.'); - return 1; - } - - // Happy Case: Exactly one unit test target - final spec = unitTestTargets.first; - return await _runUnitTests(spec); - } - - Future _runUnitTests(BuildSpec spec) async { - // run './gradlew test' - return await applyEdits(spec, () async { - return await runner.runGradleCommand(['test'], spec, '1', 'true'); - }); - } -} diff --git a/tool/plugin/test/plugin_test.dart b/tool/plugin/test/plugin_test.dart index bf29cae0e1..e6a9b687b3 100644 --- a/tool/plugin/test/plugin_test.dart +++ b/tool/plugin/test/plugin_test.dart @@ -6,15 +6,10 @@ import 'dart:io'; import 'package:plugin_tool/plugin.dart'; import 'package:plugin_tool/runner.dart'; -import 'package:string_validator/string_validator.dart' as validator; import 'package:test/test.dart'; void main() { group("create", () { - test('test', () { - expect(TestCommand(BuildCommandRunner()).name, "test"); - }); - test('deploy', () { expect(DeployCommand(BuildCommandRunner()).name, "deploy"); }); @@ -24,60 +19,6 @@ void main() { }); }); - group("spec", () { - /// This method has assertions which can be made for all commands in this - /// test group. - void buildSpecAssertions(BuildCommandRunner runner, String command) { - var specs = (runner.commands[command] as ProductCommand).specs; - expect(specs, isList); - expect(specs, isNotEmpty); - - // channel should be set to stable in the product-matrix.json - for (String channel in specs.map((spec) => spec.channel).toList()) { - expect(channel, anyOf('stable')); - } - - // name should be set to stable in the product-matrix.json - for (String name in specs.map((spec) => spec.name).toList()) { - expect(name, isNotEmpty); - expect(name.length, 6); - expect(name, validator.isFloat); - } - - // ideaProduct should be android-studio or IC - for (String ideaProduct - in specs.map((spec) => spec.ideaProduct).toList()) { - expect(ideaProduct, anyOf('android-studio', 'IC')); - } - - // sinceBuild should be in the form of '243' - for (String sinceBuild in specs.map((spec) => spec.sinceBuild).toList()) { - expect(sinceBuild.length, 3); - expect(sinceBuild, validator.isNumeric); - } - - // untilBuild should be in the form of '243.*' - for (String untilBuild in specs.map((spec) => spec.untilBuild).toList()) { - expect(untilBuild.length, 5); - expect(untilBuild.substring(0, 2), validator.isNumeric); - } - } - - test('test', () async { - var runner = makeTestRunner(); - await runner.run(["-r=19", "-d../..", "test"]).whenComplete(() { - buildSpecAssertions(runner, "test"); - }); - }); - - test('deploy', () async { - var runner = makeTestRunner(); - await runner.run(["-r19", "-d../..", "deploy"]).whenComplete(() { - buildSpecAssertions(runner, "deploy"); - }); - }); - }); - group('release', () { test('simple', () async { var runner = makeTestRunner(); @@ -144,8 +85,7 @@ void main() { BuildCommandRunner makeTestRunner() { var runner = BuildCommandRunner(); - runner.addCommand(TestTestCommand(runner)); - runner.addCommand(TestDeployCommand(runner)); + runner.addCommand(TestDeployCommand(runner)); runner.addCommand(TestGenCommand(runner)); return runner; } @@ -188,13 +128,3 @@ class TestGenCommand extends GenerateCommand { @override Future doit() async => Future(() => 0); } - -class TestTestCommand extends TestCommand { - TestTestCommand(super.runner); - - @override - bool get isTesting => true; - - @override - Future doit() async => Future(() => 0); -}