Xcode 10 Build Phase Shell Script

后端 未结 4 1185
甜味超标
甜味超标 2021-02-10 02:54

In our project we derive our release version from git tag etc then write it to the built folder\'s Info.plist with a shell script like:

GIT_RELEASE_VERSION=$(some

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-10 03:15

    (Xcode 11.2)

    • In the New Build System, any custom build steps will run before the New Build System's Process .../Info.plist step:

    • To run a shell script after Xcode finishes building, you can add it to your scheme(s) as a build post-action:

    Product > Scheme > Edit Scheme... > Build > Post-actions

    • If you're going to reference any build system environment variables (e.g. BUILT_PRODUCTS_DIR or INFOPLIST_PATH), make sure you change the Provide build settings from selection.

    • Add your shell script, but remember that if you edit any file in the app bundle (i.e. Info.plist), you'll need to re-sign the app. Add this to your post build step:

    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    /usr/bin/codesign --force --sign - --entitlements "${TARGET_TEMP_DIR}/${FULL_PRODUCT_NAME}.xcent" --timestamp=none "${CODESIGNING_FOLDER_PATH}"
    

提交回复
热议问题