bitrise-steplib / steps-ios-auto-provision-appstoreconnect

MIT License
15 stars 16 forks source link

Fix not supporting xcworkspace scheme correctly #42

Closed lpusok closed 3 years ago

lpusok commented 3 years ago

Checklist

Context

Fix for the case when the scheme is contained in the xcworkspace and not the project. An example error this solves:

Failed to analyze project: failed to find the main target of the scheme (test): failed to find scheme (test) in project: scheme test not found in test.pbxproj

Update the logic modifying the Xcode project to preserve comments and order of keys. This adds better compatibility with Cordova (https://github.com/apache/cordova-node-xcode/) and agvtool.

Changes

Investigation details

jpike88 commented 3 years ago

@lpusok @godrei hi guys, just wondering if this has been release yet? How do I know in future when a publish to Bitrise has occurred?

lpusok commented 3 years ago

@jpike88 Sorry not released yet, found a blocking issue. Will be published when the new version is visible at https://github.com/bitrise-io/bitrise-steplib/tree/master/steps/ios-auto-provision-appstoreconnect. Usually a few hours later when the new release is created in the current repo. It is also posted in the changelog channel on the public Slack. The new plan is to release the fix for using workspace schemes and the project modification part separately.

jpike88 commented 3 years ago

Ok, I've been spending hours trying to get it to work, I'm seeing this error (the target is a xcworkspace file):

Analyzing project
Failed to analyze project: failed to find the main target of the scheme (Aquipa): failed to find scheme (Aquipa) in project: scheme Aquipa not found in Aquipa

My project is a Cordova one. I am assuming this will fix it...

lpusok commented 3 years ago

@jpike88 Supporting Cordova turned out to be complicated due to the fairly custom Xcode project parser included in Cordova. There is an additional fix still in the works, that hopefully will complete Cordova support.

jpike88 commented 3 years ago

Can you link to that additional fix? I'm semi-manual with my workflow so it might not affect me, I may just only need this workspace scheme issue

lpusok commented 3 years ago

Do not have an public PR/issue for this yet. The issue is caused by the fact that this Step changes the signing settings in the project and ionic/cordova build fails to parse it. The scheme issue can be temporarily resolved if you move the scheme manually to be contained in the project rather then the workspace.

CordovaError: Could not parse '[ ... ]/photo-gallery/platforms/ios/photo-gallery.xcodeproj/project.pbxproj: TypeError: Cannot read property 'buildSettings' of undefined
jpike88 commented 3 years ago

I'll just hold out for the scheme fix is ok, I'm time poor right now.

PS: I had a workflow in GitHub actions previously, and used this plugin:

https://github.com/ngeri/prepare-signing

Then, I passed the --provisioningProfile flag to cordova build ios --release, that seem to all work ok

godrei commented 3 years ago

@jpike88 these changes are released in version 1.0.2, should be available in the StepLib in ~20m.

jpike88 commented 3 years ago

Great I'll try it within the hour and let you know if it helped my issue

jpike88 commented 3 years ago

Looks like it helped, thanks!

jpike88 commented 3 years ago

Well, it got me a little further.

I'm now getting an error 65, likely to do with issue related to provisioning profile.

PS another note: in my GitHub Action, this line was useful:

My build.config (obfuscated):

{
    "ios": {
        "debug": {
            "developmentTeam": "***"
        },
        "release": {
            "developmentTeam": "***"
        }
    },
    "android": {
        "release": {
            "keystore": "android.keystore",
            "alias": "pg",
            "password": "***",
            "storePassword": "***",
            "keystoreType": ""
        }
    }
}

And the command after using the signing step:

$(npm bin)/cordova build ios --device --release --inc --buildConfig ./build.json --provisioningProfile=$(ls ~/Library/MobileDevice/Provisioning\ Profiles | grep mobile | sed 's/.mobileprovision//') --packageType=app-store

jpike88 commented 3 years ago

fyi looks like I'm at this stage now: https://github.com/bitrise-steplib/steps-ios-auto-provision-appstoreconnect/issues/34

Have moved there