Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-Targets configuration and abstract_target build #4863

Closed
lifely opened this issue Feb 4, 2016 · 10 comments
Closed

Multi-Targets configuration and abstract_target build #4863

lifely opened this issue Feb 4, 2016 · 10 comments
Labels
s1:awaiting input Waiting for input from the original author

Comments

@lifely
Copy link

lifely commented Feb 4, 2016

Hello,

I had to update my podfile today, following 1.0 update and changes.
I have a project with multiple target that represents my environements.

I previously didn't specified any target in the podfile like so :

# Specs Sources List
source 'https://github.com/CocoaPods/Specs.git'

# Project Configuration
xcodeproj 'project.xcodeproj'
platform :ios, '8.0'

## Settings
inhibit_all_warnings!
use_frameworks!

pod ...
pod ...

And i figured out that this configuration doesn't work for multiple targets anymore.
So i looked around and found that the easiest way to define the same pods for all the targets was to use an abstract_target like so :

abstract_target 'defaults' do

  ## - Networks
  pod 'Alamofire', '~> 2.0.2'
  pod 'ReachabilitySwift', '~> 2.3.3'

target 'Target'
target 'Target2'
...

However by doing so i saw my compile time explode, this solution made cocoapods generate an individual library for each targets.

image

I wonder what is possible now, to configure cocoapods to have a set of dependencies but only build one framework used for every targets.
The way i see the abstract_target feature would be to create a Pods framework to that name and link it against all dependents target.

Am i missing something ?

@segiddins
Copy link
Member

Are you sure all of those targets have the same platform?

@segiddins segiddins added the s1:awaiting input Waiting for input from the original author label Feb 8, 2016
@lifely
Copy link
Author

lifely commented Feb 8, 2016

Hey @segiddins thx for the reply.

Well, i'm pretty sure i haven't done anything facy with the platforms, all of my app targets are on standard architectures and iOS supported platforms.

Also, my podfile example aren't changed much compared to my own podfile, the only thing i've done here is anonymize the project.

Thanks for the time.

@segiddins
Copy link
Member

@mrackwitz want to look into this since its deduplication related?

@mrackwitz
Copy link
Member

Is deduplication in your ~/.cocoapods/config.yaml disabled?
Do you have anywhere in your Podfile a further target block, which defines additional dependencies, which intersect with transitive dependencies of those defined in your abstract_target block?

@lifely
Copy link
Author

lifely commented Feb 8, 2016

Here my podfile :

# Specs Sources List
source 'https://github.com/CocoaPods/Specs.git'

# Project Configuration
xcodeproj 'Project.xcodeproj'
platform :ios, '8.0'

## Settings
inhibit_all_warnings!
use_frameworks!

## Remember
## If you aren't using frameworks, after adding a Pod here,
## add it to the bridging header to expose it to Swift

abstract_target 'defaults' do

  ## - Networks
  pod 'Alamofire', '~> 2.0.2'
  pod 'ReachabilitySwift', '~> 2.3.3'

  ## - Parsing, Encoding, Decoding
  pod 'SwiftyJSON', '~> 2.3.2'
  pod 'CryptoSwift', '~> 0.2.2'

  ## - Layout
  pod 'Cartography', '~> 0.6.0'

  ## - Algorithm
  pod 'Dollar', '~> 4.1.0'

  ## - Librairies
  pod 'FontAwesomeKit/Core', '~> 2.2.0'

  pod 'Crashlytics', '~> 3.6.0'
  pod 'Fabric', '~> 1.6.4'

  ## - UI Components
  pod 'JDStatusBarNotification', '~> 1.5.3'
  pod 'Kingfisher', '~> 2.0.1'
  pod 'Armchair', '~> 0.1.1'

  target 'Project'
  target 'Project Recette'
  target 'Project Recette 2'
  target 'Project Recette 3'
  target 'Project Recette 8'
  target 'Project Pre-Production'
  target 'Project Production'

end

I don't have a config file for cocoapods and here the version i'm currently on :

pod --version
1.0.0.beta.2

@mrackwitz
Copy link
Member

Mh, this doesn't give me any hint, why the generated pod targets should be duplicated. Could you paste the outputs of pod install --verbose? This could give some further indication.

@lifely
Copy link
Author

lifely commented Feb 8, 2016

Hey @mrackwitz, i set the install to run and kinda forgot about it.

Sorry about that, here you go: https://gist.github.com/lifely/7b6485b21eaf2e2d726c

@mrackwitz
Copy link
Member

It seems like all targets are deduplicated as they should be. Don't worry about the aggregate targets. They don't increase the build time, as they only link together the targets in your Xcode project with the dependencies of all your pod dependencies. We have to use implicit dependencies with a target type which has an actual build product instead of aggregate targets as Xcode knows them, because we want to avoid having to add the Pods project as a subproject to the user's project as that cause among other things changing IDs on every installation.
If you should find pod targets to be actually duplicated, please send us more info, e.g. a full list of targets from Xcode. The cropping of the screenshot you've provided hides to much details.

@segiddins
Copy link
Member

@mrackwitz is this an issue we can close?

@mrackwitz
Copy link
Member

Yes, if it was really a problem, we could fix, there are good chances that #4146 has addressed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s1:awaiting input Waiting for input from the original author
Projects
None yet
Development

No branches or pull requests

3 participants