6

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:

enter image description here

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?

Eric
  • 16,003
  • 15
  • 87
  • 139

1 Answers1

1

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

sleepystar96
  • 721
  • 3
  • 12