-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update iOS codesign options #1307
Conversation
@@ -115,15 +115,20 @@ def toolchain(self, cmd, **kwargs): | |||
kwargs.setdefault('cwd', self.ios_dir) | |||
return self.buildozer.cmd(self._toolchain_cmd + cmd, **kwargs) | |||
|
|||
def xcodebuild(self, cmd='', **kwargs): | |||
return self.buildozer.cmd(self._xcodebuild_cmd + cmd, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach allows easily omit unspecified (None) arguments, which makes later invocation cleaner.
'-allowProvisioningUpdates', | ||
'ENABLE_BITCODE=NO', | ||
self.code_signing_allowed, | ||
self.code_signing_development_team, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without setting DEVELOPMENT_TEAM option here clean build
command was failing with error
error: Signing for "testapp" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'testapp' from project 'testapp')
@@ -216,7 +221,12 @@ def build_package(self): | |||
|
|||
mode = self.build_mode.capitalize() | |||
self.xcodebuild( | |||
f"-configuration {mode} ENABLE_BITCODE=NO {self.code_signing_allowed} clean build", | |||
f'-configuration {mode}', | |||
'-allowProvisioningUpdates', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without -allowProvisioningUpdates
option here clean build
command was failing with error
error: No profiles for 'com.test.testapp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.test.testapp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'testapp' from project 'testapp')
f'-archivePath "{xcarchive}"', | ||
'archive', | ||
'ENABLE_BITCODE=NO', | ||
self.code_signing_development_team, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without setting DEVELOPMENT_TEAM here archive
command was failing with error
error: Signing for "testapp" requires a development team. Select a development team in the Signing & Capabilities editor. (in target 'testapp' from project 'testapp')
cwd=build_dir) | ||
|
||
self.buildozer.info('Creating IPA...') | ||
self.xcodebuild(( | ||
' -exportArchive' | ||
' -exportFormat IPA' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With -exportFormat IPA
the commad was failing with error xcodebuild: error: invalid option '-exportFormat'
. This option was removed in Xcode 8.3.
self.xcodebuild( | ||
'-exportArchive', | ||
f'-archivePath "{xcarchive}"', | ||
f'-exportOptionsPlist "{plist_rfn}"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After removal of exportFormat
option and without exportOptionsPlist
option the command was failing with error xcodebuild: error: The flag -exportOptionsPlist is required when specifying -exportArchive
.
@@ -196,13 +195,6 @@ def test_build_package_no_signature(self): | |||
'You must fill the "ios.codesign.debug" token.' | |||
) | |||
] | |||
assert m_xcodebuild.call_args_list == [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because xcodebuild function signature has changed, instead of writing
assert m_xcodebuild.call_args_list == [
mock.call(
"-configuration Debug",
"-allowProvisioningUpdates",
"ENABLE_BITCODE=NO",
"CODE_SIGNING_ALLOWED=NO",
None,
"clean build",
cwd="/ios/dir/myapp-ios",
)
]
... I've moved the expectations to the m_cmd mock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that very well documented PR.
buildozer iOS definitely needed some love, so thanks for that
During testing of iOS codesign a few issues were found:
This PR addresses these issues.
As a result, I was able to get properly signed IPA: