mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Hide default bundle id error when xcresult detects an error (#101993)
This commit is contained in:
parent
1756ccc541
commit
a8da7ced35
@ -581,16 +581,6 @@ Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result, Usage flutterUsa
|
|||||||
// Fallback to use stdout to detect and print issues.
|
// Fallback to use stdout to detect and print issues.
|
||||||
_parseIssueInStdout(xcodeBuildExecution, logger, result);
|
_parseIssueInStdout(xcodeBuildExecution, logger, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xcodeBuildExecution != null
|
|
||||||
&& xcodeBuildExecution.environmentType == EnvironmentType.physical
|
|
||||||
&& (xcodeBuildExecution.buildSettings['PRODUCT_BUNDLE_IDENTIFIER']?.contains('com.example') ?? false)) {
|
|
||||||
logger.printError('');
|
|
||||||
logger.printError('It appears that your application still contains the default signing identifier.');
|
|
||||||
logger.printError("Try replacing 'com.example' with your signing id in Xcode:");
|
|
||||||
logger.printError(' open ios/Runner.xcworkspace');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// xcodebuild <buildaction> parameter (see man xcodebuild for details).
|
/// xcodebuild <buildaction> parameter (see man xcodebuild for details).
|
||||||
@ -757,6 +747,14 @@ bool _handleIssues(XCResult? xcResult, Logger logger, XcodeBuildExecution? xcode
|
|||||||
logger.printError('');
|
logger.printError('');
|
||||||
logger.printError("Also try selecting 'Product > Build' to fix the problem.");
|
logger.printError("Also try selecting 'Product > Build' to fix the problem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!issueDetected && _needUpdateSigningIdentifier(xcodeBuildExecution)) {
|
||||||
|
issueDetected = true;
|
||||||
|
logger.printError('');
|
||||||
|
logger.printError('It appears that your application still contains the default signing identifier.');
|
||||||
|
logger.printError("Try replacing 'com.example' with your signing id in Xcode:");
|
||||||
|
logger.printError(' open ios/Runner.xcworkspace');
|
||||||
|
}
|
||||||
return issueDetected;
|
return issueDetected;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,6 +767,14 @@ bool _missingDevelopmentTeam(XcodeBuildExecution? xcodeBuildExecution) {
|
|||||||
!<String>['DEVELOPMENT_TEAM', 'PROVISIONING_PROFILE'].any(
|
!<String>['DEVELOPMENT_TEAM', 'PROVISIONING_PROFILE'].any(
|
||||||
xcodeBuildExecution.buildSettings.containsKey);
|
xcodeBuildExecution.buildSettings.containsKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return `true` if the signing identifier needs to be updated.
|
||||||
|
bool _needUpdateSigningIdentifier(XcodeBuildExecution? xcodeBuildExecution) {
|
||||||
|
return xcodeBuildExecution != null
|
||||||
|
&& xcodeBuildExecution.environmentType == EnvironmentType.physical
|
||||||
|
&& (xcodeBuildExecution.buildSettings['PRODUCT_BUNDLE_IDENTIFIER']?.contains('com.example') ?? false);
|
||||||
|
}
|
||||||
|
|
||||||
// Detects and handles errors from stdout.
|
// Detects and handles errors from stdout.
|
||||||
//
|
//
|
||||||
// As detecting issues in stdout is not usually accurate, this should be used as a fallback when other issue detecting methods failed.
|
// As detecting issues in stdout is not usually accurate, this should be used as a fallback when other issue detecting methods failed.
|
||||||
|
@ -480,7 +480,7 @@ void main() {
|
|||||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('Display xcresult issues with default bundle identifier.', () async {
|
testUsingContext('Default bundle identifier error should be hidden if there is another xcresult issue.', () async {
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
|
|
||||||
_createMinimalMockProjectFiles();
|
_createMinimalMockProjectFiles();
|
||||||
@ -492,7 +492,7 @@ void main() {
|
|||||||
|
|
||||||
expect(testLogger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
expect(testLogger.errorText, contains("Use of undeclared identifier 'asdas'"));
|
||||||
expect(testLogger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
expect(testLogger.errorText, contains('/Users/m/Projects/test_create/ios/Runner/AppDelegate.m:7:56'));
|
||||||
expect(testLogger.errorText, contains('It appears that your application still contains the default signing identifier.'));
|
expect(testLogger.errorText, isNot(contains('It appears that your application still contains the default signing identifier.')));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
FileSystem: () => fileSystem,
|
FileSystem: () => fileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
@ -508,6 +508,33 @@ void main() {
|
|||||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(productBundleIdentifier: 'com.example'),
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(productBundleIdentifier: 'com.example'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('Show default bundle identifier error if there are no other errors.', () async {
|
||||||
|
final BuildCommand command = BuildCommand();
|
||||||
|
|
||||||
|
_createMinimalMockProjectFiles();
|
||||||
|
|
||||||
|
await expectLater(
|
||||||
|
createTestCommandRunner(command).run(const <String>['build', 'ios', '--no-pub']),
|
||||||
|
throwsToolExit(),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(testLogger.errorText, contains('It appears that your application still contains the default signing identifier.'));
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FileSystem: () => fileSystem,
|
||||||
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
|
xattrCommand,
|
||||||
|
_setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||||
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||||
|
}),
|
||||||
|
_setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
||||||
|
_setUpRsyncCommand(),
|
||||||
|
]),
|
||||||
|
Platform: () => macosPlatform,
|
||||||
|
EnvironmentType: () => EnvironmentType.physical,
|
||||||
|
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(productBundleIdentifier: 'com.example'),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
testUsingContext('Display xcresult issues with no provisioning profile.', () async {
|
testUsingContext('Display xcresult issues with no provisioning profile.', () async {
|
||||||
final BuildCommand command = BuildCommand();
|
final BuildCommand command = BuildCommand();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user