Skip to content

Commit e98205f

Browse files
flutter_tools: correct iOS signing log for manual code signing (CODE_SIGN_STYLE=Manual) (#177852)
## Summary When running `flutter build ipa` with a project that uses manual code signing (`CODE_SIGN_STYLE=Manual`) for Release/Profile, the tool currently prints: ``` Automatically signing iOS for device deployment using specified development team in Xcode project: x ``` This is misleading in two ways: 1. The project is not using automatic signing for Release/Profile, it's explicitly using manual signing with a provisioning profile. 2. The build in this mode is typically for App Store/TestFlight distribution, not just device deployment. Users who rely on manual signing (for example, Push Notifications + Sign in with Apple entitlements) often hit an `xcodebuild -exportArchive` failure later (`"Runner.app" requires a provisioning profile ...`) and assume Flutter overrode their signing, because of this log line. This confusion has been reported in the context of `flutter build ipa` where archive succeeds but export fails, and Flutter's messaging doesn't match the actual signing setup. **Related issues:** - #106612 - Support `flutter build ipa` with manual signing and provisioning profiles - #113977 - Flutter build IPA with --export-options-plist not working ## What this change does * Before logging "Automatically signing iOS ...", we now check the active build configuration's `CODE_SIGN_STYLE`. * If the style is `Manual`, we suppress the automatic-signing message (since manual signing is not automatic). * If the style is `Automatic` or not set, we keep the original behavior. * No functional behavior of signing or export is changed. ## Before ``` Automatically signing iOS for device deployment using specified development team in Xcode project: x ``` (This message appears even when `CODE_SIGN_STYLE=Manual`) ## After ``` (No message when CODE_SIGN_STYLE=Manual, since signing is not automatic) ``` (The message only appears when `CODE_SIGN_STYLE=Automatic` or not set) ## Tests * Added test in `packages/flutter_tools/test/general.shard/ios/code_signing_test.dart` to assert we don't emit the automatic-signing message when `CODE_SIGN_STYLE=Manual`. * All existing tests pass (40/40 tests in code_signing_test.dart). ## Why this helps * Reduces confusion around manual signing / App Store export flows. * Matches expectations from users who configure provisioning profiles manually and expect Flutter to respect that configuration. * Prevents users from thinking Flutter is overriding their manual signing setup based on misleading log output. ## Breaking Changes None. This change only affects log output and does not modify any signing behavior, export behavior, or CLI interface. ## Verification Reviewers can verify this fix by: 1. Creating a test iOS project with `CODE_SIGN_STYLE=Manual` and `DEVELOPMENT_TEAM` set in Xcode project settings 2. Running `flutter build ipa --release --verbose` 3. Confirming the log does NOT show "Automatically signing iOS..." 4. Verifying the app still builds/signs correctly The included unit test covers this scenario automatically. --- Supersedes #177851 (that PR accidentally included unrelated commits from my fork history). This version only includes the intended change and tests. --------- Co-authored-by: Navaron Bracke <[email protected]>
1 parent 3762d2a commit e98205f

2 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎packages/flutter_tools/lib/src/ios/code_signing.dart‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,15 @@ Future<Map<String, String>?> getCodeSigningIdentityDevelopmentTeamBuildSetting({
157157
// If the user already has it set in the project build settings itself,
158158
// continue with that.
159159
if (_isNotEmpty(buildSettings[_developmentTeamBuildSettingName])) {
160-
logger.printStatus(
161-
'Automatically signing iOS for device deployment using specified development '
162-
'team in Xcode project: ${buildSettings[_developmentTeamBuildSettingName]}',
163-
);
160+
// Only log "Automatically signing..." if CODE_SIGN_STYLE is Automatic or not set.
161+
// If it's Manual, the signing is not automatic.
162+
final String? codeSignStyle = buildSettings[_codeSignStyleBuildSettingName];
163+
if (codeSignStyle != _CodeSigningStyle.manual.label) {
164+
logger.printStatus(
165+
'Automatically signing iOS for device deployment using specified development '
166+
'team in Xcode project: ${buildSettings[_developmentTeamBuildSettingName]}',
167+
);
168+
}
164169
return null;
165170
}
166171

‎packages/flutter_tools/test/general.shard/ios/code_signing_test.dart‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,37 @@ void main() {
7070
expect(logger.traceText, isEmpty);
7171
});
7272

73+
testWithoutContext('No misleading log when CODE_SIGN_STYLE is Manual', () async {
74+
final logger = BufferLogger.test();
75+
final Map<String, String>? signingConfigs =
76+
await getCodeSigningIdentityDevelopmentTeamBuildSetting(
77+
buildSettings: <String, String>{
78+
'DEVELOPMENT_TEAM': 'abc',
79+
'CODE_SIGN_STYLE': 'Manual',
80+
},
81+
platform: FakePlatform(operatingSystem: 'macos'),
82+
processManager: FakeProcessManager.empty(),
83+
logger: logger,
84+
config: Config.test(),
85+
terminal: FakeTerminal(),
86+
fileSystem: MemoryFileSystem.test(),
87+
fileSystemUtils: FakeFileSystemUtils(),
88+
plistParser: FakePlistParser(),
89+
);
90+
expect(signingConfigs, isNull);
91+
// Should not log "Automatically signing..." when CODE_SIGN_STYLE is Manual.
92+
expect(
93+
logger.statusText,
94+
isNot(
95+
contains(
96+
'Automatically signing iOS for device deployment using specified development team in Xcode project',
97+
),
98+
),
99+
);
100+
expect(logger.errorText, isEmpty);
101+
expect(logger.traceText, isEmpty);
102+
});
103+
73104
testWithoutContext(
74105
'No discovery if provisioning profile specified in Xcode project',
75106
() async {

0 commit comments

Comments
 (0)