Generate only requested platform directories on create (#68376)
This commit is contained in:
parent
a4c2075a45
commit
5e17a240bd
@ -546,7 +546,10 @@ To edit platform code in an IDE see https://flutter.dev/developing-packages/#edi
|
|||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
||||||
await project.ensureReadyForPlatformSpecificTooling(checkProjects: false);
|
await project.ensureReadyForPlatformSpecificTooling(
|
||||||
|
androidPlatform: true,
|
||||||
|
iosPlatform: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return generatedCount;
|
return generatedCount;
|
||||||
}
|
}
|
||||||
@ -641,7 +644,6 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
final FlutterProject project = FlutterProject.fromDirectory(directory);
|
||||||
final bool generateAndroid = templateContext['android'] == true;
|
final bool generateAndroid = templateContext['android'] == true;
|
||||||
if (generateAndroid) {
|
if (generateAndroid) {
|
||||||
@ -680,7 +682,15 @@ https://flutter.dev/docs/development/packages-and-plugins/developing-packages#pl
|
|||||||
offline: boolArg('offline'),
|
offline: boolArg('offline'),
|
||||||
generateSyntheticPackage: false,
|
generateSyntheticPackage: false,
|
||||||
);
|
);
|
||||||
await project.ensureReadyForPlatformSpecificTooling(checkProjects: pluginExampleApp);
|
|
||||||
|
await project.ensureReadyForPlatformSpecificTooling(
|
||||||
|
androidPlatform: templateContext['android'] as bool ?? false,
|
||||||
|
iosPlatform: templateContext['ios'] as bool ?? false,
|
||||||
|
linuxPlatform: templateContext['linux'] as bool ?? false,
|
||||||
|
macOSPlatform: templateContext['macos'] as bool ?? false,
|
||||||
|
windowsPlatform: templateContext['windows'] as bool ?? false,
|
||||||
|
webPlatform: templateContext['web'] as bool ?? false,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (templateContext['android'] == true) {
|
if (templateContext['android'] == true) {
|
||||||
gradle.updateLocalProperties(project: project, requireAndroidSdk: false);
|
gradle.updateLocalProperties(project: project, requireAndroidSdk: false);
|
||||||
|
@ -147,13 +147,13 @@ class PackagesGetCommand extends FlutterCommand {
|
|||||||
final FlutterProject rootProject = FlutterProject.fromPath(target);
|
final FlutterProject rootProject = FlutterProject.fromPath(target);
|
||||||
|
|
||||||
await _runPubGet(target, rootProject);
|
await _runPubGet(target, rootProject);
|
||||||
await rootProject.ensureReadyForPlatformSpecificTooling(checkProjects: true);
|
await rootProject.regeneratePlatformSpecificTooling();
|
||||||
|
|
||||||
// Get/upgrade packages in example app as well
|
// Get/upgrade packages in example app as well
|
||||||
if (rootProject.hasExampleApp) {
|
if (rootProject.hasExampleApp) {
|
||||||
final FlutterProject exampleProject = rootProject.example;
|
final FlutterProject exampleProject = rootProject.example;
|
||||||
await _runPubGet(exampleProject.directory.path, exampleProject);
|
await _runPubGet(exampleProject.directory.path, exampleProject);
|
||||||
await exampleProject.ensureReadyForPlatformSpecificTooling(checkProjects: true);
|
await exampleProject.regeneratePlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
|
@ -657,7 +657,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
|
|||||||
|
|
||||||
final bool hasWebPlugins = (await findPlugins(flutterProject))
|
final bool hasWebPlugins = (await findPlugins(flutterProject))
|
||||||
.any((Plugin p) => p.platforms.containsKey(WebPlugin.kConfigKey));
|
.any((Plugin p) => p.platforms.containsKey(WebPlugin.kConfigKey));
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, webPlatform: true);
|
||||||
|
|
||||||
final Uri generatedUri = globals.fs.currentDirectory
|
final Uri generatedUri = globals.fs.currentDirectory
|
||||||
.childDirectory('lib')
|
.childDirectory('lib')
|
||||||
|
@ -18,7 +18,7 @@ Future<void> processPodsIfNeeded(
|
|||||||
) async {
|
) async {
|
||||||
final FlutterProject project = xcodeProject.parent;
|
final FlutterProject project = xcodeProject.parent;
|
||||||
// Ensure that the plugin list is up to date, since hasPlugins relies on it.
|
// Ensure that the plugin list is up to date, since hasPlugins relies on it.
|
||||||
await refreshPluginsList(project);
|
await refreshPluginsList(project, macOSPlatform: project.macos.existsSync());
|
||||||
if (!(hasPlugins(project) || (project.isModule && xcodeProject.podfile.existsSync()))) {
|
if (!(hasPlugins(project) || (project.isModule && xcodeProject.podfile.existsSync()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1145,11 +1145,12 @@ void _createPlatformPluginSymlinks(Directory symlinkDirectory, List<dynamic> pla
|
|||||||
/// Rewrites the `.flutter-plugins` file of [project] based on the plugin
|
/// Rewrites the `.flutter-plugins` file of [project] based on the plugin
|
||||||
/// dependencies declared in `pubspec.yaml`.
|
/// dependencies declared in `pubspec.yaml`.
|
||||||
///
|
///
|
||||||
/// If `checkProjects` is true, then plugins are only injected into directories
|
|
||||||
/// which already exist.
|
|
||||||
///
|
|
||||||
/// Assumes `pub get` has been executed since last change to `pubspec.yaml`.
|
/// Assumes `pub get` has been executed since last change to `pubspec.yaml`.
|
||||||
Future<void> refreshPluginsList(FlutterProject project, {bool checkProjects = false}) async {
|
Future<void> refreshPluginsList(
|
||||||
|
FlutterProject project, {
|
||||||
|
bool iosPlatform = false,
|
||||||
|
bool macOSPlatform = false,
|
||||||
|
}) async {
|
||||||
final List<Plugin> plugins = await findPlugins(project);
|
final List<Plugin> plugins = await findPlugins(project);
|
||||||
|
|
||||||
// TODO(franciscojma): Remove once migration is complete.
|
// TODO(franciscojma): Remove once migration is complete.
|
||||||
@ -1159,12 +1160,10 @@ Future<void> refreshPluginsList(FlutterProject project, {bool checkProjects = fa
|
|||||||
final bool changed = _writeFlutterPluginsList(project, plugins);
|
final bool changed = _writeFlutterPluginsList(project, plugins);
|
||||||
if (changed || legacyChanged) {
|
if (changed || legacyChanged) {
|
||||||
createPluginSymlinks(project, force: true);
|
createPluginSymlinks(project, force: true);
|
||||||
if (!checkProjects || project.ios.existsSync()) {
|
if (iosPlatform) {
|
||||||
globals.cocoaPods.invalidatePodInstallOutput(project.ios);
|
globals.cocoaPods.invalidatePodInstallOutput(project.ios);
|
||||||
}
|
}
|
||||||
// TODO(stuartmorgan): Potentially add checkProjects once a decision has
|
if (macOSPlatform) {
|
||||||
// made about how to handle macOS in existing projects.
|
|
||||||
if (project.macos.existsSync()) {
|
|
||||||
globals.cocoaPods.invalidatePodInstallOutput(project.macos);
|
globals.cocoaPods.invalidatePodInstallOutput(project.macos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1172,34 +1171,40 @@ Future<void> refreshPluginsList(FlutterProject project, {bool checkProjects = fa
|
|||||||
|
|
||||||
/// Injects plugins found in `pubspec.yaml` into the platform-specific projects.
|
/// Injects plugins found in `pubspec.yaml` into the platform-specific projects.
|
||||||
///
|
///
|
||||||
/// If `checkProjects` is true, then plugins are only injected into directories
|
|
||||||
/// which already exist.
|
|
||||||
///
|
|
||||||
/// Assumes [refreshPluginsList] has been called since last change to `pubspec.yaml`.
|
/// Assumes [refreshPluginsList] has been called since last change to `pubspec.yaml`.
|
||||||
Future<void> injectPlugins(FlutterProject project, {bool checkProjects = false}) async {
|
Future<void> injectPlugins(
|
||||||
|
FlutterProject project, {
|
||||||
|
bool androidPlatform = false,
|
||||||
|
bool iosPlatform = false,
|
||||||
|
bool linuxPlatform = false,
|
||||||
|
bool macOSPlatform = false,
|
||||||
|
bool windowsPlatform = false,
|
||||||
|
bool webPlatform = false,
|
||||||
|
}) async {
|
||||||
final List<Plugin> plugins = await findPlugins(project);
|
final List<Plugin> plugins = await findPlugins(project);
|
||||||
// Sort the plugins by name to keep ordering stable in generated files.
|
// Sort the plugins by name to keep ordering stable in generated files.
|
||||||
plugins.sort((Plugin left, Plugin right) => left.name.compareTo(right.name));
|
plugins.sort((Plugin left, Plugin right) => left.name.compareTo(right.name));
|
||||||
if ((checkProjects && project.android.existsSync()) || !checkProjects) {
|
if (androidPlatform) {
|
||||||
await _writeAndroidPluginRegistrant(project, plugins);
|
await _writeAndroidPluginRegistrant(project, plugins);
|
||||||
}
|
}
|
||||||
if ((checkProjects && project.ios.existsSync()) || !checkProjects) {
|
if (iosPlatform) {
|
||||||
await _writeIOSPluginRegistrant(project, plugins);
|
await _writeIOSPluginRegistrant(project, plugins);
|
||||||
}
|
}
|
||||||
// TODO(stuartmorgan): Revisit the conditions here once the plans for handling
|
if (linuxPlatform) {
|
||||||
// desktop in existing projects are in place. For now, ignore checkProjects
|
|
||||||
// on desktop and always treat it as true.
|
|
||||||
if (featureFlags.isLinuxEnabled && project.linux.existsSync()) {
|
|
||||||
await _writeLinuxPluginFiles(project, plugins);
|
await _writeLinuxPluginFiles(project, plugins);
|
||||||
}
|
}
|
||||||
if (featureFlags.isMacOSEnabled && project.macos.existsSync()) {
|
if (macOSPlatform) {
|
||||||
await _writeMacOSPluginRegistrant(project, plugins);
|
await _writeMacOSPluginRegistrant(project, plugins);
|
||||||
}
|
}
|
||||||
if (featureFlags.isWindowsEnabled && project.windows.existsSync()) {
|
if (windowsPlatform) {
|
||||||
await _writeWindowsPluginFiles(project, plugins);
|
await _writeWindowsPluginFiles(project, plugins);
|
||||||
}
|
}
|
||||||
for (final XcodeBasedProject subproject in <XcodeBasedProject>[project.ios, project.macos]) {
|
if (!project.isModule) {
|
||||||
if (!project.isModule && (!checkProjects || subproject.existsSync())) {
|
final List<XcodeBasedProject> darwinProjects = <XcodeBasedProject>[
|
||||||
|
if (iosPlatform) project.ios,
|
||||||
|
if (macOSPlatform) project.macos,
|
||||||
|
];
|
||||||
|
for (final XcodeBasedProject subproject in darwinProjects) {
|
||||||
if (plugins.isNotEmpty) {
|
if (plugins.isNotEmpty) {
|
||||||
await globals.cocoaPods.setupPodfile(subproject);
|
await globals.cocoaPods.setupPodfile(subproject);
|
||||||
}
|
}
|
||||||
@ -1210,7 +1215,7 @@ Future<void> injectPlugins(FlutterProject project, {bool checkProjects = false})
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (featureFlags.isWebEnabled && project.web.existsSync()) {
|
if (webPlatform) {
|
||||||
await _writeWebPluginRegistrant(project, plugins);
|
await _writeWebPluginRegistrant(project, plugins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,38 +229,64 @@ class FlutterProject {
|
|||||||
return manifest;
|
return manifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates project files necessary to make Gradle builds work on Android
|
/// Reapplies template files and regenerates project files and plugin
|
||||||
/// and CocoaPods+Xcode work on iOS, for app and module projects only.
|
/// registrants for app and module projects only.
|
||||||
// TODO(cyanglaz): The param `checkProjects` is confusing. We should give it a better name
|
///
|
||||||
// or add some documentation explaining what it does, or both.
|
/// Will not create project platform directories if they do not already exist.
|
||||||
// https://github.com/flutter/flutter/issues/60023
|
Future<void> regeneratePlatformSpecificTooling() async {
|
||||||
Future<void> ensureReadyForPlatformSpecificTooling({bool checkProjects = false}) async {
|
return ensureReadyForPlatformSpecificTooling(
|
||||||
|
androidPlatform: android.existsSync(),
|
||||||
|
iosPlatform: ios.existsSync(),
|
||||||
|
// TODO(stuartmorgan): Revisit the conditions here once the plans for handling
|
||||||
|
// desktop in existing projects are in place.
|
||||||
|
linuxPlatform: featureFlags.isLinuxEnabled && linux.existsSync(),
|
||||||
|
macOSPlatform: featureFlags.isMacOSEnabled && macos.existsSync(),
|
||||||
|
windowsPlatform: featureFlags.isWindowsEnabled && windows.existsSync(),
|
||||||
|
webPlatform: featureFlags.isWebEnabled && web.existsSync(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Applies template files and generates project files and plugin
|
||||||
|
/// registrants for app and module projects only for the specified platforms.
|
||||||
|
Future<void> ensureReadyForPlatformSpecificTooling({
|
||||||
|
bool androidPlatform = false,
|
||||||
|
bool iosPlatform = false,
|
||||||
|
bool linuxPlatform = false,
|
||||||
|
bool macOSPlatform = false,
|
||||||
|
bool windowsPlatform = false,
|
||||||
|
bool webPlatform = false,
|
||||||
|
}) async {
|
||||||
if (!directory.existsSync() || hasExampleApp) {
|
if (!directory.existsSync() || hasExampleApp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await refreshPluginsList(this);
|
await refreshPluginsList(this, iosPlatform: iosPlatform, macOSPlatform: macOSPlatform);
|
||||||
if ((android.existsSync() && checkProjects) || !checkProjects) {
|
if (androidPlatform) {
|
||||||
await android.ensureReadyForPlatformSpecificTooling();
|
await android.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
if ((ios.existsSync() && checkProjects) || !checkProjects) {
|
if (iosPlatform) {
|
||||||
await ios.ensureReadyForPlatformSpecificTooling();
|
await ios.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
// TODO(stuartmorgan): Revisit conditions once there is a plan for handling
|
if (linuxPlatform) {
|
||||||
// non-default platform projects. For now, always treat checkProjects as
|
|
||||||
// true for desktop.
|
|
||||||
if (featureFlags.isLinuxEnabled && linux.existsSync()) {
|
|
||||||
await linux.ensureReadyForPlatformSpecificTooling();
|
await linux.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
if (featureFlags.isMacOSEnabled && macos.existsSync()) {
|
if (macOSPlatform) {
|
||||||
await macos.ensureReadyForPlatformSpecificTooling();
|
await macos.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
if (featureFlags.isWindowsEnabled && windows.existsSync()) {
|
if (windowsPlatform) {
|
||||||
await windows.ensureReadyForPlatformSpecificTooling();
|
await windows.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
if (featureFlags.isWebEnabled && web.existsSync()) {
|
if (webPlatform) {
|
||||||
await web.ensureReadyForPlatformSpecificTooling();
|
await web.ensureReadyForPlatformSpecificTooling();
|
||||||
}
|
}
|
||||||
await injectPlugins(this, checkProjects: checkProjects);
|
await injectPlugins(
|
||||||
|
this,
|
||||||
|
androidPlatform: androidPlatform,
|
||||||
|
iosPlatform: iosPlatform,
|
||||||
|
linuxPlatform: linuxPlatform,
|
||||||
|
macOSPlatform: macOSPlatform,
|
||||||
|
windowsPlatform: windowsPlatform,
|
||||||
|
webPlatform: webPlatform,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
|
/// Returns a json encoded string containing the [appName], [version], and [buildNumber] that is used to generate version.json
|
||||||
|
@ -1013,7 +1013,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
);
|
);
|
||||||
// All done updating dependencies. Release the cache lock.
|
// All done updating dependencies. Release the cache lock.
|
||||||
Cache.releaseLock();
|
Cache.releaseLock();
|
||||||
await project.ensureReadyForPlatformSpecificTooling(checkProjects: true);
|
await project.regeneratePlatformSpecificTooling();
|
||||||
} else {
|
} else {
|
||||||
Cache.releaseLock();
|
Cache.releaseLock();
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ Future<void> buildWeb(
|
|||||||
outputDirectory.deleteSync(recursive: true);
|
outputDirectory.deleteSync(recursive: true);
|
||||||
outputDirectory.createSync(recursive: true);
|
outputDirectory.createSync(recursive: true);
|
||||||
}
|
}
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, webPlatform: true);
|
||||||
final Status status = globals.logger.startProgress('Compiling $target for the Web...');
|
final Status status = globals.logger.startProgress('Compiling $target for the Web...');
|
||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
try {
|
try {
|
||||||
|
@ -7,6 +7,7 @@ import 'dart:convert';
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:args/command_runner.dart';
|
import 'package:args/command_runner.dart';
|
||||||
|
import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
@ -662,6 +663,52 @@ void main() {
|
|||||||
expect(testLogger.statusText, isNot(contains('https://flutter.dev/go/android-project-migration')));
|
expect(testLogger.statusText, isNot(contains('https://flutter.dev/go/android-project-migration')));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('app does not include desktop or web by default', () async {
|
||||||
|
Cache.flutterRoot = '../..';
|
||||||
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
|
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
||||||
|
|
||||||
|
final CreateCommand command = CreateCommand();
|
||||||
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
|
|
||||||
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FeatureFlags: () => TestFeatureFlags(),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('plugin does not include desktop or web by default',
|
||||||
|
() async {
|
||||||
|
Cache.flutterRoot = '../..';
|
||||||
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
|
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
||||||
|
|
||||||
|
final CreateCommand command = CreateCommand();
|
||||||
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
|
await runner.run(
|
||||||
|
<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
|
|
||||||
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('linux'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('macos'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('windows'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('web'),
|
||||||
|
isNot(exists));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FeatureFlags: () => TestFeatureFlags(),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingContext('app supports Linux if requested', () async {
|
testUsingContext('app supports Linux if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
@ -670,28 +717,24 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>[
|
||||||
|
'create',
|
||||||
|
'--no-pub',
|
||||||
|
'--platforms=linux',
|
||||||
|
projectDir.path,
|
||||||
|
]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('linux').childFile('CMakeLists.txt').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('linux').childFile('CMakeLists.txt'), exists);
|
||||||
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('ios'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('app does not include Linux by default', () async {
|
|
||||||
Cache.flutterRoot = '../..';
|
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
|
||||||
|
|
||||||
final CreateCommand command = CreateCommand();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
|
||||||
|
|
||||||
expect(projectDir.childDirectory('linux').childFile('CMakeLists.txt').existsSync(), false);
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('plugin supports Linux if requested', () async {
|
testUsingContext('plugin supports Linux if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
@ -702,17 +745,32 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=linux', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=linux', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('linux').childFile('CMakeLists.txt').existsSync(), true);
|
expect(
|
||||||
expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), true);
|
projectDir.childDirectory('linux').childFile('CMakeLists.txt'), exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
expect(
|
||||||
'linux',
|
projectDir.childDirectory('example').childDirectory('linux'), exists);
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
expect(projectDir.childDirectory('example').childDirectory('android'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('ios'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('windows'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('macos'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('web'),
|
||||||
|
isNot(exists));
|
||||||
|
validatePubspecForPlugin(
|
||||||
|
projectDir: projectDir.absolute.path,
|
||||||
|
expectedPlatforms: const <String>[
|
||||||
|
'linux',
|
||||||
|
],
|
||||||
|
pluginClass: 'FlutterProjectPlugin',
|
||||||
unexpectedPlatforms: <String>['some_platform']);
|
unexpectedPlatforms: <String>['some_platform']);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('plugin does not include Linux by default', () async {
|
testUsingContext('app supports macOS if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
||||||
@ -720,27 +778,23 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>[
|
||||||
|
'create',
|
||||||
|
'--no-pub',
|
||||||
|
'--platforms=macos',
|
||||||
|
projectDir.path,
|
||||||
|
]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('linux').childFile('CMakeLists.txt').existsSync(), false);
|
expect(
|
||||||
expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), false);
|
projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace'),
|
||||||
|
exists);
|
||||||
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('ios'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('app does not include macOS by default', () async {
|
|
||||||
Cache.flutterRoot = '../..';
|
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
|
||||||
|
|
||||||
final CreateCommand command = CreateCommand();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
|
||||||
|
|
||||||
expect(projectDir.childDirectory('macos').childDirectory('Runner.xcworkspace').existsSync(), false);
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('plugin supports macOS if requested', () async {
|
testUsingContext('plugin supports macOS if requested', () async {
|
||||||
@ -753,8 +807,20 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), true);
|
expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec'),
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), true);
|
exists);
|
||||||
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('macos'), exists);
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('linux'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('android'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('ios'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('windows'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('web'),
|
||||||
|
isNot(exists));
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'macos',
|
'macos',
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
@ -763,22 +829,6 @@ void main() {
|
|||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('plugin does not include macOS by default', () async {
|
|
||||||
Cache.flutterRoot = '../..';
|
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
|
||||||
|
|
||||||
final CreateCommand command = CreateCommand();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
|
||||||
|
|
||||||
expect(projectDir.childDirectory('macos').childFile('flutter_project.podspec').existsSync(), false);
|
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), false);
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('app supports Windows if requested', () async {
|
testUsingContext('app supports Windows if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
@ -787,9 +837,20 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>[
|
||||||
|
'create',
|
||||||
|
'--no-pub',
|
||||||
|
'--platforms=windows',
|
||||||
|
projectDir.path,
|
||||||
|
]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt').existsSync(), true);
|
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt'),
|
||||||
|
exists);
|
||||||
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('ios'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
@ -805,7 +866,7 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--org', 'com.foo.bar', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--org', 'com.foo.bar', projectDir.path]);
|
||||||
|
|
||||||
final File resourceFile = projectDir.childDirectory('windows').childDirectory('runner').childFile('Runner.rc');
|
final File resourceFile = projectDir.childDirectory('windows').childDirectory('runner').childFile('Runner.rc');
|
||||||
expect(resourceFile.existsSync(), true);
|
expect(resourceFile, exists);
|
||||||
final String contents = resourceFile.readAsStringSync();
|
final String contents = resourceFile.readAsStringSync();
|
||||||
expect(contents, contains('"CompanyName", "com.foo.bar"'));
|
expect(contents, contains('"CompanyName", "com.foo.bar"'));
|
||||||
expect(contents, contains('"ProductName", "flutter_project"'));
|
expect(contents, contains('"ProductName", "flutter_project"'));
|
||||||
@ -813,21 +874,6 @@ void main() {
|
|||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('app does not include Windows by default', () async {
|
|
||||||
Cache.flutterRoot = '../..';
|
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
|
||||||
|
|
||||||
final CreateCommand command = CreateCommand();
|
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
|
||||||
|
|
||||||
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt').existsSync(), false);
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('plugin supports Windows if requested', () async {
|
testUsingContext('plugin supports Windows if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
@ -838,8 +884,31 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt').existsSync(), true);
|
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt'),
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), true);
|
exists);
|
||||||
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('windows'), exists);
|
||||||
|
expect(
|
||||||
|
projectDir
|
||||||
|
.childDirectory('example')
|
||||||
|
.childDirectory('android'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('ios'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(
|
||||||
|
projectDir
|
||||||
|
.childDirectory('example')
|
||||||
|
.childDirectory('linux'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(
|
||||||
|
projectDir
|
||||||
|
.childDirectory('example')
|
||||||
|
.childDirectory('macos'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('web'),
|
||||||
|
isNot(exists));
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'windows'
|
'windows'
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
@ -848,7 +917,7 @@ void main() {
|
|||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('plugin does not include Windows by default', () async {
|
testUsingContext('app supports web if requested', () async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
when(mockFlutterVersion.frameworkRevision).thenReturn(frameworkRevision);
|
||||||
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
|
||||||
@ -856,12 +925,23 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>[
|
||||||
|
'create',
|
||||||
|
'--no-pub',
|
||||||
|
'--platforms=web',
|
||||||
|
projectDir.path,
|
||||||
|
]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('windows').childFile('CMakeLists.txt').existsSync(), false);
|
expect(
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), false);
|
projectDir.childDirectory('web').childFile('index.html'),
|
||||||
|
exists);
|
||||||
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('ios'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: false),
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('plugin uses new platform schema', () async {
|
testUsingContext('plugin uses new platform schema', () async {
|
||||||
@ -1516,7 +1596,7 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(args);
|
await runner.run(args);
|
||||||
final File expectedFile = globals.fs.file(outputFile);
|
final File expectedFile = globals.fs.file(outputFile);
|
||||||
expect(expectedFile.existsSync(), isTrue);
|
expect(expectedFile, exists);
|
||||||
expect(expectedFile.readAsStringSync(), equals(samplesIndexJson));
|
expect(expectedFile.readAsStringSync(), equals(samplesIndexJson));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
HttpClientFactory: () =>
|
HttpClientFactory: () =>
|
||||||
@ -1555,7 +1635,7 @@ void main() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
await expectLater(runner.run(args), throwsToolExit(exitCode: 2, message: 'Failed to write samples'));
|
await expectLater(runner.run(args), throwsToolExit(exitCode: 2, message: 'Failed to write samples'));
|
||||||
expect(globals.fs.file(outputFile).existsSync(), isFalse);
|
expect(globals.fs.file(outputFile), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
HttpClientFactory: () =>
|
HttpClientFactory: () =>
|
||||||
() => MockHttpClient(404, result: 'not found'),
|
() => MockHttpClient(404, result: 'not found'),
|
||||||
@ -1573,21 +1653,27 @@ void main() {
|
|||||||
|
|
||||||
// TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release
|
// TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release
|
||||||
// https://github.com/flutter/flutter/issues/59787
|
// https://github.com/flutter/flutter/issues/59787
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), false);
|
expect(projectDir.childDirectory('ios'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('web').existsSync(), false);
|
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('linux').existsSync(), false);
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('windows').existsSync(), false);
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('macos').existsSync(), false);
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
|
|
||||||
// TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release
|
// TODO(cyanglaz): no-op iOS folder should be removed after 1.20.0 release
|
||||||
// https://github.com/flutter/flutter/issues/59787
|
// https://github.com/flutter/flutter/issues/59787
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('ios'),
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), false);
|
isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('web').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('android'),
|
||||||
expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), false);
|
isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('web'),
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), false);
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('linux'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('windows'),
|
||||||
|
isNot(exists));
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('macos'),
|
||||||
|
isNot(exists));
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: <String>[
|
||||||
'some_platform'
|
'some_platform'
|
||||||
], pluginClass: 'somePluginClass',
|
], pluginClass: 'somePluginClass',
|
||||||
@ -1607,8 +1693,8 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: <String>[
|
||||||
'ios',
|
'ios',
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
@ -1627,8 +1713,9 @@ void main() {
|
|||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'android'
|
'android'
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
@ -1647,7 +1734,9 @@ void main() {
|
|||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('lib').childFile('flutter_project_web.dart').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('lib').childFile('flutter_project_web.dart'),
|
||||||
|
exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'web'
|
'web'
|
||||||
], pluginClass: 'FlutterProjectWeb',
|
], pluginClass: 'FlutterProjectWeb',
|
||||||
@ -1667,7 +1756,9 @@ void main() {
|
|||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('lib').childFile('flutter_project_web.dart').existsSync(), false);
|
expect(
|
||||||
|
projectDir.childDirectory('lib').childFile('flutter_project_web.dart'),
|
||||||
|
isNot(exists));
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'some_platform'
|
'some_platform'
|
||||||
], pluginClass: 'somePluginClass',
|
], pluginClass: 'somePluginClass',
|
||||||
@ -1686,8 +1777,8 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
||||||
});
|
});
|
||||||
@ -1702,8 +1793,9 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: false),
|
||||||
});
|
});
|
||||||
@ -1718,8 +1810,9 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=linux', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=linux', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('linux').existsSync(), true);
|
expect(projectDir.childDirectory('linux'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('linux'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1734,8 +1827,9 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('macos').existsSync(), true);
|
expect(projectDir.childDirectory('macos'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('macos'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1750,8 +1844,9 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('windows').existsSync(), true);
|
expect(projectDir.childDirectory('windows'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('windows'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1766,7 +1861,9 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=web', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('lib').childFile('flutter_project_web.dart').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('lib').childFile('flutter_project_web.dart'),
|
||||||
|
exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1779,18 +1876,19 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'ios',
|
'ios',
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
unexpectedPlatforms: <String>['some_platform']);
|
unexpectedPlatforms: <String>['some_platform']);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=macos', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('macos').existsSync(), true);
|
expect(projectDir.childDirectory('macos'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), true);
|
expect(
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
projectDir.childDirectory('example').childDirectory('macos'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1803,13 +1901,14 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios,android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios,android', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
expect(projectDir.childDirectory('ios').existsSync(), true);
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('ios').existsSync(), true);
|
expect(projectDir.childDirectory('ios'), exists);
|
||||||
|
expect(projectDir.childDirectory('example').childDirectory('ios'), exists);
|
||||||
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
validatePubspecForPlugin(projectDir: projectDir.absolute.path, expectedPlatforms: const <String>[
|
||||||
'ios', 'android'
|
'ios', 'android'
|
||||||
], pluginClass: 'FlutterProjectPlugin',
|
], pluginClass: 'FlutterProjectPlugin',
|
||||||
@ -1849,18 +1948,21 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
|
|
||||||
globals.fs.file(globals.fs.path.join(projectDir.path, 'android')).deleteSync(recursive: true);
|
globals.fs.file(globals.fs.path.join(projectDir.path, 'android')).deleteSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join(projectDir.path, 'example/android')).deleteSync(recursive: true);
|
globals.fs.file(globals.fs.path.join(projectDir.path, 'example/android')).deleteSync(recursive: true);
|
||||||
expect(projectDir.childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('android'),
|
||||||
|
isNot(exists));
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('create a plugin with android, delete then re-create folders while also adding windows', () async {
|
testUsingContext('create a plugin with android, delete then re-create folders while also adding windows', () async {
|
||||||
@ -1871,20 +1973,24 @@ void main() {
|
|||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
|
|
||||||
globals.fs.file(globals.fs.path.join(projectDir.path, 'android')).deleteSync(recursive: true);
|
globals.fs.file(globals.fs.path.join(projectDir.path, 'android')).deleteSync(recursive: true);
|
||||||
globals.fs.file(globals.fs.path.join(projectDir.path, 'example/android')).deleteSync(recursive: true);
|
globals.fs.file(globals.fs.path.join(projectDir.path, 'example/android')).deleteSync(recursive: true);
|
||||||
expect(projectDir.childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('android'),
|
||||||
|
isNot(exists));
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=windows', projectDir.path]);
|
||||||
|
|
||||||
expect(projectDir.childDirectory('android').existsSync(), true);
|
expect(projectDir.childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), true);
|
expect(
|
||||||
expect(projectDir.childDirectory('windows').existsSync(), true);
|
projectDir.childDirectory('example').childDirectory('android'), exists);
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), true);
|
expect(projectDir.childDirectory('windows'), exists);
|
||||||
|
expect(
|
||||||
|
projectDir.childDirectory('example').childDirectory('windows'), exists);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1899,8 +2005,8 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=ios', projectDir.path]);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('android'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('android').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('android'), isNot(exists));
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('flutter create . on and existing plugin does not add windows folder even feature is enabled', () async {
|
testUsingContext('flutter create . on and existing plugin does not add windows folder even feature is enabled', () async {
|
||||||
@ -1913,8 +2019,8 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('windows').existsSync(), false);
|
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('windows').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('windows'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWindowsEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1929,8 +2035,8 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('linux').existsSync(), false);
|
expect(projectDir.childDirectory('linux'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('linux').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('linux'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1945,7 +2051,7 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('lib').childFile('flutter_project_web.dart').existsSync(), false);
|
expect(projectDir.childDirectory('lib').childFile('flutter_project_web.dart'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isWebEnabled: true),
|
||||||
});
|
});
|
||||||
@ -1960,8 +2066,8 @@ void main() {
|
|||||||
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', '--template=plugin', '--platforms=android', projectDir.path]);
|
||||||
|
|
||||||
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
await runner.run(<String>['create', '--no-pub', projectDir.path]);
|
||||||
expect(projectDir.childDirectory('macos').existsSync(), false);
|
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||||
expect(projectDir.childDirectory('example').childDirectory('macos').existsSync(), false);
|
expect(projectDir.childDirectory('example').childDirectory('macos'), isNot(exists));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
|
||||||
});
|
});
|
||||||
@ -2048,8 +2154,8 @@ void main() {
|
|||||||
.childFile(headerName);
|
.childFile(headerName);
|
||||||
final File implFile = platformDir.childFile('$classFilenameBase.cc');
|
final File implFile = platformDir.childFile('$classFilenameBase.cc');
|
||||||
// Ensure that the files have the right names.
|
// Ensure that the files have the right names.
|
||||||
expect(headerFile.existsSync(), true);
|
expect(headerFile, exists);
|
||||||
expect(implFile.existsSync(), true);
|
expect(implFile, exists);
|
||||||
// Ensure that the include is correct.
|
// Ensure that the include is correct.
|
||||||
expect(implFile.readAsStringSync(), contains(headerName));
|
expect(implFile.readAsStringSync(), contains(headerName));
|
||||||
// Ensure that the CMake file has the right target and source values.
|
// Ensure that the CMake file has the right target and source values.
|
||||||
@ -2081,8 +2187,8 @@ void main() {
|
|||||||
.childFile(headerName);
|
.childFile(headerName);
|
||||||
final File implFile = platformDir.childFile('$classFilenameBase.cpp');
|
final File implFile = platformDir.childFile('$classFilenameBase.cpp');
|
||||||
// Ensure that the files have the right names.
|
// Ensure that the files have the right names.
|
||||||
expect(headerFile.existsSync(), true);
|
expect(headerFile, exists);
|
||||||
expect(implFile.existsSync(), true);
|
expect(implFile, exists);
|
||||||
// Ensure that the include is correct.
|
// Ensure that the include is correct.
|
||||||
expect(implFile.readAsStringSync(), contains(headerName));
|
expect(implFile.readAsStringSync(), contains(headerName));
|
||||||
// Ensure that the plugin target name matches the post-processed version.
|
// Ensure that the plugin target name matches the post-processed version.
|
||||||
@ -2116,8 +2222,8 @@ void main() {
|
|||||||
.childFile(headerName);
|
.childFile(headerName);
|
||||||
final File implFile = platformDir.childFile('$classFilenameBase.cc');
|
final File implFile = platformDir.childFile('$classFilenameBase.cc');
|
||||||
// Ensure that the files have the right names.
|
// Ensure that the files have the right names.
|
||||||
expect(headerFile.existsSync(), true);
|
expect(headerFile, exists);
|
||||||
expect(implFile.existsSync(), true);
|
expect(implFile, exists);
|
||||||
// Ensure that the include is correct.
|
// Ensure that the include is correct.
|
||||||
expect(implFile.readAsStringSync(), contains(headerName));
|
expect(implFile.readAsStringSync(), contains(headerName));
|
||||||
// Ensure that the CMake file has the right target and source values.
|
// Ensure that the CMake file has the right target and source values.
|
||||||
@ -2154,8 +2260,8 @@ void main() {
|
|||||||
.childFile(headerName);
|
.childFile(headerName);
|
||||||
final File implFile = platformDir.childFile('$classFilenameBase.cpp');
|
final File implFile = platformDir.childFile('$classFilenameBase.cpp');
|
||||||
// Ensure that the files have the right names.
|
// Ensure that the files have the right names.
|
||||||
expect(headerFile.existsSync(), true);
|
expect(headerFile, exists);
|
||||||
expect(implFile.existsSync(), true);
|
expect(implFile, exists);
|
||||||
// Ensure that the include is correct.
|
// Ensure that the include is correct.
|
||||||
expect(implFile.readAsStringSync(), contains(headerName));
|
expect(implFile.readAsStringSync(), contains(headerName));
|
||||||
// Ensure that the CMake file has the right target and source values.
|
// Ensure that the CMake file has the right target and source values.
|
||||||
|
@ -301,7 +301,7 @@ void main() {
|
|||||||
..writeAsStringSync('Existing release config');
|
..writeAsStringSync('Existing release config');
|
||||||
|
|
||||||
final FlutterProject project = FlutterProject.fromPath('project');
|
final FlutterProject project = FlutterProject.fromPath('project');
|
||||||
await injectPlugins(project, checkProjects: true);
|
await injectPlugins(project, iosPlatform: true);
|
||||||
|
|
||||||
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
|
final String debugContents = projectUnderTest.ios.xcodeConfigFor('Debug').readAsStringSync();
|
||||||
expect(debugContents, contains(
|
expect(debugContents, contains(
|
||||||
|
@ -514,7 +514,7 @@ dependencies:
|
|||||||
when(iosProject.existsSync()).thenReturn(true);
|
when(iosProject.existsSync()).thenReturn(true);
|
||||||
when(macosProject.existsSync()).thenReturn(true);
|
when(macosProject.existsSync()).thenReturn(true);
|
||||||
|
|
||||||
await refreshPluginsList(flutterProject);
|
await refreshPluginsList(flutterProject, iosPlatform: true, macOSPlatform: true);
|
||||||
expect(iosProject.podManifestLock.existsSync(), false);
|
expect(iosProject.podManifestLock.existsSync(), false);
|
||||||
expect(macosProject.podManifestLock.existsSync(), false);
|
expect(macosProject.podManifestLock.existsSync(), false);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -533,7 +533,7 @@ dependencies:
|
|||||||
// Since there was no plugins list, the lock files will be invalidated.
|
// Since there was no plugins list, the lock files will be invalidated.
|
||||||
// The second call is where the plugins list is compared to the existing one, and if there is no change,
|
// The second call is where the plugins list is compared to the existing one, and if there is no change,
|
||||||
// the podfiles shouldn't be invalidated.
|
// the podfiles shouldn't be invalidated.
|
||||||
await refreshPluginsList(flutterProject);
|
await refreshPluginsList(flutterProject, iosPlatform: true, macOSPlatform: true);
|
||||||
simulatePodInstallRun(iosProject);
|
simulatePodInstallRun(iosProject);
|
||||||
simulatePodInstallRun(macosProject);
|
simulatePodInstallRun(macosProject);
|
||||||
|
|
||||||
@ -549,16 +549,9 @@ dependencies:
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('injectPlugins', () {
|
group('injectPlugins', () {
|
||||||
MockFeatureFlags featureFlags;
|
|
||||||
MockXcodeProjectInterpreter xcodeProjectInterpreter;
|
MockXcodeProjectInterpreter xcodeProjectInterpreter;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
featureFlags = MockFeatureFlags();
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(false);
|
|
||||||
when(featureFlags.isMacOSEnabled).thenReturn(false);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(false);
|
|
||||||
when(featureFlags.isWebEnabled).thenReturn(false);
|
|
||||||
|
|
||||||
xcodeProjectInterpreter = MockXcodeProjectInterpreter();
|
xcodeProjectInterpreter = MockXcodeProjectInterpreter();
|
||||||
when(xcodeProjectInterpreter.isInstalled).thenReturn(false);
|
when(xcodeProjectInterpreter.isInstalled).thenReturn(false);
|
||||||
});
|
});
|
||||||
@ -567,7 +560,7 @@ dependencies:
|
|||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v1);
|
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v1);
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -580,14 +573,13 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Registrant uses new embedding if app uses new embedding', () async {
|
testUsingContext('Registrant uses new embedding if app uses new embedding', () async {
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v2);
|
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v2);
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -600,7 +592,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Registrant uses shim for plugins using old embedding if app uses new embedding', () async {
|
testUsingContext('Registrant uses shim for plugins using old embedding if app uses new embedding', () async {
|
||||||
@ -611,7 +602,7 @@ dependencies:
|
|||||||
createNewKotlinPlugin2();
|
createNewKotlinPlugin2();
|
||||||
createOldJavaPlugin('plugin3');
|
createOldJavaPlugin('plugin3');
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -629,7 +620,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -641,7 +631,7 @@ dependencies:
|
|||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() async {
|
() async {
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
},
|
},
|
||||||
throwsToolExit(
|
throwsToolExit(
|
||||||
message: 'The plugin `plugin1` requires your app to be migrated to the Android embedding v2. '
|
message: 'The plugin `plugin1` requires your app to be migrated to the Android embedding v2. '
|
||||||
@ -651,7 +641,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -664,7 +653,7 @@ dependencies:
|
|||||||
|
|
||||||
await expectLater(
|
await expectLater(
|
||||||
() async {
|
() async {
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
},
|
},
|
||||||
throwsToolExit(
|
throwsToolExit(
|
||||||
message: "The plugin `plugin1` doesn't have a main class defined in "
|
message: "The plugin `plugin1` doesn't have a main class defined in "
|
||||||
@ -678,7 +667,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -688,7 +676,7 @@ dependencies:
|
|||||||
|
|
||||||
createDualSupportJavaPlugin4();
|
createDualSupportJavaPlugin4();
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -702,7 +690,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -712,7 +699,7 @@ dependencies:
|
|||||||
|
|
||||||
createDualSupportJavaPlugin4();
|
createDualSupportJavaPlugin4();
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -726,7 +713,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -734,7 +720,7 @@ dependencies:
|
|||||||
when(flutterProject.isModule).thenReturn(true);
|
when(flutterProject.isModule).thenReturn(true);
|
||||||
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v2);
|
when(androidProject.getEmbeddingVersion()).thenReturn(AndroidEmbeddingVersion.v2);
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -747,7 +733,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Module using old plugin shows warning', () async {
|
testUsingContext('Module using old plugin shows warning', () async {
|
||||||
@ -756,7 +741,7 @@ dependencies:
|
|||||||
|
|
||||||
createOldJavaPlugin('plugin3');
|
createOldJavaPlugin('plugin3');
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -767,7 +752,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -777,7 +761,7 @@ dependencies:
|
|||||||
|
|
||||||
createNewJavaPlugin1();
|
createNewJavaPlugin1();
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -789,7 +773,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -799,7 +782,7 @@ dependencies:
|
|||||||
|
|
||||||
createDualSupportJavaPlugin4();
|
createDualSupportJavaPlugin4();
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -811,7 +794,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -822,7 +804,7 @@ dependencies:
|
|||||||
createOldJavaPlugin('plugin3');
|
createOldJavaPlugin('plugin3');
|
||||||
createOldJavaPlugin('plugin4');
|
createOldJavaPlugin('plugin4');
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
.childDirectory(fs.path.join('android', 'app', 'src', 'main', 'java', 'io', 'flutter', 'plugins'))
|
||||||
@ -836,7 +818,6 @@ dependencies:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
XcodeProjectInterpreter: () => xcodeProjectInterpreter,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -846,7 +827,7 @@ dependencies:
|
|||||||
final File manifest = fs.file('AndroidManifest.xml');
|
final File manifest = fs.file('AndroidManifest.xml');
|
||||||
when(androidProject.appManifestFile).thenReturn(manifest);
|
when(androidProject.appManifestFile).thenReturn(manifest);
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, androidPlatform: true);
|
||||||
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
@ -855,9 +836,6 @@ dependencies:
|
|||||||
|
|
||||||
testUsingContext("Registrant for web doesn't escape slashes in imports", () async {
|
testUsingContext("Registrant for web doesn't escape slashes in imports", () async {
|
||||||
when(flutterProject.isModule).thenReturn(true);
|
when(flutterProject.isModule).thenReturn(true);
|
||||||
when(featureFlags.isWebEnabled).thenReturn(true);
|
|
||||||
when(webProject.existsSync()).thenReturn(true);
|
|
||||||
|
|
||||||
final Directory webPluginWithNestedFile =
|
final Directory webPluginWithNestedFile =
|
||||||
fs.systemTempDirectory.createTempSync('web_plugin_with_nested');
|
fs.systemTempDirectory.createTempSync('web_plugin_with_nested');
|
||||||
webPluginWithNestedFile.childFile('pubspec.yaml').writeAsStringSync('''
|
webPluginWithNestedFile.childFile('pubspec.yaml').writeAsStringSync('''
|
||||||
@ -880,7 +858,7 @@ dependencies:
|
|||||||
web_plugin_with_nested:${webPluginWithNestedFile.childDirectory('lib').uri.toString()}
|
web_plugin_with_nested:${webPluginWithNestedFile.childDirectory('lib').uri.toString()}
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject);
|
await injectPlugins(flutterProject, webPlatform: true);
|
||||||
|
|
||||||
final File registrant = flutterProject.directory
|
final File registrant = flutterProject.directory
|
||||||
.childDirectory('lib')
|
.childDirectory('lib')
|
||||||
@ -891,12 +869,9 @@ web_plugin_with_nested:${webPluginWithNestedFile.childDirectory('lib').uri.toStr
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated macos registrant, but does not include Dart-only plugins', () async {
|
testUsingContext('Injecting creates generated macos registrant, but does not include Dart-only plugins', () async {
|
||||||
when(macosProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isMacOSEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(true);
|
when(flutterProject.isModule).thenReturn(true);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -908,7 +883,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, macOSPlatform: true);
|
||||||
|
|
||||||
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
||||||
|
|
||||||
@ -917,12 +892,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on macOS', () async {
|
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on macOS', () async {
|
||||||
when(macosProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isMacOSEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(true);
|
when(flutterProject.isModule).thenReturn(true);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -935,7 +907,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, macOSPlatform: true);
|
||||||
|
|
||||||
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
||||||
|
|
||||||
@ -945,12 +917,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Invalid yaml does not crash plugin lookup.', () async {
|
testUsingContext('Invalid yaml does not crash plugin lookup.', () async {
|
||||||
when(macosProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isMacOSEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(true);
|
when(flutterProject.isModule).thenReturn(true);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -958,7 +927,7 @@ flutter:
|
|||||||
"aws ... \"Branch\": $BITBUCKET_BRANCH, \"Date\": $(date +"%m-%d-%y"), \"Time\": $(date +"%T")}\"
|
"aws ... \"Branch\": $BITBUCKET_BRANCH, \"Date\": $(date +"%m-%d-%y"), \"Time\": $(date +"%T")}\"
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, macOSPlatform: true);
|
||||||
|
|
||||||
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
final File registrantFile = macosProject.managedDirectory.childFile('GeneratedPluginRegistrant.swift');
|
||||||
|
|
||||||
@ -966,16 +935,13 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated Linux registrant', () async {
|
testUsingContext('Injecting creates generated Linux registrant', () async {
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
createFakePlugin(fs);
|
createFakePlugin(fs);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true);
|
||||||
|
|
||||||
final File registrantHeader = linuxProject.managedDirectory.childFile('generated_plugin_registrant.h');
|
final File registrantHeader = linuxProject.managedDirectory.childFile('generated_plugin_registrant.h');
|
||||||
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
@ -986,12 +952,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated Linux registrant, but does not include Dart-only plugins', () async {
|
testUsingContext('Injecting creates generated Linux registrant, but does not include Dart-only plugins', () async {
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -1003,7 +966,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true);
|
||||||
|
|
||||||
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
|
|
||||||
@ -1013,12 +976,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on Linux', () async {
|
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on Linux', () async {
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -1031,7 +991,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true);
|
||||||
|
|
||||||
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
|
|
||||||
@ -1041,16 +1001,13 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated Linux plugin Cmake file', () async {
|
testUsingContext('Injecting creates generated Linux plugin Cmake file', () async {
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
createFakePlugin(fs);
|
createFakePlugin(fs);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true);
|
||||||
|
|
||||||
final File pluginMakefile = linuxProject.generatedPluginCmakeFile;
|
final File pluginMakefile = linuxProject.generatedPluginCmakeFile;
|
||||||
|
|
||||||
@ -1063,12 +1020,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Generated Linux plugin files sorts by plugin name', () async {
|
testUsingContext('Generated Linux plugin files sorts by plugin name', () async {
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
createFakePlugins(fs, <String>[
|
createFakePlugins(fs, <String>[
|
||||||
'plugin_d',
|
'plugin_d',
|
||||||
@ -1077,7 +1031,7 @@ flutter:
|
|||||||
'/local_plugins/plugin_b'
|
'/local_plugins/plugin_b'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true);
|
||||||
|
|
||||||
final File pluginCmakeFile = linuxProject.generatedPluginCmakeFile;
|
final File pluginCmakeFile = linuxProject.generatedPluginCmakeFile;
|
||||||
final File pluginRegistrant = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File pluginRegistrant = linuxProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
@ -1090,16 +1044,13 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated Windows registrant', () async {
|
testUsingContext('Injecting creates generated Windows registrant', () async {
|
||||||
when(windowsProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
createFakePlugin(fs);
|
createFakePlugin(fs);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, windowsPlatform: true);
|
||||||
|
|
||||||
final File registrantHeader = windowsProject.managedDirectory.childFile('generated_plugin_registrant.h');
|
final File registrantHeader = windowsProject.managedDirectory.childFile('generated_plugin_registrant.h');
|
||||||
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
@ -1110,12 +1061,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Injecting creates generated Windows registrant, but does not include Dart-only plugins', () async {
|
testUsingContext('Injecting creates generated Windows registrant, but does not include Dart-only plugins', () async {
|
||||||
when(windowsProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -1127,7 +1075,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, windowsPlatform: true);
|
||||||
|
|
||||||
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
|
|
||||||
@ -1136,12 +1084,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on Windows', () async {
|
testUsingContext('pluginClass: none doesn\'t trigger registrant entry on Windows', () async {
|
||||||
when(windowsProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
// Create a plugin without a pluginClass.
|
// Create a plugin without a pluginClass.
|
||||||
final Directory pluginDirectory = createFakePlugin(fs);
|
final Directory pluginDirectory = createFakePlugin(fs);
|
||||||
@ -1154,7 +1099,7 @@ flutter:
|
|||||||
dartPluginClass: SomePlugin
|
dartPluginClass: SomePlugin
|
||||||
''');
|
''');
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, windowsPlatform: true);
|
||||||
|
|
||||||
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File registrantImpl = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
|
|
||||||
@ -1164,12 +1109,9 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Generated Windows plugin files sorts by plugin name', () async {
|
testUsingContext('Generated Windows plugin files sorts by plugin name', () async {
|
||||||
when(windowsProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
createFakePlugins(fs, <String>[
|
createFakePlugins(fs, <String>[
|
||||||
'plugin_d',
|
'plugin_d',
|
||||||
@ -1178,7 +1120,7 @@ flutter:
|
|||||||
'/local_plugins/plugin_b'
|
'/local_plugins/plugin_b'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, windowsPlatform: true);
|
||||||
|
|
||||||
final File pluginCmakeFile = windowsProject.generatedPluginCmakeFile;
|
final File pluginCmakeFile = windowsProject.generatedPluginCmakeFile;
|
||||||
final File pluginRegistrant = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
final File pluginRegistrant = windowsProject.managedDirectory.childFile('generated_plugin_registrant.cc');
|
||||||
@ -1191,7 +1133,6 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Generated plugin CMake files always use posix-style paths', () async {
|
testUsingContext('Generated plugin CMake files always use posix-style paths', () async {
|
||||||
@ -1199,13 +1140,9 @@ flutter:
|
|||||||
setUpProject(fsWindows);
|
setUpProject(fsWindows);
|
||||||
createFakePlugin(fsWindows);
|
createFakePlugin(fsWindows);
|
||||||
|
|
||||||
when(linuxProject.existsSync()).thenReturn(true);
|
|
||||||
when(windowsProject.existsSync()).thenReturn(true);
|
|
||||||
when(featureFlags.isLinuxEnabled).thenReturn(true);
|
|
||||||
when(featureFlags.isWindowsEnabled).thenReturn(true);
|
|
||||||
when(flutterProject.isModule).thenReturn(false);
|
when(flutterProject.isModule).thenReturn(false);
|
||||||
|
|
||||||
await injectPlugins(flutterProject, checkProjects: true);
|
await injectPlugins(flutterProject, linuxPlatform: true, windowsPlatform: true);
|
||||||
|
|
||||||
for (final CmakeBasedProject project in <CmakeBasedProject>[linuxProject, windowsProject]) {
|
for (final CmakeBasedProject project in <CmakeBasedProject>[linuxProject, windowsProject]) {
|
||||||
final File pluginCmakefile = project.generatedPluginCmakeFile;
|
final File pluginCmakefile = project.generatedPluginCmakeFile;
|
||||||
@ -1217,7 +1154,6 @@ flutter:
|
|||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fsWindows,
|
FileSystem: () => fsWindows,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FeatureFlags: () => featureFlags,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,12 +116,12 @@ void main() {
|
|||||||
FlutterManifest.empty(logger: logger),
|
FlutterManifest.empty(logger: logger),
|
||||||
FlutterManifest.empty(logger: logger),
|
FlutterManifest.empty(logger: logger),
|
||||||
);
|
);
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectNotExists(project.directory);
|
expectNotExists(project.directory);
|
||||||
});
|
});
|
||||||
_testInMemory('does nothing in plugin or package root project', () async {
|
_testInMemory('does nothing in plugin or package root project', () async {
|
||||||
final FlutterProject project = await aPluginProject();
|
final FlutterProject project = await aPluginProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectNotExists(project.ios.hostAppRoot.childDirectory('Runner').childFile('GeneratedPluginRegistrant.h'));
|
expectNotExists(project.ios.hostAppRoot.childDirectory('Runner').childFile('GeneratedPluginRegistrant.h'));
|
||||||
expectNotExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('app')));
|
expectNotExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('app')));
|
||||||
expectNotExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig'));
|
expectNotExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig'));
|
||||||
@ -129,22 +129,22 @@ void main() {
|
|||||||
});
|
});
|
||||||
_testInMemory('injects plugins for iOS', () async {
|
_testInMemory('injects plugins for iOS', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.ios.hostAppRoot.childDirectory('Runner').childFile('GeneratedPluginRegistrant.h'));
|
expectExists(project.ios.hostAppRoot.childDirectory('Runner').childFile('GeneratedPluginRegistrant.h'));
|
||||||
});
|
});
|
||||||
_testInMemory('generates Xcode configuration for iOS', () async {
|
_testInMemory('generates Xcode configuration for iOS', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig'));
|
expectExists(project.ios.hostAppRoot.childDirectory('Flutter').childFile('Generated.xcconfig'));
|
||||||
});
|
});
|
||||||
_testInMemory('injects plugins for Android', () async {
|
_testInMemory('injects plugins for Android', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('app')));
|
expectExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('app')));
|
||||||
});
|
});
|
||||||
_testInMemory('updates local properties for Android', () async {
|
_testInMemory('updates local properties for Android', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
||||||
});
|
});
|
||||||
_testInMemory('Android project not on v2 embedding shows a warning', () async {
|
_testInMemory('Android project not on v2 embedding shows a warning', () async {
|
||||||
@ -153,18 +153,18 @@ void main() {
|
|||||||
// v1 embedding, as opposed to having <meta-data
|
// v1 embedding, as opposed to having <meta-data
|
||||||
// android:name="flutterEmbedding" android:value="2" />.
|
// android:name="flutterEmbedding" android:value="2" />.
|
||||||
|
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expect(testLogger.statusText, contains('https://flutter.dev/go/android-project-migration'));
|
expect(testLogger.statusText, contains('https://flutter.dev/go/android-project-migration'));
|
||||||
});
|
});
|
||||||
_testInMemory('updates local properties for Android', () async {
|
_testInMemory('updates local properties for Android', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
||||||
});
|
});
|
||||||
testUsingContext('injects plugins for macOS', () async {
|
testUsingContext('injects plugins for macOS', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
project.macos.managedDirectory.createSync(recursive: true);
|
project.macos.managedDirectory.createSync(recursive: true);
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift'));
|
expectExists(project.macos.managedDirectory.childFile('GeneratedPluginRegistrant.swift'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -178,7 +178,7 @@ void main() {
|
|||||||
testUsingContext('generates Xcode configuration for macOS', () async {
|
testUsingContext('generates Xcode configuration for macOS', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
project.macos.managedDirectory.createSync(recursive: true);
|
project.macos.managedDirectory.createSync(recursive: true);
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.macos.generatedXcodePropertiesFile);
|
expectExists(project.macos.generatedXcodePropertiesFile);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -192,7 +192,7 @@ void main() {
|
|||||||
testUsingContext('injects plugins for Linux', () async {
|
testUsingContext('injects plugins for Linux', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
project.linux.cmakeFile.createSync(recursive: true);
|
project.linux.cmakeFile.createSync(recursive: true);
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.h'));
|
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.h'));
|
||||||
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.cc'));
|
expectExists(project.linux.managedDirectory.childFile('generated_plugin_registrant.cc'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -207,7 +207,7 @@ void main() {
|
|||||||
testUsingContext('injects plugins for Windows', () async {
|
testUsingContext('injects plugins for Windows', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
project.windows.cmakeFile.createSync(recursive: true);
|
project.windows.cmakeFile.createSync(recursive: true);
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.h'));
|
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.h'));
|
||||||
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.cc'));
|
expectExists(project.windows.managedDirectory.childFile('generated_plugin_registrant.cc'));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
@ -221,14 +221,14 @@ void main() {
|
|||||||
});
|
});
|
||||||
_testInMemory('creates Android library in module', () async {
|
_testInMemory('creates Android library in module', () async {
|
||||||
final FlutterProject project = await aModuleProject();
|
final FlutterProject project = await aModuleProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
expectExists(project.android.hostAppGradleRoot.childFile('settings.gradle'));
|
expectExists(project.android.hostAppGradleRoot.childFile('settings.gradle'));
|
||||||
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
expectExists(project.android.hostAppGradleRoot.childFile('local.properties'));
|
||||||
expectExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('Flutter')));
|
expectExists(androidPluginRegistrant(project.android.hostAppGradleRoot.childDirectory('Flutter')));
|
||||||
});
|
});
|
||||||
_testInMemory('creates iOS pod in module', () async {
|
_testInMemory('creates iOS pod in module', () async {
|
||||||
final FlutterProject project = await aModuleProject();
|
final FlutterProject project = await aModuleProject();
|
||||||
await project.ensureReadyForPlatformSpecificTooling();
|
await project.regeneratePlatformSpecificTooling();
|
||||||
final Directory flutter = project.ios.hostAppRoot.childDirectory('Flutter');
|
final Directory flutter = project.ios.hostAppRoot.childDirectory('Flutter');
|
||||||
expectExists(flutter.childFile('podhelper.rb'));
|
expectExists(flutter.childFile('podhelper.rb'));
|
||||||
expectExists(flutter.childFile('flutter_export_environment.sh'));
|
expectExists(flutter.childFile('flutter_export_environment.sh'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user