mirror of
https://github.com/flutter/packages.git
synced 2025-06-01 14:43:06 +08:00
[flutter_plugin_tools] Remove UWP (#5432)
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
- `license-check` now ignores submodules.
|
||||
- Allows `make-deps-path-based` to skip packages it has alredy rewritten, so
|
||||
that running multiple times won't fail after the first time.
|
||||
- Removes UWP support, since Flutter has dropped support for UWP.
|
||||
|
||||
## 0.8.2+1
|
||||
|
||||
|
@ -37,8 +37,7 @@ const String _flutterBuildTypeIOS = 'ios';
|
||||
const String _flutterBuildTypeLinux = 'linux';
|
||||
const String _flutterBuildTypeMacOS = 'macos';
|
||||
const String _flutterBuildTypeWeb = 'web';
|
||||
const String _flutterBuildTypeWin32 = 'windows';
|
||||
const String _flutterBuildTypeWinUwp = 'winuwp';
|
||||
const String _flutterBuildTypeWindows = 'windows';
|
||||
|
||||
/// A command to build the example applications for packages.
|
||||
class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
@ -52,7 +51,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
argParser.addFlag(platformMacOS);
|
||||
argParser.addFlag(platformWeb);
|
||||
argParser.addFlag(platformWindows);
|
||||
argParser.addFlag(platformWinUwp);
|
||||
argParser.addFlag(platformIOS);
|
||||
argParser.addFlag(_platformFlagApk);
|
||||
argParser.addOption(
|
||||
@ -93,16 +91,9 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
flutterBuildType: _flutterBuildTypeWeb,
|
||||
),
|
||||
platformWindows: const _PlatformDetails(
|
||||
'Win32',
|
||||
'Windows',
|
||||
pluginPlatform: platformWindows,
|
||||
pluginPlatformVariant: platformVariantWin32,
|
||||
flutterBuildType: _flutterBuildTypeWin32,
|
||||
),
|
||||
platformWinUwp: const _PlatformDetails(
|
||||
'UWP',
|
||||
pluginPlatform: platformWindows,
|
||||
pluginPlatformVariant: platformVariantWinUwp,
|
||||
flutterBuildType: _flutterBuildTypeWinUwp,
|
||||
flutterBuildType: _flutterBuildTypeWindows,
|
||||
),
|
||||
};
|
||||
|
||||
@ -146,9 +137,8 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
// no package-level platform information for non-plugin packages.
|
||||
final Set<_PlatformDetails> buildPlatforms = isPlugin
|
||||
? requestedPlatforms
|
||||
.where((_PlatformDetails platform) => pluginSupportsPlatform(
|
||||
platform.pluginPlatform, package,
|
||||
variant: platform.pluginPlatformVariant))
|
||||
.where((_PlatformDetails platform) =>
|
||||
pluginSupportsPlatform(platform.pluginPlatform, package))
|
||||
.toSet()
|
||||
: requestedPlatforms.toSet();
|
||||
|
||||
@ -280,22 +270,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
}) async {
|
||||
final String enableExperiment = getStringArg(kEnableExperiment);
|
||||
|
||||
// The UWP template is not yet stable, so the UWP directory
|
||||
// needs to be created on the fly with 'flutter create .'
|
||||
Directory? temporaryPlatformDirectory;
|
||||
if (flutterBuildType == _flutterBuildTypeWinUwp) {
|
||||
final Directory uwpDirectory = example.directory.childDirectory('winuwp');
|
||||
if (!uwpDirectory.existsSync()) {
|
||||
print('Creating temporary winuwp folder');
|
||||
final int exitCode = await processRunner.runAndStream(flutterCommand,
|
||||
<String>['create', '--platforms=$platformWinUwp', '.'],
|
||||
workingDir: example.directory);
|
||||
if (exitCode == 0) {
|
||||
temporaryPlatformDirectory = uwpDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
@ -308,13 +282,6 @@ class BuildExamplesCommand extends PackageLoopingCommand {
|
||||
],
|
||||
workingDir: example.directory,
|
||||
);
|
||||
|
||||
if (temporaryPlatformDirectory != null &&
|
||||
temporaryPlatformDirectory.existsSync()) {
|
||||
print('Cleaning up ${temporaryPlatformDirectory.path}');
|
||||
temporaryPlatformDirectory.deleteSync(recursive: true);
|
||||
}
|
||||
|
||||
return exitCode == 0;
|
||||
}
|
||||
}
|
||||
@ -324,7 +291,6 @@ class _PlatformDetails {
|
||||
const _PlatformDetails(
|
||||
this.label, {
|
||||
required this.pluginPlatform,
|
||||
this.pluginPlatformVariant,
|
||||
required this.flutterBuildType,
|
||||
this.extraBuildFlags = const <String>[],
|
||||
});
|
||||
@ -335,10 +301,6 @@ class _PlatformDetails {
|
||||
/// The key in a pubspec's platform: entry.
|
||||
final String pluginPlatform;
|
||||
|
||||
/// The supportedVariants key under a plugin's [pluginPlatform] entry, if
|
||||
/// applicable.
|
||||
final String? pluginPlatformVariant;
|
||||
|
||||
/// The `flutter build` build type.
|
||||
final String flutterBuildType;
|
||||
|
||||
|
@ -26,27 +26,8 @@ const String platformMacOS = 'macos';
|
||||
const String platformWeb = 'web';
|
||||
|
||||
/// Key for windows platform.
|
||||
///
|
||||
/// Note that this corresponds to the Win32 variant for flutter commands like
|
||||
/// `build` and `run`, but is a general platform containing all Windows
|
||||
/// variants for purposes of the `platform` section of a plugin pubspec).
|
||||
const String platformWindows = 'windows';
|
||||
|
||||
/// Key for WinUWP platform.
|
||||
///
|
||||
/// Note that UWP is a platform for the purposes of flutter commands like
|
||||
/// `build` and `run`, but a variant of the `windows` platform for the purposes
|
||||
/// of plugin pubspecs).
|
||||
const String platformWinUwp = 'winuwp';
|
||||
|
||||
/// Key for Win32 variant of the Windows platform.
|
||||
const String platformVariantWin32 = 'win32';
|
||||
|
||||
/// Key for UWP variant of the Windows platform.
|
||||
///
|
||||
/// See the note on [platformWinUwp].
|
||||
const String platformVariantWinUwp = 'uwp';
|
||||
|
||||
/// Key for enable experiment.
|
||||
const String kEnableExperiment = 'enable-experiment';
|
||||
|
||||
|
@ -37,7 +37,6 @@ bool pluginSupportsPlatform(
|
||||
String platform,
|
||||
RepositoryPackage plugin, {
|
||||
PlatformSupport? requiredMode,
|
||||
String? variant,
|
||||
}) {
|
||||
assert(platform == platformIOS ||
|
||||
platform == platformAndroid ||
|
||||
@ -61,26 +60,6 @@ bool pluginSupportsPlatform(
|
||||
}
|
||||
}
|
||||
|
||||
// If a variant is specified, check for that variant.
|
||||
if (variant != null) {
|
||||
const String variantsKey = 'supportedVariants';
|
||||
if (platformEntry.containsKey(variantsKey)) {
|
||||
if (!(platformEntry['supportedVariants']! as YamlList)
|
||||
.contains(variant)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Platforms with variants have a default variant when unspecified for
|
||||
// backward compatibility. Must match the flutter tool logic.
|
||||
const Map<String, String> defaultVariants = <String, String>{
|
||||
platformWindows: platformVariantWin32,
|
||||
};
|
||||
if (variant != defaultVariants[platform]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
argParser.addFlag(platformWeb,
|
||||
help: 'Runs the web implementation of the examples');
|
||||
argParser.addFlag(platformWindows,
|
||||
help: 'Runs the Windows (Win32) implementation of the examples');
|
||||
argParser.addFlag(platformWinUwp,
|
||||
help:
|
||||
'Runs the UWP implementation of the examples [currently a no-op]');
|
||||
help: 'Runs the Windows implementation of the examples');
|
||||
argParser.addOption(
|
||||
kEnableExperiment,
|
||||
defaultsTo: '',
|
||||
@ -70,7 +67,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
platformMacOS,
|
||||
platformWeb,
|
||||
platformWindows,
|
||||
platformWinUwp,
|
||||
];
|
||||
final int platformCount = platformSwitches
|
||||
.where((String platform) => getBoolArg(platform))
|
||||
@ -85,10 +81,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
throw ToolExit(_exitNoPlatformFlags);
|
||||
}
|
||||
|
||||
if (getBoolArg(platformWinUwp)) {
|
||||
logWarning('Driving UWP applications is not yet supported');
|
||||
}
|
||||
|
||||
String? androidDevice;
|
||||
if (getBoolArg(platformAndroid)) {
|
||||
final List<String> devices = await _getDevicesForPlatform('android');
|
||||
@ -126,9 +118,6 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
],
|
||||
if (getBoolArg(platformWindows))
|
||||
platformWindows: <String>['-d', 'windows'],
|
||||
// TODO(stuartmorgan): Check these flags once drive supports UWP:
|
||||
// https://github.com/flutter/flutter/issues/82821
|
||||
if (getBoolArg(platformWinUwp)) platformWinUwp: <String>['-d', 'winuwp'],
|
||||
};
|
||||
}
|
||||
|
||||
@ -146,16 +135,7 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
for (final MapEntry<String, List<String>> entry
|
||||
in _targetDeviceFlags.entries) {
|
||||
final String platform = entry.key;
|
||||
String? variant;
|
||||
if (platform == platformWindows) {
|
||||
variant = platformVariantWin32;
|
||||
} else if (platform == platformWinUwp) {
|
||||
variant = platformVariantWinUwp;
|
||||
// TODO(stuartmorgan): Remove this once drive supports UWP.
|
||||
// https://github.com/flutter/flutter/issues/82821
|
||||
return PackageResult.skip('Drive does not yet support UWP');
|
||||
}
|
||||
if (pluginSupportsPlatform(platform, package, variant: variant)) {
|
||||
if (pluginSupportsPlatform(platform, package)) {
|
||||
deviceFlags.addAll(entry.value);
|
||||
} else {
|
||||
print('Skipping unsupported platform ${entry.key}...');
|
||||
|
@ -313,7 +313,7 @@ void main() {
|
||||
});
|
||||
|
||||
test(
|
||||
'building for win32 when plugin is not set up for Windows results in no-op',
|
||||
'building for Windows when plugin is not set up for Windows results in no-op',
|
||||
() async {
|
||||
mockPlatform.isWindows = true;
|
||||
createFakePlugin('plugin', packagesDir);
|
||||
@ -325,7 +325,7 @@ void main() {
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin'),
|
||||
contains('Win32 is not supported by this plugin'),
|
||||
contains('Windows is not supported by this plugin'),
|
||||
]),
|
||||
);
|
||||
|
||||
@ -334,7 +334,7 @@ void main() {
|
||||
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
|
||||
});
|
||||
|
||||
test('building for win32', () async {
|
||||
test('building for Windows', () async {
|
||||
mockPlatform.isWindows = true;
|
||||
final Directory pluginDirectory = createFakePlugin('plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
@ -350,7 +350,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<String>[
|
||||
'\nBUILDING plugin/example for Win32 (windows)',
|
||||
'\nBUILDING plugin/example for Windows',
|
||||
]),
|
||||
);
|
||||
|
||||
@ -364,88 +364,6 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
test('building for UWP when plugin does not support UWP is a no-op',
|
||||
() async {
|
||||
createFakePlugin('plugin', packagesDir);
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['build-examples', '--winuwp']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Running for plugin'),
|
||||
contains('UWP is not supported by this plugin'),
|
||||
]),
|
||||
);
|
||||
|
||||
// Output should be empty since running build-examples --macos with no macos
|
||||
// implementation is a no-op.
|
||||
expect(processRunner.recordedCalls, orderedEquals(<ProcessCall>[]));
|
||||
});
|
||||
|
||||
test('building for UWP', () async {
|
||||
final Directory pluginDirectory =
|
||||
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
||||
'example/test',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(PlatformSupport.federated,
|
||||
variants: <String>[platformVariantWinUwp]),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory =
|
||||
pluginDirectory.childDirectory('example');
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['build-examples', '--winuwp']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('BUILDING plugin/example for UWP (winuwp)'),
|
||||
]),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
containsAll(<ProcessCall>[
|
||||
ProcessCall(getFlutterCommand(mockPlatform),
|
||||
const <String>['build', 'winuwp'], pluginExampleDirectory.path),
|
||||
]));
|
||||
});
|
||||
|
||||
test('building for UWP creates a folder if necessary', () async {
|
||||
final Directory pluginDirectory =
|
||||
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
||||
'example/test',
|
||||
], platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(PlatformSupport.federated,
|
||||
variants: <String>[platformVariantWinUwp]),
|
||||
});
|
||||
|
||||
final Directory pluginExampleDirectory =
|
||||
pluginDirectory.childDirectory('example');
|
||||
|
||||
final List<String> output = await runCapturingPrint(
|
||||
runner, <String>['build-examples', '--winuwp']);
|
||||
|
||||
expect(
|
||||
output,
|
||||
contains('Creating temporary winuwp folder'),
|
||||
);
|
||||
|
||||
expect(
|
||||
processRunner.recordedCalls,
|
||||
orderedEquals(<ProcessCall>[
|
||||
ProcessCall(
|
||||
getFlutterCommand(mockPlatform),
|
||||
const <String>['create', '--platforms=winuwp', '.'],
|
||||
pluginExampleDirectory.path),
|
||||
ProcessCall(getFlutterCommand(mockPlatform),
|
||||
const <String>['build', 'winuwp'], pluginExampleDirectory.path),
|
||||
]));
|
||||
});
|
||||
|
||||
test(
|
||||
'building for Android when plugin is not set up for Android results in no-op',
|
||||
() async {
|
||||
|
@ -193,85 +193,6 @@ void main() {
|
||||
requiredMode: PlatformSupport.inline),
|
||||
isFalse);
|
||||
});
|
||||
|
||||
test('windows without variants is only win32', () async {
|
||||
final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
|
||||
'plugin',
|
||||
packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(PlatformSupport.inline),
|
||||
},
|
||||
));
|
||||
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWin32),
|
||||
isTrue);
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWinUwp),
|
||||
isFalse);
|
||||
});
|
||||
|
||||
test('windows with both variants matches win32 and winuwp', () async {
|
||||
final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
|
||||
'plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(
|
||||
PlatformSupport.federated,
|
||||
variants: <String>[platformVariantWin32, platformVariantWinUwp],
|
||||
),
|
||||
}));
|
||||
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWin32),
|
||||
isTrue);
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWinUwp),
|
||||
isTrue);
|
||||
});
|
||||
|
||||
test('win32 plugin is only win32', () async {
|
||||
final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
|
||||
'plugin', packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(
|
||||
PlatformSupport.federated,
|
||||
variants: <String>[platformVariantWin32],
|
||||
),
|
||||
}));
|
||||
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWin32),
|
||||
isTrue);
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWinUwp),
|
||||
isFalse);
|
||||
});
|
||||
|
||||
test('winup plugin is only winuwp', () async {
|
||||
final RepositoryPackage plugin = RepositoryPackage(createFakePlugin(
|
||||
'plugin',
|
||||
packagesDir,
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(PlatformSupport.federated,
|
||||
variants: <String>[platformVariantWinUwp]),
|
||||
},
|
||||
));
|
||||
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWin32),
|
||||
isFalse);
|
||||
expect(
|
||||
pluginSupportsPlatform(platformWindows, plugin,
|
||||
variant: platformVariantWinUwp),
|
||||
isTrue);
|
||||
});
|
||||
});
|
||||
|
||||
group('pluginHasNativeCodeForPlatform', () {
|
||||
|
@ -708,40 +708,6 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
test('driving UWP is a no-op', () async {
|
||||
createFakePlugin(
|
||||
'plugin',
|
||||
packagesDir,
|
||||
extraFiles: <String>[
|
||||
'example/test_driver/plugin_test.dart',
|
||||
'example/test_driver/plugin.dart',
|
||||
],
|
||||
platformSupport: <String, PlatformDetails>{
|
||||
platformWindows: const PlatformDetails(PlatformSupport.inline,
|
||||
variants: <String>[platformVariantWinUwp]),
|
||||
},
|
||||
);
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||
'drive-examples',
|
||||
'--winuwp',
|
||||
]);
|
||||
|
||||
expect(
|
||||
output,
|
||||
containsAllInOrder(<Matcher>[
|
||||
contains('Driving UWP applications is not yet supported'),
|
||||
contains('Running for plugin'),
|
||||
contains('SKIPPING: Drive does not yet support UWP'),
|
||||
contains('No issues found!'),
|
||||
]),
|
||||
);
|
||||
|
||||
// Output should be empty since running drive-examples --windows on a
|
||||
// non-Windows plugin is a no-op.
|
||||
expect(processRunner.recordedCalls, <ProcessCall>[]);
|
||||
});
|
||||
|
||||
test('driving on an Android plugin', () async {
|
||||
final Directory pluginDirectory = createFakePlugin(
|
||||
'plugin',
|
||||
|
@ -47,7 +47,6 @@ Directory createPackagesDirectory(
|
||||
class PlatformDetails {
|
||||
const PlatformDetails(
|
||||
this.type, {
|
||||
this.variants = const <String>[],
|
||||
this.hasNativeCode = true,
|
||||
this.hasDartCode = false,
|
||||
});
|
||||
@ -55,9 +54,6 @@ class PlatformDetails {
|
||||
/// The type of support for the platform.
|
||||
final PlatformSupport type;
|
||||
|
||||
/// Any 'supportVariants' to list in the pubspec.
|
||||
final List<String> variants;
|
||||
|
||||
/// Whether or not the plugin includes native code.
|
||||
///
|
||||
/// Ignored for web, which does not have native code.
|
||||
@ -293,18 +289,6 @@ String _pluginPlatformSection(
|
||||
entry = lines.join('\n') + '\n';
|
||||
}
|
||||
|
||||
// Add any variants.
|
||||
if (support.variants.isNotEmpty) {
|
||||
entry += '''
|
||||
supportedVariants:
|
||||
''';
|
||||
for (final String variant in support.variants) {
|
||||
entry += '''
|
||||
- $variant
|
||||
''';
|
||||
}
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user