* Revert "Enable dart_plugin_registry_test (#76645)" This reverts commit109e0bb9f5. * Revert "Apply changes caused by https://github.com/flutter/flutter/pull/76662 (#77093)" This reverts commitcdca6485f0. * Revert "Disable clang format in the plugin registrants (#76662)" This reverts commitdadbd47d09. * Revert "Disable warnings for the dart plugin registrant (#76561)" This reverts commit098ece522d. * Revert "Remove dart_plugin_registry_test timeouts (#76838)" This reverts commit1610a27476. * Revert "Implement dartPluginClass support for plugins (#74469)" This reverts commitb7d4806243. Kick.
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter_devicelab/tasks/dart_plugin_registry_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
await task(dartPluginRegistryTest());
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source 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:path/path.dart' as path;
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/task_result.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
TaskFunction dartPluginRegistryTest({
|
||||
String deviceIdOverride,
|
||||
Map<String, String> environment,
|
||||
}) {
|
||||
final Directory tempDir = Directory.systemTemp
|
||||
.createTempSync('flutter_devicelab_dart_plugin_test.');
|
||||
return () async {
|
||||
try {
|
||||
section('Create implementation plugin');
|
||||
await inDirectory(tempDir, () async {
|
||||
await flutter(
|
||||
'create',
|
||||
options: <String>[
|
||||
'--template=plugin',
|
||||
'--org',
|
||||
'io.flutter.devicelab',
|
||||
'--platforms',
|
||||
'macos',
|
||||
'plugin_platform_implementation',
|
||||
],
|
||||
environment: environment,
|
||||
);
|
||||
});
|
||||
|
||||
final File pluginMain = File(path.join(
|
||||
tempDir.absolute.path,
|
||||
'plugin_platform_implementation',
|
||||
'lib',
|
||||
'plugin_platform_implementation.dart',
|
||||
));
|
||||
if (!pluginMain.existsSync()) {
|
||||
return TaskResult.failure('${pluginMain.path} does not exist');
|
||||
}
|
||||
|
||||
// Patch plugin main dart file.
|
||||
await pluginMain.writeAsString('''
|
||||
class PluginPlatformInterfaceMacOS {
|
||||
static void registerWith() {
|
||||
print('PluginPlatformInterfaceMacOS.registerWith() was called');
|
||||
}
|
||||
}
|
||||
''', flush: true);
|
||||
|
||||
// Patch plugin main pubspec file.
|
||||
final File pluginImplPubspec = File(path.join(
|
||||
tempDir.absolute.path,
|
||||
'plugin_platform_implementation',
|
||||
'pubspec.yaml',
|
||||
));
|
||||
String pluginImplPubspecContent = await pluginImplPubspec.readAsString();
|
||||
pluginImplPubspecContent = pluginImplPubspecContent.replaceFirst(
|
||||
' pluginClass: PluginPlatformImplementationPlugin',
|
||||
' pluginClass: PluginPlatformImplementationPlugin\n'
|
||||
' dartPluginClass: PluginPlatformInterfaceMacOS\n',
|
||||
);
|
||||
pluginImplPubspecContent = pluginImplPubspecContent.replaceFirst(
|
||||
' platforms:\n',
|
||||
' implements: plugin_platform_interface\n'
|
||||
' platforms:\n');
|
||||
await pluginImplPubspec.writeAsString(pluginImplPubspecContent,
|
||||
flush: true);
|
||||
|
||||
section('Create interface plugin');
|
||||
await inDirectory(tempDir, () async {
|
||||
await flutter(
|
||||
'create',
|
||||
options: <String>[
|
||||
'--template=plugin',
|
||||
'--org',
|
||||
'io.flutter.devicelab',
|
||||
'--platforms',
|
||||
'macos',
|
||||
'plugin_platform_interface',
|
||||
],
|
||||
environment: environment,
|
||||
);
|
||||
});
|
||||
final File pluginInterfacePubspec = File(path.join(
|
||||
tempDir.absolute.path,
|
||||
'plugin_platform_interface',
|
||||
'pubspec.yaml',
|
||||
));
|
||||
String pluginInterfacePubspecContent =
|
||||
await pluginInterfacePubspec.readAsString();
|
||||
pluginInterfacePubspecContent =
|
||||
pluginInterfacePubspecContent.replaceFirst(
|
||||
' pluginClass: PluginPlatformInterfacePlugin',
|
||||
' default_package: plugin_platform_implementation\n');
|
||||
pluginInterfacePubspecContent =
|
||||
pluginInterfacePubspecContent.replaceFirst(
|
||||
'dependencies:',
|
||||
'dependencies:\n'
|
||||
' plugin_platform_implementation:\n'
|
||||
' path: ../plugin_platform_implementation\n');
|
||||
await pluginInterfacePubspec.writeAsString(pluginInterfacePubspecContent,
|
||||
flush: true);
|
||||
|
||||
section('Create app');
|
||||
|
||||
await inDirectory(tempDir, () async {
|
||||
await flutter(
|
||||
'create',
|
||||
options: <String>[
|
||||
'--template=app',
|
||||
'--org',
|
||||
'io.flutter.devicelab',
|
||||
'--platforms',
|
||||
'macos',
|
||||
'app',
|
||||
],
|
||||
environment: environment,
|
||||
);
|
||||
});
|
||||
|
||||
final File appPubspec = File(path.join(
|
||||
tempDir.absolute.path,
|
||||
'app',
|
||||
'pubspec.yaml',
|
||||
));
|
||||
String appPubspecContent = await appPubspec.readAsString();
|
||||
appPubspecContent = appPubspecContent.replaceFirst(
|
||||
'dependencies:',
|
||||
'dependencies:\n'
|
||||
' plugin_platform_interface:\n'
|
||||
' path: ../plugin_platform_interface\n');
|
||||
await appPubspec.writeAsString(appPubspecContent, flush: true);
|
||||
|
||||
section('Flutter run for macos');
|
||||
|
||||
await inDirectory(path.join(tempDir.path, 'app'), () async {
|
||||
final Process run = await startProcess(
|
||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||
flutterCommandArgs('run', <String>['-d', 'macos', '-v']),
|
||||
environment: null,
|
||||
);
|
||||
Completer<void> registryExecutedCompleter = Completer<void>();
|
||||
final StreamSubscription<void> subscription = run.stdout
|
||||
.transform<String>(utf8.decoder)
|
||||
.transform<String>(const LineSplitter())
|
||||
.listen((String line) {
|
||||
if (line.contains(
|
||||
'PluginPlatformInterfaceMacOS.registerWith() was called')) {
|
||||
registryExecutedCompleter.complete();
|
||||
}
|
||||
print('stdout: $line');
|
||||
});
|
||||
|
||||
section('Wait for registry execution');
|
||||
await registryExecutedCompleter.future;
|
||||
|
||||
// Hot restart.
|
||||
run.stdin.write('R');
|
||||
registryExecutedCompleter = Completer<void>();
|
||||
|
||||
section('Wait for registry execution after hot restart');
|
||||
await registryExecutedCompleter.future;
|
||||
|
||||
subscription.cancel();
|
||||
run.kill();
|
||||
});
|
||||
return TaskResult.success(null);
|
||||
} finally {
|
||||
rmTree(tempDir);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_windows/url_launcher_plugin.h>
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
// Generated file. Do not edit.
|
||||
//
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GENERATED_PLUGIN_REGISTRANT_
|
||||
#define GENERATED_PLUGIN_REGISTRANT_
|
||||
|
||||
|
||||
@@ -904,7 +904,7 @@
|
||||
"name": "Mac dart_plugin_registry_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "dart_plugin_registry_test",
|
||||
"flaky": false
|
||||
"flaky": true
|
||||
},
|
||||
{
|
||||
"name": "Mac tool_tests_general",
|
||||
|
||||
@@ -536,7 +536,7 @@
|
||||
"name": "Mac dart_plugin_registry_test",
|
||||
"repo": "flutter",
|
||||
"task_name": "dart_plugin_registry_test",
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"run_if": ["dev/**", "packages/flutter_tools/**", "bin/**"]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user