openbakery / gradle-xcodePlugin

gradle plugin for building Xcode Projects for iOS, watchOS, macOS or tvOS
Apache License 2.0
455 stars 127 forks source link

Question: Distribution Method - Development #450

Open serhii-pokrovskyi opened 2 years ago

serhii-pokrovskyi commented 2 years ago

How can I build *.ipa with this option? i'v found https://github.com/openbakery/gradle-xcodePlugin/blob/main/libxcode/src/main/groovy/org/openbakery/codesign/ProvisioningProfileReader.groovy ProvisioningProfileType

But, I can't figure out how to use it.

Regards, Serhii

renep commented 2 years ago

First you have to configure to perform a device build:

xcodebuild {
  configuration = 'Release'
  type = 'iOS'
  simulator = false

  ...
}

Then you have to specify also the sign settings. You need to export your certificate from your keychain.

xcodebuild {
      ... // values from above

    signing {
        certificateURI = 'file:///path/you/your/certificate.p12' // that you have to export from your keychain
        certificatePassword = 'secret' // the password for the  certificate.p12
        mobileProvisionURI = 'file:///path/you/your/mobile_provisioning_file' // that you have created at the apple developer protal
    }
}

When you to run than the 'archive' and the 'package' task. The 'archive' task creates a xcarchive that the 'package' task use to create the 'ipa'.

PS. The ProvisioninProfileReader is use the extract information that is needed for the build from the mobile provisioning profile.