Wait for CONFIGURATION_BUILD_DIR to update when debugging with Xcode (#135444)
So there appears to be a race situation between the flutter CLI and Xcode. In the CLI, we update the `CONFIGURATION_BUILD_DIR` in the Xcode build settings and then tell Xcode to install, launch, and debug the app. When Xcode installs the app, it should use the `CONFIGURATION_BUILD_DIR` to find the bundle. However, it appears that sometimes Xcode hasn't processed the change to the build settings before the install happens, which causes it to not be able to find the bundle. Fixes https://github.com/flutter/flutter/issues/135442 --- Since it's a timing issue, there's not really a consistent way to test it. I was able to confirm that it works, though, by using the following steps: 1. Create a flutter project 2. Open the project in Xcode 3. `flutter clean` 4. `flutter run --profile -v` If I saw a print line `stderr: CONFIGURATION_BUILD_DIR: build/Debug-iphoneos`, that means it first found the old and incorrect `CONFIGURATION_BUILD_DIR` before updating to the the new, so I was able to confirm that it would wait until it updated.
This commit is contained in:
committed by
GitHub
parent
936763f589
commit
3cfe3720d6
@@ -472,6 +472,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: fileSystem.directory('/ios/Runner.xcworkspace'),
|
||||
xcodeProject: fileSystem.directory('/ios/Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
@@ -534,6 +535,8 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: fileSystem.directory('/ios/Runner.xcworkspace'),
|
||||
xcodeProject: fileSystem.directory('/ios/Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
expectedConfigurationBuildDir: '/build/ios/iphoneos',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
|
||||
@@ -713,6 +713,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: temporaryXcodeProjectDirectory.childDirectory('Runner.xcworkspace'),
|
||||
xcodeProject: temporaryXcodeProjectDirectory.childDirectory('Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
@@ -757,6 +758,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: temporaryXcodeProjectDirectory.childDirectory('Runner.xcworkspace'),
|
||||
xcodeProject: temporaryXcodeProjectDirectory.childDirectory('Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
@@ -817,6 +819,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: temporaryXcodeProjectDirectory.childDirectory('Runner.xcworkspace'),
|
||||
xcodeProject: temporaryXcodeProjectDirectory.childDirectory('Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
@@ -869,6 +872,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeWorkspace: temporaryXcodeProjectDirectory.childDirectory('Runner.xcworkspace'),
|
||||
xcodeProject: temporaryXcodeProjectDirectory.childDirectory('Runner.xcodeproj'),
|
||||
hostAppProjectName: 'Runner',
|
||||
),
|
||||
expectedDeviceId: '123',
|
||||
expectedLaunchArguments: <String>['--enable-dart-profiling'],
|
||||
|
||||
@@ -56,10 +56,11 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('succeeds in opening and debugging with launch options and verbose logging', () async {
|
||||
testWithoutContext('succeeds in opening and debugging with launch options, expectedConfigurationBuildDir, and verbose logging', () async {
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
@@ -88,6 +89,7 @@ void main() {
|
||||
pathToXcodeApp,
|
||||
'-g',
|
||||
'-j',
|
||||
'-F',
|
||||
xcworkspace.path
|
||||
],
|
||||
),
|
||||
@@ -105,6 +107,10 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--expected-configuration-build-dir',
|
||||
'/build/ios/iphoneos',
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -131,6 +137,8 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
expectedConfigurationBuildDir: '/build/ios/iphoneos',
|
||||
verboseLogging: true,
|
||||
);
|
||||
|
||||
@@ -150,7 +158,7 @@ void main() {
|
||||
expect(status, true);
|
||||
});
|
||||
|
||||
testWithoutContext('succeeds in opening and debugging without launch options and verbose logging', () async {
|
||||
testWithoutContext('succeeds in opening and debugging without launch options, expectedConfigurationBuildDir, and verbose logging', () async {
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
@@ -178,6 +186,7 @@ void main() {
|
||||
pathToXcodeApp,
|
||||
'-g',
|
||||
'-j',
|
||||
'-F',
|
||||
xcworkspace.path
|
||||
],
|
||||
),
|
||||
@@ -195,6 +204,8 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -257,6 +268,7 @@ void main() {
|
||||
pathToXcodeApp,
|
||||
'-g',
|
||||
'-j',
|
||||
'-F',
|
||||
xcworkspace.path
|
||||
],
|
||||
exception: ProcessException(
|
||||
@@ -266,6 +278,7 @@ void main() {
|
||||
'/non_existant_path',
|
||||
'-g',
|
||||
'-j',
|
||||
'-F',
|
||||
xcworkspace.path,
|
||||
],
|
||||
'The application /non_existant_path cannot be opened for an unexpected reason',
|
||||
@@ -332,6 +345,8 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -401,6 +416,8 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -474,6 +491,8 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -547,6 +566,8 @@ void main() {
|
||||
project.xcodeProject.path,
|
||||
'--workspace-path',
|
||||
project.xcodeWorkspace.path,
|
||||
'--project-name',
|
||||
project.hostAppProjectName,
|
||||
'--device-id',
|
||||
deviceId,
|
||||
'--scheme',
|
||||
@@ -674,6 +695,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
);
|
||||
final XcodeDebug xcodeDebug = XcodeDebug(
|
||||
logger: logger,
|
||||
@@ -731,6 +753,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
isTemporaryProject: true,
|
||||
);
|
||||
|
||||
@@ -794,6 +817,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
isTemporaryProject: true,
|
||||
);
|
||||
final XcodeDebug xcodeDebug = XcodeDebug(
|
||||
@@ -857,6 +881,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
);
|
||||
final XcodeDebug xcodeDebug = XcodeDebug(
|
||||
logger: logger,
|
||||
@@ -899,6 +924,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
isTemporaryProject: true,
|
||||
);
|
||||
final XcodeDebug xcodeDebug = XcodeDebug(
|
||||
@@ -950,6 +976,7 @@ void main() {
|
||||
scheme: 'Runner',
|
||||
xcodeProject: xcodeproj,
|
||||
xcodeWorkspace: xcworkspace,
|
||||
hostAppProjectName: 'Runner',
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user