yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
7.01k stars 818 forks source link

Per configuration dependency #513

Open AlexisQapa opened 5 years ago

AlexisQapa commented 5 years ago

Hi, is there a way to have per configuration dependencies ? we'd like to have some additional / different dependencies for debug etc..

yonaskolb commented 5 years ago

There’s no built in helpers for this at the moment. I could imagine the carthage script using the new xc file lists that get referenced depending on the configuration. For other types of dependencies not sure. Would require some custom scripts.

How do you achieve this manually in your project?

AlexisQapa commented 5 years ago

Well until now I was on Cocoapods which as a flag for this : pod "DBDebugToolkit", :configurations => ['Debug', 'Testing']

yonaskolb commented 5 years ago

You can continue to use Cocoapods as well

yonaskolb commented 5 years ago

This will make using Cocoapods easier https://github.com/yonaskolb/XcodeGen/issues/479

AlexisQapa commented 5 years ago

Yeah but we moved to Carthage and are happy with it so now I'm trying to figure out a solution to this.

yonaskolb commented 5 years ago

If you find a good manual solution using carthage, you can post it here and we can see if we can generate it

AlexisQapa commented 5 years ago

I did not found a way directly with Carthage thought I don't have an extensive knowledge of it. I found a solution by weakly linking the framework and in my scheme I use a post build script to remove the framework from the bundle : if [[ $CONFIGURATION == 'Release' ]] || [[ $CONFIGURATION == 'Profile' ]]; then APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" rm -Rf "$APP_PATH/Frameworks/DBDebugToolkit.framework" echo "Debug only frameworks ✅ Removed successfully"; fi

AlexisQapa commented 5 years ago

As I only had one dependency to remove, I din't bother writing something more flexible. The script could easily support inputs file to select which dependencies to remove. I've been quite busy on other subjects but I intend to file a bug / question on Carthage as I didn't found a clean way to do it for now.