Reputation: 16931
I'm developing a cocoapod (MySDK in the screenshot below) that runs a script as part of its installation. I need to pass the name of the main executable (i.e. SecThree
) to that script, i.e. $FOO
below:
I thought I could use $PRODUCT_NAME
, $TARGET_NAME
, or $EXECUTABLE_NAME
, but of course these are MySDK
when run within the MySDK target.
How could I resolve the name of the main target from within a script in its dependencies?
Upvotes: 6
Views: 1431
Reputation: 816
I don't think there is a built-in way, but an easy work-around is to just create a variable before calling sh myscript.sh --app-name=${FOO}
:
TARGET_NAME="MySDK"
sh myscript.sh --app-name=${FOO}
Now you can access $TARGET_NAME inside myscript.sh
Upvotes: 1