[flutter_tools] symlink win32 plugins as UWP plugins (#80242)
This commit is contained in:
@@ -14,9 +14,24 @@ import 'package:flutter_tools/src/plugins.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
import '../../src/fakes.dart';
|
||||
|
||||
const TemplateRenderer renderer = MustacheTemplateRenderer();
|
||||
|
||||
const String kPluginDependencies = r'''
|
||||
{
|
||||
"info":"This is a generated file; do not edit or check into version control.",
|
||||
"plugins":{
|
||||
"windows":[
|
||||
{
|
||||
"name":"example","path":"C:\\\\example\\\\",
|
||||
"dependencies":[]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
''';
|
||||
|
||||
void main() {
|
||||
|
||||
testWithoutContext('injects Win32 plugins', () async {
|
||||
@@ -64,10 +79,31 @@ void main() {
|
||||
contains('#include <test/foo.h>'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('Symlink injection treats UWP as Win32', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
setUpProject(fileSystem);
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
flutterProject.flutterPluginsDependenciesFile.writeAsStringSync(kPluginDependencies);
|
||||
|
||||
createPluginSymlinks(
|
||||
flutterProject,
|
||||
featureFlagsOverride: TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
);
|
||||
|
||||
expect(flutterProject.windowsUwp.pluginSymlinkDirectory, exists);
|
||||
|
||||
final Link link = flutterProject.windowsUwp.pluginSymlinkDirectory.listSync().single as Link;
|
||||
|
||||
expect(link.path, '/winuwp/flutter/ephemeral/.plugin_symlinks/example');
|
||||
expect(link.targetSync(), r'C:\\example\\');
|
||||
});
|
||||
}
|
||||
|
||||
void setUpProject(FileSystem fileSystem) {
|
||||
fileSystem.file('pubspec.yaml').createSync();
|
||||
fileSystem.file('winuwp/CMakeLists.txt')
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('winuwp/project_version')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('0');
|
||||
|
||||
Reference in New Issue
Block a user