openbakery / gradle-xcodePlugin

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

xcodebuild error: "no identity found" on 0.20.0 #439

Open lvivas opened 4 years ago

lvivas commented 4 years ago

I'm trying to upgrade from 0.15.4 and I'm having some issues when generating iOS builds for distribution.

> Command failed to run (exit code 65): '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -scheme App -workspace App.xcworkspace -configuration Release CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -xcconfig /Users/luisvivas/Documents/git/repo/Resources/A/iOS/xcconfig/live.codesign.xcconfig PRODUCT_BUNDLE_IDENTIFIER=com.company.app CODE_SIGNING_REQUIRED=YES -derivedDataPath /Users/luisvivas/Documents/git/repo/iOS/build/derivedData DSTROOT=/Users/luisvivas/Documents/git/repo/iOS/build/dst OBJROOT=/Users/luisvivas/Documents/git/repo/iOS/build/obj SYMROOT=/Users/luisvivas/Documents/git/repo/iOS/build/sym SHARED_PRECOMPS_DIR=/Users/luisvivas/Documents/git/repo/iOS/build/shared COMPILER_INDEX_STORE_ENABLE=NO'
  Tail of output:
      export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
      export XCODE_PRODUCT_BUILD_VERSION=11E708
      export XCODE_VERSION_ACTUAL=1160
      export XCODE_VERSION_MAJOR=1100
      export XCODE_VERSION_MINOR=1160
      export XPCSERVICES_FOLDER_PATH=App.app/XPCServices
      export YACC=yacc
      export arch=undefined_arch
      export variant=normal
      /bin/sh -c /Users/luisvivas/Documents/git/repo/iOS/build/obj/App.build/Release-iphoneos/App.build/Script-B634E0562257C60400BB82AE.sh
  Compiling...
  : no identity found
  error: Code signing failed.

  ** BUILD FAILED **

This used to work perfectly with 0.15.4. I'm using Xcode 11.6 and my xcodebuild config looks like:

    signing {
        mobileProvisionURI = path/to/mobileProvision
        identity = "some identity"
        certificateURI = path/to/certificate
        certificatePassword = "..."
    }
    additionalParameters = [ "-xcconfig", xcconfigPath, 'CODE_SIGNING_REQUIRED=YES' ]

I use xcconfig files to define CODE_SIGN_IDENTITY, PROVISIONING_PROFILE and DEVELOPMENT_TEAM as I need to build multiple variants of my app.

I noticed that if I run the exact same xcodebuild command without CODE_SIGNING_ALLOWED=NO it runs successfully. This seems to be caused by the following change: https://github.com/openbakery/gradle-xcodePlugin/commit/4e2c2b1ce21184ec95e6fe4840693176f278d348

If I add CODE_SIGNING_ALLOWED=YES to additionalParameters that seems to cause other issues.

Thanks in advance.