[flutter_tools] remove UWP tooling (#102174)
This commit is contained in:
@@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/commands/build_windows.dart';
|
||||
import 'package:flutter_tools/src/commands/build_winuwp.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:flutter_tools/src/windows/visual_studio.dart';
|
||||
@@ -23,7 +22,6 @@ import '../../src/test_flutter_command_runner.dart';
|
||||
|
||||
const String flutterRoot = r'C:\flutter';
|
||||
const String buildFilePath = r'C:\windows\CMakeLists.txt';
|
||||
const String buildUwpFilePath = r'C:\winuwp\CMakeLists.txt';
|
||||
const String visualStudioPath = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community';
|
||||
const String _cmakePath = visualStudioPath + r'\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe';
|
||||
const String _defaultGenerator = 'Visual Studio 16 2019';
|
||||
@@ -72,31 +70,19 @@ void main() {
|
||||
setUpMockCoreProjectFiles();
|
||||
}
|
||||
|
||||
void setUpMockUwpFilesForBuild(int version) {
|
||||
final Directory projectDirectory = (fileSystem.file(buildUwpFilePath)
|
||||
..createSync(recursive: true))
|
||||
.parent;
|
||||
projectDirectory.childFile('project_version').writeAsString(version.toString());
|
||||
setUpMockCoreProjectFiles();
|
||||
}
|
||||
|
||||
// Returns the command matching the build_windows call to generate CMake
|
||||
// files.
|
||||
FakeCommand cmakeGenerationCommand({
|
||||
void Function() onRun,
|
||||
bool winuwp = false,
|
||||
String generator = _defaultGenerator,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
_cmakePath,
|
||||
'-S',
|
||||
fileSystem.path.dirname(winuwp ? buildUwpFilePath : buildFilePath),
|
||||
fileSystem.path.dirname(buildFilePath),
|
||||
'-B',
|
||||
if (winuwp)
|
||||
r'build\winuwp'
|
||||
else
|
||||
r'build\windows',
|
||||
r'build\windows',
|
||||
'-G',
|
||||
generator,
|
||||
],
|
||||
@@ -109,20 +95,15 @@ void main() {
|
||||
bool verbose = false,
|
||||
void Function() onRun,
|
||||
String stdout = '',
|
||||
bool winuwp = false,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
_cmakePath,
|
||||
'--build',
|
||||
if (winuwp)
|
||||
r'build\winuwp'
|
||||
else
|
||||
r'build\windows',
|
||||
r'build\windows',
|
||||
'--config',
|
||||
buildMode,
|
||||
if (!winuwp)
|
||||
...<String>['--target', 'INSTALL'],
|
||||
...<String>['--target', 'INSTALL'],
|
||||
if (verbose)
|
||||
'--verbose'
|
||||
],
|
||||
@@ -615,125 +596,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: fileSystem, platform: windowsPlatform),
|
||||
Usage: () => usage,
|
||||
});
|
||||
|
||||
testUsingContext('Windows UWP build fails when there is no windows project', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockCoreProjectFiles();
|
||||
|
||||
expect(createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
), throwsToolExit(message: 'No Windows UWP desktop project configured. See '
|
||||
'https://docs.flutter.dev/desktop#add-desktop-support-to-an-existing-flutter-app '
|
||||
'to learn about adding Windows support to a project.'));
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => windowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows build fails on non windows platform', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockUwpFilesForBuild(0);
|
||||
|
||||
expect(createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
), throwsToolExit());
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => notWindowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows UWP build fails on non windows platform', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
expect(createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
), throwsToolExit(message: '"build winuwp" only supported on Windows hosts.'));
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => notWindowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows UWP build fails when the project version is out of date', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockUwpFilesForBuild(-1);
|
||||
|
||||
expect(createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
), throwsToolExit(message: 'The Windows UWP project template and build process has changed. '
|
||||
'In order to build you must delete the winuwp directory and re-create the project'));
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => windowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
});
|
||||
|
||||
testUsingContext('Windows UWP build fails when feature is disabled', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockProjectFilesForBuild();
|
||||
|
||||
// This message should include 'To enable, run "flutter config --enable-windows-uwp-desktop"."
|
||||
// once the `windowsUwpEmbedding` feature is available on all channels.
|
||||
expect(createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
), throwsToolExit(message: RegExp(r'"build winuwp" is not currently supported\.$')));
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => windowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
FeatureFlags: () => TestFeatureFlags(),
|
||||
});
|
||||
|
||||
testUsingContext('Windows UWP build completes successfully', () async {
|
||||
final FakeVisualStudio fakeVisualStudio = FakeVisualStudio();
|
||||
final BuildWindowsUwpCommand command = BuildWindowsUwpCommand()
|
||||
..visualStudioOverride = fakeVisualStudio;
|
||||
setUpMockUwpFilesForBuild(0);
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>['winuwp', '--no-pub']
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
Platform: () => windowsPlatform,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
const FakeCommand(
|
||||
command: <String>[
|
||||
r'C:\flutter\bin\flutter',
|
||||
'assemble',
|
||||
'--no-version-check',
|
||||
'--output=build',
|
||||
'-dTargetPlatform=windows-uwp-x64',
|
||||
'-dTrackWidgetCreation=true',
|
||||
'-dBuildMode=release',
|
||||
r'-dTargetFile=lib\main.dart',
|
||||
'-dTreeShakeIcons="true"',
|
||||
'-dDartObfuscation=false',
|
||||
'release_bundle_windows_assets_uwp'
|
||||
],
|
||||
),
|
||||
cmakeGenerationCommand(winuwp: true),
|
||||
buildCommand('Release', stdout: 'STDOUT STUFF', winuwp: true),
|
||||
]),
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
});
|
||||
}
|
||||
|
||||
class FakeVisualStudio extends Fake implements VisualStudio {
|
||||
|
||||
@@ -811,7 +811,6 @@ void main() {
|
||||
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||
expect(projectDir.childDirectory('winuwp'), isNot(exists));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(),
|
||||
});
|
||||
@@ -830,42 +829,14 @@ void main() {
|
||||
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||
expect(projectDir.childDirectory('winuwp'), 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));
|
||||
expect(projectDir.childDirectory('example').childDirectory('winuwp'), isNot(exists));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(),
|
||||
});
|
||||
|
||||
testUsingContext('app supports Windows UWP if requested', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
|
||||
final CreateCommand command = CreateCommand();
|
||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||
|
||||
await runner.run(<String>[
|
||||
'create',
|
||||
'--no-pub',
|
||||
'--platform=winuwp',
|
||||
projectDir.path,
|
||||
]);
|
||||
|
||||
expect(projectDir.childDirectory('linux'), isNot(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));
|
||||
expect(projectDir.childDirectory('winuwp'), exists);
|
||||
expect(logger.errorText, isNot(contains(_kNoPlatformsMessage)));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
|
||||
Logger: () => logger,
|
||||
});
|
||||
|
||||
testUsingContext('app supports Linux if requested', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
|
||||
@@ -885,7 +856,6 @@ void main() {
|
||||
expect(projectDir.childDirectory('windows'), isNot(exists));
|
||||
expect(projectDir.childDirectory('macos'), isNot(exists));
|
||||
expect(projectDir.childDirectory('web'), isNot(exists));
|
||||
expect(projectDir.childDirectory('winuwp'), isNot(exists));
|
||||
expect(logger.errorText, isNot(contains(_kNoPlatformsMessage)));
|
||||
}, overrides: <Type, Generator>{
|
||||
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),
|
||||
|
||||
@@ -141,18 +141,6 @@ void main() {
|
||||
artifacts.getArtifactPath(Artifact.flutterTester, platform: TargetPlatform.linux_arm64),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'linux-arm64', 'flutter_tester'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.windowsUwpDesktopPath, platform: TargetPlatform.windows_uwp_x64, mode: BuildMode.debug),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'windows-uwp-x64-debug'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.windowsUwpDesktopPath, platform: TargetPlatform.windows_uwp_x64, mode: BuildMode.profile),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'windows-uwp-x64-profile'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.windowsUwpDesktopPath, platform: TargetPlatform.windows_uwp_x64, mode: BuildMode.release),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'artifacts', 'engine', 'windows-uwp-x64-release'),
|
||||
);
|
||||
expect(
|
||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||
fileSystem.path.join('root', 'bin', 'cache', 'dart-sdk', 'bin', 'snapshots', 'frontend_server.dart.snapshot')
|
||||
@@ -358,20 +346,6 @@ void main() {
|
||||
expect(artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, contains('.exe'));
|
||||
});
|
||||
|
||||
testWithoutContext('Looks up windows UWP artifacts in host engine', () async {
|
||||
artifacts = LocalEngineArtifacts(
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'winuwp_debug_unopt'),
|
||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'winuwp_debug_unopt'),
|
||||
cache: cache,
|
||||
fileSystem: fileSystem,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
processManager: FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
|
||||
expect(artifacts.getArtifactPath(Artifact.windowsUwpDesktopPath), '/out/winuwp_debug_unopt');
|
||||
});
|
||||
|
||||
testWithoutContext('Looks up dart on linux platforms', () async {
|
||||
expect(artifacts.getHostArtifact(HostArtifact.engineDartBinary).path, isNot(contains('.exe')));
|
||||
});
|
||||
|
||||
@@ -131,7 +131,6 @@ void main() {
|
||||
'linux-x64': false,
|
||||
'linux-arm64': false,
|
||||
'windows-x64': false,
|
||||
'windows-uwp-x64': false,
|
||||
'web-javascript': true,
|
||||
'ios': false,
|
||||
'android': false,
|
||||
|
||||
@@ -125,107 +125,6 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
testWithoutContext('UnpackWindowsUwp copies files to the correct winuwp/ cache directory', () async {
|
||||
final Artifacts artifacts = Artifacts.test();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
artifacts: artifacts,
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: fileSystem,
|
||||
logger: BufferLogger.test(),
|
||||
defines: <String, String>{
|
||||
kBuildMode: 'debug',
|
||||
},
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
logger: BufferLogger.test(),
|
||||
fileSystem: fileSystem,
|
||||
);
|
||||
environment.buildDir.createSync(recursive: true);
|
||||
|
||||
final String windowsDesktopPath = artifacts.getArtifactPath(Artifact.windowsUwpDesktopPath, platform: TargetPlatform.windows_x64, mode: BuildMode.debug);
|
||||
final String windowsCppClientWrapper = artifacts.getArtifactPath(Artifact.windowsUwpCppClientWrapper, platform: TargetPlatform.windows_x64, mode: BuildMode.debug);
|
||||
final String icuData = artifacts.getArtifactPath(Artifact.icuData, platform: TargetPlatform.windows_x64);
|
||||
final List<String> requiredFiles = <String>[
|
||||
'$windowsDesktopPath\\flutter_export.h',
|
||||
'$windowsDesktopPath\\flutter_messenger.h',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.exp',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.lib',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.pdb',
|
||||
'$windowsDesktopPath\\flutter_plugin_registrar.h',
|
||||
'$windowsDesktopPath\\flutter_texture_registrar.h',
|
||||
'$windowsDesktopPath\\flutter_windows.h',
|
||||
icuData,
|
||||
'$windowsCppClientWrapper\\foo',
|
||||
r'C:\packages\flutter_tools\lib\src\build_system\targets\windows.dart',
|
||||
];
|
||||
|
||||
for (final String path in requiredFiles) {
|
||||
fileSystem.file(path).createSync(recursive: true);
|
||||
}
|
||||
fileSystem.directory('windows').createSync();
|
||||
|
||||
await const UnpackWindowsUwp().build(environment);
|
||||
|
||||
// Output files are copied correctly.
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_export.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_messenger.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.exp'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.lib'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.pdb'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_export.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_messenger.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_plugin_registrar.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_texture_registrar.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\ephemeral\flutter_windows.h'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\flutter\flutter_windows.h'), exists);
|
||||
expect(fileSystem.file('C:\\winuwp\\flutter\\ephemeral\\$icuData'), exists);
|
||||
expect(fileSystem.file('C:\\winuwp\\flutter\\ephemeral\\$windowsCppClientWrapper\\foo'), exists);
|
||||
|
||||
final File outputDepfile = environment.buildDir
|
||||
.childFile('windows_uwp_engine_sources.d');
|
||||
|
||||
// Depfile is created correctly.
|
||||
expect(outputDepfile, exists);
|
||||
|
||||
final List<String> inputPaths = depfileService.parse(outputDepfile)
|
||||
.inputs.map((File file) => file.path).toList();
|
||||
final List<String> outputPaths = depfileService.parse(outputDepfile)
|
||||
.outputs.map((File file) => file.path).toList();
|
||||
|
||||
// Depfile has expected sources.
|
||||
expect(inputPaths, unorderedEquals(<String>[
|
||||
'$windowsDesktopPath\\flutter_export.h',
|
||||
'$windowsDesktopPath\\flutter_messenger.h',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.exp',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.lib',
|
||||
'$windowsDesktopPath\\flutter_windows_winuwp.dll.pdb',
|
||||
'$windowsDesktopPath\\flutter_plugin_registrar.h',
|
||||
'$windowsDesktopPath\\flutter_texture_registrar.h',
|
||||
'$windowsDesktopPath\\flutter_windows.h',
|
||||
icuData,
|
||||
'$windowsCppClientWrapper\\foo',
|
||||
]));
|
||||
expect(outputPaths, unorderedEquals(<String>[
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_export.h',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_messenger.h',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.exp',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.lib',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_windows_winuwp.dll.pdb',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_plugin_registrar.h',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_texture_registrar.h',
|
||||
r'C:\winuwp\flutter\ephemeral\flutter_windows.h',
|
||||
r'C:\winuwp\flutter\flutter_windows.h',
|
||||
'C:\\winuwp\\flutter\\ephemeral\\$icuData',
|
||||
'C:\\winuwp\\flutter\\ephemeral\\$windowsCppClientWrapper\\foo',
|
||||
]));
|
||||
});
|
||||
|
||||
// AssetBundleFactory still uses context injection
|
||||
FileSystem fileSystem;
|
||||
|
||||
@@ -288,7 +187,7 @@ void main() {
|
||||
|
||||
environment.buildDir.childFile('app.so').createSync(recursive: true);
|
||||
|
||||
await const WindowsAotBundle(AotElfProfile(TargetPlatform.windows_x64), uwp: false).build(environment);
|
||||
await const WindowsAotBundle(AotElfProfile(TargetPlatform.windows_x64)).build(environment);
|
||||
await const ProfileBundleWindowsAssets().build(environment);
|
||||
|
||||
// Depfile is created and so is copied.
|
||||
@@ -301,60 +200,6 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('ReleaseBundleWindowsAssets creates correct bundle structure with UWP', () async {
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
artifacts: Artifacts.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: fileSystem,
|
||||
logger: BufferLogger.test(),
|
||||
defines: <String, String>{
|
||||
kBuildMode: 'release',
|
||||
}
|
||||
);
|
||||
|
||||
environment.buildDir.childFile('app.so').createSync(recursive: true);
|
||||
|
||||
await const WindowsAotBundle(AotElfRelease(TargetPlatform.windows_x64), uwp: true).build(environment);
|
||||
await const ReleaseBundleWindowsAssets().build(environment);
|
||||
|
||||
// Depfile is created and so is copied.
|
||||
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\app.so'), exists);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\kernel_blob.bin').existsSync(), false);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\AssetManifest.json'), exists);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('ProfileBundleWindowsAssets creates correct bundle structure with UWP', () async {
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
artifacts: Artifacts.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: fileSystem,
|
||||
logger: BufferLogger.test(),
|
||||
defines: <String, String>{
|
||||
kBuildMode: 'profile',
|
||||
}
|
||||
);
|
||||
|
||||
environment.buildDir.childFile('app.so').createSync(recursive: true);
|
||||
|
||||
await const WindowsAotBundle(AotElfProfile(TargetPlatform.windows_x64), uwp: true).build(environment);
|
||||
await const ProfileBundleWindowsAssets().build(environment);
|
||||
|
||||
// Depfile is created and so is copied.
|
||||
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
|
||||
expect(fileSystem.file(r'C:\winuwp\app.so'), exists);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\kernel_blob.bin').existsSync(), false);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\AssetManifest.json'), exists);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('ReleaseBundleWindowsAssets creates correct bundle structure', () async {
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
@@ -369,7 +214,7 @@ void main() {
|
||||
|
||||
environment.buildDir.childFile('app.so').createSync(recursive: true);
|
||||
|
||||
await const WindowsAotBundle(AotElfRelease(TargetPlatform.windows_x64), uwp: false).build(environment);
|
||||
await const WindowsAotBundle(AotElfRelease(TargetPlatform.windows_x64)).build(environment);
|
||||
await const ReleaseBundleWindowsAssets().build(environment);
|
||||
|
||||
// Depfile is created and so is copied.
|
||||
|
||||
@@ -604,20 +604,6 @@ void main() {
|
||||
]));
|
||||
});
|
||||
|
||||
testWithoutContext('Windows UWP desktop artifacts include profile, debug, and release artifacts', () {
|
||||
final Cache cache = Cache.test(processManager: FakeProcessManager.any());
|
||||
final WindowsUwpEngineArtifacts artifacts = WindowsUwpEngineArtifacts(
|
||||
cache,
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
);
|
||||
|
||||
expect(artifacts.getBinaryDirs(), containsAll(<Matcher>[
|
||||
contains(contains('profile')),
|
||||
contains(contains('release')),
|
||||
contains(contains('debug')),
|
||||
]));
|
||||
});
|
||||
|
||||
testWithoutContext('Linux desktop artifacts ignore filtering when requested', () {
|
||||
fakeProcessManager.addCommand(unameCommandForX64);
|
||||
|
||||
|
||||
@@ -1054,7 +1054,4 @@ class FakeFlutterProject extends Fake implements FlutterProject {
|
||||
|
||||
@override
|
||||
WindowsProject windows;
|
||||
|
||||
@override
|
||||
WindowsUwpProject windowsUwp;
|
||||
}
|
||||
|
||||
@@ -366,37 +366,5 @@ void main() {
|
||||
|
||||
expect(featureFlags.isWindowsEnabled, true);
|
||||
});
|
||||
|
||||
// Windows UWP desktop
|
||||
|
||||
testWithoutContext('Flutter Windows UWP desktop off by default on master', () {
|
||||
final FeatureFlags featureFlags = createFlags('master');
|
||||
|
||||
expect(featureFlags.isWindowsUwpEnabled, false);
|
||||
});
|
||||
|
||||
testWithoutContext('Flutter Windows UWP desktop enabled with config on master', () {
|
||||
final FeatureFlags featureFlags = createFlags('master');
|
||||
testConfig.setValue('enable-windows-uwp-desktop', true);
|
||||
|
||||
expect(featureFlags.isWindowsUwpEnabled, true);
|
||||
});
|
||||
|
||||
testWithoutContext('Flutter Windows UWP desktop config includes removal warning', () {
|
||||
expect(windowsUwpEmbedding.extraHelpText, contains('Windows UWP support is obsolete and will be removed'));
|
||||
});
|
||||
|
||||
testWithoutContext('Flutter Windows UWP desktop off by default on stable', () {
|
||||
final FeatureFlags featureFlags = createFlags('stable');
|
||||
|
||||
expect(featureFlags.isWindowsUwpEnabled, false);
|
||||
});
|
||||
|
||||
testWithoutContext('Flutter Windows UWP desktop not enabled with config on stable', () {
|
||||
final FeatureFlags featureFlags = createFlags('stable');
|
||||
testConfig.setValue('enable-windows-uwp-desktop', true);
|
||||
|
||||
expect(featureFlags.isWindowsUwpEnabled, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -272,8 +272,7 @@ void main() {
|
||||
' windows:\n'
|
||||
' pluginClass: WinSamplePlugin\n'
|
||||
' supportedVariants:\n'
|
||||
' - win32\n'
|
||||
' - uwp\n';
|
||||
' - win32\n';
|
||||
|
||||
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
|
||||
final Plugin plugin = Plugin.fromYaml(
|
||||
@@ -288,7 +287,6 @@ void main() {
|
||||
final WindowsPlugin windowsPlugin = plugin.platforms[WindowsPlugin.kConfigKey]! as WindowsPlugin;
|
||||
expect(windowsPlugin.supportedVariants, <PluginPlatformVariant>[
|
||||
PluginPlatformVariant.win32,
|
||||
PluginPlatformVariant.winuwp,
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -322,8 +320,7 @@ void main() {
|
||||
' windows:\n'
|
||||
' pluginClass: WinSamplePlugin\n'
|
||||
' supportedVariants:\n'
|
||||
' - not_yet_invented_variant\n'
|
||||
' - uwp\n';
|
||||
' - not_yet_invented_variant\n';
|
||||
|
||||
final YamlMap pluginYaml = loadYaml(pluginYamlRaw) as YamlMap;
|
||||
final Plugin plugin = Plugin.fromYaml(
|
||||
@@ -336,9 +333,7 @@ void main() {
|
||||
);
|
||||
|
||||
final WindowsPlugin windowsPlugin = plugin.platforms[WindowsPlugin.kConfigKey]! as WindowsPlugin;
|
||||
expect(windowsPlugin.supportedVariants, <PluginPlatformVariant>{
|
||||
PluginPlatformVariant.winuwp,
|
||||
});
|
||||
expect(windowsPlugin.supportedVariants, <PluginPlatformVariant>{});
|
||||
});
|
||||
|
||||
testWithoutContext('Plugin parsing throws a fatal error on an empty plugin', () {
|
||||
|
||||
@@ -1682,9 +1682,6 @@ class FakeFlutterProject extends Fake implements FlutterProject {
|
||||
|
||||
@override
|
||||
WindowsProject windows;
|
||||
|
||||
@override
|
||||
WindowsUwpProject windowsUwp;
|
||||
}
|
||||
|
||||
class FakeMacOSProject extends Fake implements MacOSProject {
|
||||
|
||||
@@ -93,31 +93,6 @@ void main() {
|
||||
expect(logger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
||||
});
|
||||
|
||||
testWithoutContext('treats winuwp_debug_unopt as a host engine', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final Directory localEngine = fileSystem
|
||||
.directory('$kArbitraryEngineRoot/src/out/winuwp_debug_unopt/')
|
||||
..createSync(recursive: true);
|
||||
fileSystem.directory('$kArbitraryEngineRoot/src/out/winuwp_debug_unopt/').createSync(recursive: true);
|
||||
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final LocalEngineLocator localEngineLocator = LocalEngineLocator(
|
||||
fileSystem: fileSystem,
|
||||
flutterRoot: 'flutter/flutter',
|
||||
logger: logger,
|
||||
userMessages: UserMessages(),
|
||||
platform: FakePlatform(environment: <String, String>{}),
|
||||
);
|
||||
|
||||
expect(
|
||||
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||
matchesEngineBuildPaths(
|
||||
hostEngine: '/arbitrary/engine/src/out/winuwp_debug_unopt',
|
||||
targetEngine: '/arbitrary/engine/src/out/winuwp_debug_unopt',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('works if --local-engine is specified and --local-engine-src-path '
|
||||
'is determined by --local-engine', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/windows/install_manifest.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
import '../../src/context.dart';
|
||||
|
||||
final Platform platform = FakePlatform(operatingSystem: 'windows');
|
||||
|
||||
void main() {
|
||||
FileSystem fileSystem;
|
||||
|
||||
setUp(() {
|
||||
fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
|
||||
});
|
||||
|
||||
testUsingContext('Generates install manifest for a debug build', () async {
|
||||
final Logger logger = BufferLogger.test();
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final Directory buildDirectory = fileSystem.currentDirectory
|
||||
.childDirectory('build')
|
||||
.childDirectory('winuwp');
|
||||
|
||||
await createManifest(
|
||||
logger: logger,
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
project: flutterProject.windowsUwp,
|
||||
buildDirectory: buildDirectory,
|
||||
buildInfo: BuildInfo.debug,
|
||||
);
|
||||
|
||||
final File manifest = flutterProject.windowsUwp.ephemeralDirectory.childFile('install_manifest');
|
||||
expect(manifest, exists);
|
||||
expect(manifest.readAsLinesSync(), unorderedEquals(<String>[
|
||||
'C:/build/flutter_assets/kernel_blob.bin',
|
||||
'C:/build/flutter_assets/AssetManifest.json',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb',
|
||||
'C:/winuwp/flutter/ephemeral/icudtl.dat',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('Generates install manifest for a release build', () async {
|
||||
final Logger logger = BufferLogger.test();
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final Directory buildDirectory = fileSystem.currentDirectory
|
||||
.childDirectory('build')
|
||||
.childDirectory('winuwp');
|
||||
|
||||
await createManifest(
|
||||
logger: logger,
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
project: flutterProject.windowsUwp,
|
||||
buildDirectory: buildDirectory,
|
||||
buildInfo: BuildInfo.release,
|
||||
);
|
||||
|
||||
final File manifest = flutterProject.windowsUwp.ephemeralDirectory.childFile('install_manifest');
|
||||
expect(manifest, exists);
|
||||
expect(manifest.readAsLinesSync(), unorderedEquals(<String>[
|
||||
'C:/build/winuwp/app.so',
|
||||
'C:/build/flutter_assets/AssetManifest.json',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb',
|
||||
'C:/winuwp/flutter/ephemeral/icudtl.dat'
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
|
||||
testUsingContext('Generates install manifest for a release build with assets', () async {
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
final Directory buildDirectory = fileSystem.currentDirectory
|
||||
.childDirectory('build')
|
||||
.childDirectory('winuwp');
|
||||
|
||||
fileSystem.currentDirectory.childDirectory('.dart_tool').childFile('package_config.json')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('''
|
||||
{
|
||||
"configVersion": 2,
|
||||
"packages": []
|
||||
}
|
||||
|
||||
''');
|
||||
fileSystem.currentDirectory.childFile('pubspec.yaml')
|
||||
..createSync()
|
||||
..writeAsStringSync('''
|
||||
name: foo
|
||||
|
||||
flutter:
|
||||
assets:
|
||||
- assets/foo.png
|
||||
|
||||
''');
|
||||
fileSystem.currentDirectory
|
||||
.childDirectory('assets')
|
||||
.childFile('foo.png')
|
||||
.createSync(recursive: true);
|
||||
|
||||
await createManifest(
|
||||
logger: logger,
|
||||
fileSystem: fileSystem,
|
||||
platform: platform,
|
||||
project: flutterProject.windowsUwp,
|
||||
buildDirectory: buildDirectory,
|
||||
buildInfo: BuildInfo.release,
|
||||
);
|
||||
|
||||
final File manifest = flutterProject.windowsUwp.ephemeralDirectory.childFile('install_manifest');
|
||||
expect(manifest, exists);
|
||||
expect(manifest.readAsLinesSync(), unorderedEquals(<String>[
|
||||
'C:/build/winuwp/app.so',
|
||||
'C:/build/flutter_assets/assets/foo.png',
|
||||
'C:/build/flutter_assets/AssetManifest.json',
|
||||
'C:/build/flutter_assets/FontManifest.json',
|
||||
'C:/build/flutter_assets/NOTICES.Z',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll',
|
||||
'C:/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb',
|
||||
'C:/winuwp/flutter/ephemeral/icudtl.dat'
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
});
|
||||
}
|
||||
@@ -13,7 +13,6 @@ 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();
|
||||
|
||||
@@ -63,94 +62,8 @@ void main() {
|
||||
contains('#include <test/foo.h>'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('UWP injects plugins marked as UWP-compatible', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
setUpProject(fileSystem);
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
await writeWindowsUwpPluginFiles(flutterProject, <Plugin>[
|
||||
Plugin(
|
||||
name: 'test',
|
||||
path: 'foo',
|
||||
defaultPackagePlatforms: const <String, String>{},
|
||||
pluginDartClassPlatforms: const <String, String>{},
|
||||
platforms: const <String, PluginPlatform>{
|
||||
WindowsPlugin.kConfigKey: WindowsPlugin(
|
||||
name: 'test',
|
||||
pluginClass: 'Foo',
|
||||
variants: <PluginPlatformVariant>{PluginPlatformVariant.winuwp},
|
||||
)},
|
||||
dependencies: <String>[],
|
||||
isDirectDependency: true,
|
||||
),
|
||||
], renderer);
|
||||
|
||||
final Directory managed = flutterProject.windowsUwp.managedDirectory;
|
||||
expect(flutterProject.windowsUwp.generatedPluginCmakeFile, exists);
|
||||
expect(managed.childFile('generated_plugin_registrant.h'), exists);
|
||||
expect(
|
||||
managed.childFile('generated_plugin_registrant.cc').readAsStringSync(),
|
||||
contains('#include <test/foo.h>'),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('UWP does not inject Win32-only plugins', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
setUpProject(fileSystem);
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
await writeWindowsUwpPluginFiles(flutterProject, <Plugin>[
|
||||
Plugin(
|
||||
name: 'test',
|
||||
path: 'foo',
|
||||
defaultPackagePlatforms: const <String, String>{},
|
||||
pluginDartClassPlatforms: const <String, String>{},
|
||||
platforms: const <String, PluginPlatform>{
|
||||
WindowsPlugin.kConfigKey: WindowsPlugin(
|
||||
name: 'test',
|
||||
pluginClass: 'Foo',
|
||||
variants: <PluginPlatformVariant>{PluginPlatformVariant.win32},
|
||||
)},
|
||||
dependencies: <String>[],
|
||||
isDirectDependency: true,
|
||||
),
|
||||
], renderer);
|
||||
|
||||
final Directory managed = flutterProject.windowsUwp.managedDirectory;
|
||||
expect(flutterProject.windowsUwp.generatedPluginCmakeFile, exists);
|
||||
expect(managed.childFile('generated_plugin_registrant.h'), exists);
|
||||
expect(
|
||||
managed.childFile('generated_plugin_registrant.cc').readAsStringSync(),
|
||||
isNot(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');
|
||||
}
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
|
||||
import '../../src/common.dart';
|
||||
|
||||
const String kExampleManifest = r'''
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity Name="@PACKAGE_GUID@" Publisher="CN=CMake Test Cert" Version="2.3.1.4" />
|
||||
<mp:PhoneIdentity PhoneProductId="@PACKAGE_GUID@" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>@SHORT_NAME@</DisplayName>
|
||||
<PublisherDisplayName>CMake Test Cert</PublisherDisplayName>
|
||||
<Logo>Assets/StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.65535.65535" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="@SHORT_NAME@"
|
||||
Description="@SHORT_NAME@"
|
||||
BackgroundColor="#336699"
|
||||
Square150x150Logo="Assets/Square150x150Logo.png"
|
||||
Square44x44Logo="Assets/Square44x44Logo.png"
|
||||
>
|
||||
<uap:SplashScreen Image="Assets/SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClientServer"/>
|
||||
<Capability Name="internetClient"/>
|
||||
<Capability Name="privateNetworkClientServer"/>
|
||||
<Capability Name="codeGeneration"/></Capabilities>
|
||||
</Package>
|
||||
''';
|
||||
|
||||
void main() {
|
||||
testWithoutContext('Project can parse the app version from the appx manifest', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.file('winuwp/runner_uwp/appxmanifest.in')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(kExampleManifest);
|
||||
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
expect(flutterProject.windowsUwp.packageVersion, '2.3.1.4');
|
||||
});
|
||||
|
||||
testWithoutContext('Project returns null if appx manifest does not exist', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
expect(flutterProject.windowsUwp.packageVersion, null);
|
||||
});
|
||||
|
||||
testWithoutContext('Project throws a tool exit if appxmanifest is not valid xml', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.file('winuwp/runner_uwp/appxmanifest.in')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync('[');
|
||||
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
expect(() => flutterProject.windowsUwp.packageVersion, throwsToolExit());
|
||||
});
|
||||
|
||||
testWithoutContext('Can parse the PACKAGE_GUID from the Cmake manifest', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.file('winuwp/runner_uwp/CMakeLists.txt')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(r'''
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
set(CMAKE_SYSTEM_NAME WindowsStore)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
project ("TestBedUWP")
|
||||
|
||||
set(APP_MANIFEST_NAME Package.appxmanifest)
|
||||
set(APP_MANIFEST_TARGET_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME})
|
||||
set(SHORT_NAME ${BINARY_NAME})
|
||||
set(PACKAGE_GUID "F941A77F-8AE1-4E3E-9611-68FBD3C62AE8")
|
||||
|
||||
''');
|
||||
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
expect(flutterProject.windowsUwp.packageGuid, 'F941A77F-8AE1-4E3E-9611-68FBD3C62AE8');
|
||||
});
|
||||
|
||||
testWithoutContext('Returns null if the PACKAGE_GUID cannot be found in the Cmake file', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
fileSystem.file('winuwp/runner_uwp/CMakeLists.txt')
|
||||
..createSync(recursive: true)
|
||||
..writeAsStringSync(r'''
|
||||
cmake_minimum_required (VERSION 3.8)
|
||||
set(CMAKE_SYSTEM_NAME WindowsStore)
|
||||
set(CMAKE_SYSTEM_VERSION 10.0)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED YES)
|
||||
|
||||
include(CMakePrintHelpers)
|
||||
|
||||
project ("TestBedUWP")
|
||||
|
||||
set(APP_MANIFEST_NAME Package.appxmanifest)
|
||||
set(APP_MANIFEST_TARGET_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME})
|
||||
set(SHORT_NAME ${BINARY_NAME})
|
||||
''');
|
||||
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectoryTest(fileSystem.currentDirectory);
|
||||
|
||||
expect(flutterProject.windowsUwp.packageGuid, null);
|
||||
});
|
||||
}
|
||||
@@ -9,12 +9,9 @@ import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/features.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/windows/application_package.dart';
|
||||
import 'package:flutter_tools/src/windows/uwptool.dart';
|
||||
import 'package:flutter_tools/src/windows/windows_device.dart';
|
||||
import 'package:flutter_tools/src/windows/windows_workflow.dart';
|
||||
import 'package:test/fake.dart';
|
||||
@@ -42,46 +39,16 @@ void main() {
|
||||
expect(windowsDevice.supportsRuntimeMode(BuildMode.jitRelease), false);
|
||||
});
|
||||
|
||||
testWithoutContext('WindowsUwpDevice defaults', () async {
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
expect(await windowsDevice.targetPlatform, TargetPlatform.windows_uwp_x64);
|
||||
expect(windowsDevice.name, 'Windows (UWP)');
|
||||
expect(await windowsDevice.installApp(package), true);
|
||||
expect(await windowsDevice.uninstallApp(package), true);
|
||||
expect(await windowsDevice.isLatestBuildInstalled(package), false);
|
||||
expect(await windowsDevice.isAppInstalled(package), false);
|
||||
expect(windowsDevice.category, Category.desktop);
|
||||
|
||||
expect(windowsDevice.supportsRuntimeMode(BuildMode.debug), true);
|
||||
expect(windowsDevice.supportsRuntimeMode(BuildMode.profile), true);
|
||||
expect(windowsDevice.supportsRuntimeMode(BuildMode.release), true);
|
||||
expect(windowsDevice.supportsRuntimeMode(BuildMode.jitRelease), false);
|
||||
});
|
||||
|
||||
testWithoutContext('WindowsDevices does not list devices if the workflow is unsupported', () async {
|
||||
expect(await WindowsDevices(
|
||||
windowsWorkflow: WindowsWorkflow(
|
||||
featureFlags: TestFeatureFlags(),
|
||||
platform: FakePlatform(operatingSystem: 'windows'),
|
||||
),
|
||||
featureFlags: TestFeatureFlags(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
uwptool: FakeUwpTool(),
|
||||
).devices, <Device>[]);
|
||||
});
|
||||
|
||||
@@ -95,61 +62,9 @@ void main() {
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
featureFlags: TestFeatureFlags(isWindowsEnabled: true),
|
||||
uwptool: FakeUwpTool(),
|
||||
).devices, hasLength(1));
|
||||
});
|
||||
|
||||
testWithoutContext('WindowsDevices lists a UWP Windows device if feature is enabled', () async {
|
||||
final FeatureFlags featureFlags = TestFeatureFlags(isWindowsEnabled: true, isWindowsUwpEnabled: true);
|
||||
expect(await WindowsDevices(
|
||||
windowsWorkflow: WindowsWorkflow(
|
||||
featureFlags: featureFlags,
|
||||
platform: FakePlatform(operatingSystem: 'windows')
|
||||
),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
featureFlags: featureFlags,
|
||||
uwptool: FakeUwpTool(),
|
||||
).devices, hasLength(2));
|
||||
});
|
||||
|
||||
testWithoutContext('WindowsDevices has windows and winuwp well known devices', () async {
|
||||
final FeatureFlags featureFlags = TestFeatureFlags(isWindowsEnabled: true, isWindowsUwpEnabled: true);
|
||||
expect(WindowsDevices(
|
||||
windowsWorkflow: WindowsWorkflow(
|
||||
featureFlags: featureFlags,
|
||||
platform: FakePlatform(operatingSystem: 'windows')
|
||||
),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
featureFlags: featureFlags,
|
||||
uwptool: FakeUwpTool(),
|
||||
).wellKnownIds, <String>['windows', 'winuwp']);
|
||||
});
|
||||
|
||||
testWithoutContext('WindowsDevices ignores the timeout provided to discoverDevices', () async {
|
||||
final WindowsDevices windowsDevices = WindowsDevices(
|
||||
windowsWorkflow: WindowsWorkflow(
|
||||
featureFlags: TestFeatureFlags(isWindowsEnabled: true),
|
||||
platform: FakePlatform(operatingSystem: 'windows')
|
||||
),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
logger: BufferLogger.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
featureFlags: TestFeatureFlags(isWindowsEnabled: true),
|
||||
uwptool: FakeUwpTool(),
|
||||
);
|
||||
// Timeout ignored.
|
||||
final List<Device> devices = await windowsDevices.discoverDevices(timeout: const Duration(seconds: 10));
|
||||
expect(devices, hasLength(1));
|
||||
});
|
||||
|
||||
testWithoutContext('isSupportedForProject is true with editable host app', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsDevice windowsDevice = setUpWindowsDevice(fileSystem: fileSystem);
|
||||
@@ -191,196 +106,6 @@ void main() {
|
||||
expect(windowsDevice.executablePathForDevice(fakeApp, BuildMode.profile), 'profile/executable');
|
||||
expect(windowsDevice.executablePathForDevice(fakeApp, BuildMode.release), 'release/executable');
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice installs cert if not installed', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
uwptool.hasValidSignature = false;
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
final bool result = await windowsDevice.installApp(package);
|
||||
|
||||
expect(result, isTrue);
|
||||
expect(uwptool.installCertRequests, hasLength(1));
|
||||
expect(uwptool.installAppRequests, hasLength(1));
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice does not install cert if not installed', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
uwptool.hasValidSignature = true;
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
final bool result = await windowsDevice.installApp(package);
|
||||
|
||||
expect(result, isTrue);
|
||||
expect(uwptool.installCertRequests, isEmpty);
|
||||
expect(uwptool.installAppRequests, hasLength(1));
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice prefers installing multi-arch binaries', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
final String singleArchPath = fileSystem.path.absolute(fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
));
|
||||
fileSystem.file(singleArchPath).createSync(recursive:true);
|
||||
final String multiArchPath = fileSystem.path.absolute(fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_Debug_Test', 'testapp_1.2.3.4_Debug.msix',
|
||||
));
|
||||
fileSystem.file(multiArchPath).createSync(recursive:true);
|
||||
final bool result = await windowsDevice.installApp(package);
|
||||
|
||||
expect(result, isTrue);
|
||||
expect(uwptool.installAppRequests.single.packageUri, Uri.file(multiArchPath).toString());
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice falls back to installing single-arch binaries', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
final String singleArchPath = fileSystem.path.absolute(fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
));
|
||||
fileSystem.file(singleArchPath).createSync(recursive:true);
|
||||
final bool result = await windowsDevice.installApp(package);
|
||||
|
||||
expect(result, isTrue);
|
||||
expect(uwptool.installAppRequests.single.packageUri, Uri.file(singleArchPath).toString());
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice can launch application if cert is installed', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
uwptool.hasValidSignature = true;
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
final LaunchResult result = await windowsDevice.startApp(
|
||||
package,
|
||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
||||
prebuiltApplication: true,
|
||||
platformArgs: <String, Object>{},
|
||||
);
|
||||
|
||||
expect(result.started, true);
|
||||
expect(uwptool.installCertRequests, isEmpty);
|
||||
expect(uwptool.launchAppRequests.single.packageFamily, 'PACKAGE-ID_publisher');
|
||||
expect(uwptool.launchAppRequests.single.args, <String>[
|
||||
'--observatory-port=12345',
|
||||
'--disable-service-auth-codes',
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice installs cert and can launch application if cert not installed', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
uwptool.hasValidSignature = false;
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Debug_Test', 'testapp_1.2.3.4_x64_Debug.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
final LaunchResult result = await windowsDevice.startApp(
|
||||
package,
|
||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
||||
prebuiltApplication: true,
|
||||
platformArgs: <String, Object>{},
|
||||
);
|
||||
|
||||
expect(result.started, true);
|
||||
expect(uwptool.installCertRequests, isNotEmpty);
|
||||
expect(uwptool.launchAppRequests.single.packageFamily, 'PACKAGE-ID_publisher');
|
||||
expect(uwptool.launchAppRequests.single.args, <String>[
|
||||
'--observatory-port=12345',
|
||||
'--disable-service-auth-codes',
|
||||
'--enable-dart-profiling',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
]);
|
||||
});
|
||||
|
||||
testWithoutContext('WinUWPDevice can launch application in release mode', () async {
|
||||
Cache.flutterRoot = '';
|
||||
final FakeUwpTool uwptool = FakeUwpTool();
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final WindowsUWPDevice windowsDevice = setUpWindowsUwpDevice(
|
||||
fileSystem: fileSystem,
|
||||
uwptool: uwptool,
|
||||
);
|
||||
final FakeBuildableUwpApp package = FakeBuildableUwpApp();
|
||||
|
||||
final String packagePath = fileSystem.path.join(
|
||||
'build', 'winuwp', 'runner_uwp', 'AppPackages', 'testapp',
|
||||
'testapp_1.2.3.4_x64_Release_Test', 'testapp_1.2.3.4_x64_Release.msix',
|
||||
);
|
||||
fileSystem.file(packagePath).createSync(recursive:true);
|
||||
final LaunchResult result = await windowsDevice.startApp(
|
||||
package,
|
||||
debuggingOptions: DebuggingOptions.enabled(BuildInfo.release),
|
||||
prebuiltApplication: true,
|
||||
platformArgs: <String, Object>{},
|
||||
);
|
||||
|
||||
expect(result.started, true);
|
||||
expect(uwptool.launchAppRequests.single.packageFamily, 'PACKAGE-ID_publisher');
|
||||
expect(uwptool.launchAppRequests.single.args, <String>[]);
|
||||
});
|
||||
}
|
||||
|
||||
FlutterProject setUpFlutterProject(Directory directory) {
|
||||
@@ -404,119 +129,7 @@ WindowsDevice setUpWindowsDevice({
|
||||
);
|
||||
}
|
||||
|
||||
WindowsUWPDevice setUpWindowsUwpDevice({
|
||||
FileSystem fileSystem,
|
||||
Logger logger,
|
||||
ProcessManager processManager,
|
||||
UwpTool uwptool,
|
||||
}) {
|
||||
return WindowsUWPDevice(
|
||||
fileSystem: fileSystem ?? MemoryFileSystem.test(),
|
||||
logger: logger ?? BufferLogger.test(),
|
||||
processManager: processManager ?? FakeProcessManager.any(),
|
||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||
uwptool: uwptool ?? FakeUwpTool(),
|
||||
);
|
||||
}
|
||||
|
||||
class FakeWindowsApp extends Fake implements WindowsApp {
|
||||
@override
|
||||
String executable(BuildMode buildMode) => '${buildMode.name}/executable';
|
||||
}
|
||||
|
||||
class FakeBuildableUwpApp extends Fake implements BuildableUwpApp {
|
||||
@override
|
||||
String get id => 'PACKAGE-ID';
|
||||
@override
|
||||
String get name => 'testapp';
|
||||
@override
|
||||
String get projectVersion => '1.2.3.4';
|
||||
|
||||
// Test helper to get the expected package family.
|
||||
static const String packageFamily = 'PACKAGE-ID_publisher';
|
||||
}
|
||||
|
||||
class FakeUwpTool implements UwpTool {
|
||||
bool isInstalled = false;
|
||||
bool hasValidSignature = false;
|
||||
final List<_GetPackageFamilyRequest> getPackageFamilyRequests = <_GetPackageFamilyRequest>[];
|
||||
final List<_LaunchAppRequest> launchAppRequests = <_LaunchAppRequest>[];
|
||||
final List<_InstallCertRequest> installCertRequests = <_InstallCertRequest>[];
|
||||
final List<_InstallAppRequest> installAppRequests = <_InstallAppRequest>[];
|
||||
final List<_UninstallAppRequest> uninstallAppRequests = <_UninstallAppRequest>[];
|
||||
|
||||
@override
|
||||
Future<List<String>> listApps() async {
|
||||
return isInstalled ? <String>[FakeBuildableUwpApp.packageFamily] : <String>[];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String/*?*/> getPackageFamilyName(String packageName) async {
|
||||
getPackageFamilyRequests.add(_GetPackageFamilyRequest(packageName));
|
||||
return isInstalled ? FakeBuildableUwpApp.packageFamily : null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int/*?*/> launchApp(String packageFamily, List<String> args) async {
|
||||
launchAppRequests.add(_LaunchAppRequest(packageFamily, args));
|
||||
return 42;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> isSignatureValid(String packagePath) async {
|
||||
return hasValidSignature;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> installCertificate(String certificatePath) async {
|
||||
installCertRequests.add(_InstallCertRequest(certificatePath));
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> installApp(String packageUri, List<String> dependencyUris) async {
|
||||
installAppRequests.add(_InstallAppRequest(packageUri, dependencyUris));
|
||||
isInstalled = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> uninstallApp(String packageFamily) async {
|
||||
uninstallAppRequests.add(_UninstallAppRequest(packageFamily));
|
||||
isInstalled = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class _GetPackageFamilyRequest {
|
||||
const _GetPackageFamilyRequest(this.packageId);
|
||||
|
||||
final String packageId;
|
||||
}
|
||||
|
||||
class _LaunchAppRequest {
|
||||
const _LaunchAppRequest(this.packageFamily, this.args);
|
||||
|
||||
final String packageFamily;
|
||||
final List<String> args;
|
||||
}
|
||||
|
||||
class _InstallCertRequest {
|
||||
const _InstallCertRequest(this.certificatePath);
|
||||
|
||||
final String certificatePath;
|
||||
}
|
||||
|
||||
|
||||
class _InstallAppRequest {
|
||||
const _InstallAppRequest(this.packageUri, this.dependencyUris);
|
||||
|
||||
final String packageUri;
|
||||
final List<String> dependencyUris;
|
||||
}
|
||||
|
||||
class _UninstallAppRequest {
|
||||
const _UninstallAppRequest(this.packageFamily);
|
||||
|
||||
final String packageFamily;
|
||||
}
|
||||
|
||||
@@ -425,7 +425,6 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
this.isIOSEnabled = true,
|
||||
this.isFuchsiaEnabled = false,
|
||||
this.areCustomDevicesEnabled = false,
|
||||
this.isWindowsUwpEnabled = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -455,9 +454,6 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
@override
|
||||
final bool areCustomDevicesEnabled;
|
||||
|
||||
@override
|
||||
final bool isWindowsUwpEnabled;
|
||||
|
||||
@override
|
||||
bool isEnabled(Feature feature) {
|
||||
switch (feature) {
|
||||
@@ -479,8 +475,6 @@ class TestFeatureFlags implements FeatureFlags {
|
||||
return isFuchsiaEnabled;
|
||||
case flutterCustomDevicesFeature:
|
||||
return areCustomDevicesEnabled;
|
||||
case windowsUwpEmbedding:
|
||||
return isWindowsUwpEnabled;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user