Xcode: Running a script before every build that modifies source code directly

前端 未结 6 747
无人共我
无人共我 2020-12-04 08:26

What I did:

I have a script that

  1. Read some configuration files to generate source code snippets
  2. Find relevant Objective-C source files and
6条回答
  •  借酒劲吻你
    2020-12-04 08:57

    This solution is probably outdated. See the higher voted answer instead; I no longer actively use Xcode and am not qualified to vet a solution.


    Use "External Target":

    1. Select "Project" > "New Target..." from the menu
    2. Select "Mac OS X" > "Other" > "External Target" and add it to your project
    3. Open its settings and fill in your script setup
    4. Open the "General" tab of the main target's settings and add the new target as it's direct dependency

    Now the new "External Target" runs before the main target even starts gathering dependency information, so that any changes made during the script execution should be included in the build.

提交回复
热议问题