Open twomedia opened 5 years ago
At the moment there isn't a way to do this if you're talking about Xcode targets.
If you are adding extra targets to Unity's generated Xcode project programmatically?
If you're talking about targets that you're manually configuring using pre/postprocessing steps in Unity script. I guess the only way to do that at the moment would be to provide different *Dependencies.xml files in your project and rename them to enable / disable them based upon the selected target.
e.g you may have
iOSDependencies.xml.disabled
watchOSDependencies.xml.disabled
tvOSDependencies.xml.disabled
when you select the Apple TV target you could then rename the tvOSDependencies.xml.disabled
file to
tvOSDependencies.xml
before the build is initiated and the iOS resolver will include just those dependencies.
I'm using the Unity Editor PBXProjectExtensions class to add the extensions in a post-process step. This means in the unity editor my target is always iOS. Somehow I need a way to specify what target the dependencies are for so that I can achieve a generated podfile like the one below. Hopefully, this could be added as a feature in the future as it would be a very handy addition.
target 'PixelStarships' do
platform :ios, '8.0'
pod 'Realm'
pod 'libPusher' #, '~> 1.6.1' #tested
#Attribution
pod 'AppLovinSDK' # upgraded from AppLovin-SDK
pod 'Branch'
#Ad Networkds
pod 'mopub-ios-sdk' #, '5.4.1' #tested
pod 'TapjoySDK' #tested
pod 'ChartboostSDK' #tested
pod 'AppsFlyerFramework' #, '~> 4.5.8.0' #tested
pod 'OneSignal' #, '~> 1.13.2' #tested
pod 'AdColony' #, '~> 2.6.2'
pod 'Google-Mobile-Ads-SDK'
# Google (AdMob)
pod 'MoPub-AdMob-Adapters' #, '7.37.0.4'
# AppLovin
pod 'MoPub-Applovin-Adapters' #, '6.2.0.0'
# AdColony
pod 'MoPub-AdColony-Adapters' #, '3.3.5.4'
# Chartboost
pod 'MoPub-Chartboost-Adapters' #, '7.3.0.4'
# Unity Ads
pod 'MoPub-UnityAds-Adapters'
# Tapjoy
pod 'MoPub-TapJoy-Adapters' #, '12.2.0.4'
# ironSource
pod 'MoPub-IronSource-Adapters' #, '6.8.1.0.0'
#facebook
pod 'FacebookSDK'
pod 'FacebookSDK/LoginKit'
pod 'FacebookSDK/ShareKit'
pod 'FacebookSDK/PlacesKit'
pod 'FBSDKMessengerShareKit'
pod 'FBAudienceNetwork'
#analytics
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase/Core'
end
target 'PixelStarshipsWatchOS Extension' do
platform :watchos, '2.0'
pod 'Realm'
end
target 'PixelStarshipsWidget' do
pod 'libPusher' #, '~> 1.6.1'
pod 'SDWebImage', '~>3.6'
end
@twomedia I imagine you could do this by adding a target filter in the Pod data structure.
Then if multiple targets are associated with the Pod I would imagine this code could generate each target section in the podfile.
We're happy to take pull requests ;)
@stewartmiles Thanks for the pointers! When I get a chance I'll see if I can get something working & submit a pull request.
Is there a way to add dependencies for specific targets? Currently, I have multiple extensions (Apple Watch, Today Extension) which require some CocoaPods dependencies. Is there an existing or planned feature for this?