Implement iOS app install deltas (#77756)
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/logger.dart';
|
||||
@@ -23,10 +25,12 @@ import '../../src/fakes.dart';
|
||||
void main () {
|
||||
Artifacts artifacts;
|
||||
String iosDeployPath;
|
||||
FileSystem fileSystem;
|
||||
|
||||
setUp(() {
|
||||
artifacts = Artifacts.test();
|
||||
iosDeployPath = artifacts.getArtifactPath(Artifact.iosDeploy, platform: TargetPlatform.ios);
|
||||
fileSystem = MemoryFileSystem.test();
|
||||
});
|
||||
|
||||
testWithoutContext('IOSDeploy.iosDeployEnv returns path with /usr/bin first', () {
|
||||
@@ -50,6 +54,8 @@ void main () {
|
||||
'123',
|
||||
'--bundle',
|
||||
'/',
|
||||
'--app_deltas',
|
||||
'app-delta',
|
||||
'--debug',
|
||||
'--args',
|
||||
<String>[
|
||||
@@ -62,10 +68,12 @@ void main () {
|
||||
stdout: '(lldb) run\nsuccess\nDid finish launching.',
|
||||
),
|
||||
]);
|
||||
final Directory appDeltaDirectory = fileSystem.directory('app-delta');
|
||||
final IOSDeploy iosDeploy = setUpIOSDeploy(processManager, artifacts: artifacts);
|
||||
final IOSDeployDebugger iosDeployDebugger = iosDeploy.prepareDebuggerForLaunch(
|
||||
deviceId: '123',
|
||||
bundlePath: '/',
|
||||
appDeltaDirectory: appDeltaDirectory,
|
||||
launchArguments: <String>['--enable-dart-profiling'],
|
||||
interfaceType: IOSDeviceInterface.network,
|
||||
);
|
||||
@@ -73,6 +81,7 @@ void main () {
|
||||
expect(await iosDeployDebugger.launchAndAttach(), isTrue);
|
||||
expect(await iosDeployDebugger.logLines.toList(), <String>['Did finish launching.']);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
expect(appDeltaDirectory, exists);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// @dart = 2.8
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:file_testing/file_testing.dart';
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
import 'package:flutter_tools/src/artifacts.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
@@ -119,10 +120,22 @@ void main() {
|
||||
setUpIOSProject(fileSystem);
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||
final BuildableIOSApp buildableIOSApp = BuildableIOSApp(flutterProject.ios, 'flutter', 'My Super Awesome App.app');
|
||||
fileSystem.directory('build/ios/Release-iphoneos/My Super Awesome App.app').createSync(recursive: true);
|
||||
|
||||
processManager.addCommand(FakeCommand(command: _xattrArgs(flutterProject)));
|
||||
processManager.addCommand(const FakeCommand(command: kRunReleaseArgs));
|
||||
processManager.addCommand(const FakeCommand(command: <String>[...kRunReleaseArgs, '-showBuildSettings']));
|
||||
processManager.addCommand(const FakeCommand(command: <String>[...kRunReleaseArgs, '-showBuildSettings'], stdout: r'''
|
||||
TARGET_BUILD_DIR=build/ios/Release-iphoneos
|
||||
WRAPPER_NAME=My Super Awesome App.app
|
||||
'''
|
||||
));
|
||||
processManager.addCommand(const FakeCommand(command: <String>[
|
||||
'rsync',
|
||||
'-av',
|
||||
'--delete',
|
||||
'build/ios/Release-iphoneos/My Super Awesome App.app',
|
||||
'build/ios/iphoneos',
|
||||
]));
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
iosDeployPath,
|
||||
@@ -130,6 +143,8 @@ void main() {
|
||||
'123',
|
||||
'--bundle',
|
||||
'build/ios/iphoneos/My Super Awesome App.app',
|
||||
'--app_deltas',
|
||||
'build/ios/app-delta',
|
||||
'--no-wifi',
|
||||
'--justlaunch',
|
||||
'--args',
|
||||
@@ -146,6 +161,7 @@ void main() {
|
||||
platformArgs: <String, Object>{},
|
||||
);
|
||||
|
||||
expect(fileSystem.directory('build/ios/iphoneos'), exists);
|
||||
expect(launchResult.started, true);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
}, overrides: <Type, Generator>{
|
||||
@@ -169,6 +185,7 @@ void main() {
|
||||
setUpIOSProject(fileSystem);
|
||||
final FlutterProject flutterProject = FlutterProject.fromDirectory(fileSystem.currentDirectory);
|
||||
final BuildableIOSApp buildableIOSApp = BuildableIOSApp(flutterProject.ios, 'flutter', 'My Super Awesome App.app');
|
||||
fileSystem.directory('build/ios/Release-iphoneos/My Super Awesome App.app').createSync(recursive: true);
|
||||
|
||||
processManager.addCommand(FakeCommand(command: _xattrArgs(flutterProject)));
|
||||
processManager.addCommand(const FakeCommand(command: kRunReleaseArgs));
|
||||
@@ -183,7 +200,18 @@ void main() {
|
||||
const FakeCommand(
|
||||
command: <String>[...kRunReleaseArgs, '-showBuildSettings'],
|
||||
exitCode: 0,
|
||||
stdout: r'''
|
||||
TARGET_BUILD_DIR=build/ios/Release-iphoneos
|
||||
WRAPPER_NAME=My Super Awesome App.app
|
||||
'''
|
||||
));
|
||||
processManager.addCommand(const FakeCommand(command: <String>[
|
||||
'rsync',
|
||||
'-av',
|
||||
'--delete',
|
||||
'build/ios/Release-iphoneos/My Super Awesome App.app',
|
||||
'build/ios/iphoneos',
|
||||
]));
|
||||
processManager.addCommand(FakeCommand(
|
||||
command: <String>[
|
||||
iosDeployPath,
|
||||
@@ -191,6 +219,8 @@ void main() {
|
||||
'123',
|
||||
'--bundle',
|
||||
'build/ios/iphoneos/My Super Awesome App.app',
|
||||
'--app_deltas',
|
||||
'build/ios/app-delta',
|
||||
'--no-wifi',
|
||||
'--justlaunch',
|
||||
'--args',
|
||||
@@ -221,6 +251,7 @@ void main() {
|
||||
});
|
||||
|
||||
expect(launchResult?.started, true);
|
||||
expect(fileSystem.directory('build/ios/iphoneos'), exists);
|
||||
expect(processManager.hasRemainingExpectations, false);
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => processManager,
|
||||
|
||||
Reference in New Issue
Block a user