The Wayback Machine - https://web.archive.org/web/20200516153254/https://github.com/CocoaPods/CocoaPods/issues/9274
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

Add option to disable `generate_multiple_pod_projects` for specific pod #9274

Open
Kaspik opened this issue Oct 20, 2019 · 9 comments
Open

Add option to disable `generate_multiple_pod_projects` for specific pod #9274

Kaspik opened this issue Oct 20, 2019 · 9 comments

Comments

@Kaspik
Copy link

@Kaspik Kaspik commented Oct 20, 2019

Report

What did you do?

  • enabled generate_multiple_pod_projects in Podfile

What did you expect to happen?

  • correctly migrate targets to separate projects, build project then

What happened instead?

  • correctly migrate targets to separate projects, project not buildable because of import in of the the pods

Info

I know this is mostly problem of pods itself, but as defined in blog post (http://blog.cocoapods.org/CocoaPods-1.7.0-beta/):
Warning: Switching your project to use multiple .xcodeproj may result in some compiler errors if your pods have relied on importing headers using the quote syntax for its dependencies. For example #import "PDDebugger.h" will no longer work in a pod that depends on PonyDebugger. Instead, we highly suggest you update your headers to correctly import the framework and its associated header: #import <PonyDebugger/PDDebugger.h>. This is intentional since this feature is currently opt-in.
I believe this blocks tons of users from using it and testing it because there is some pod that doesn't support this yet. (even if it's one of 30 like in our case, and it's only development pod)

Ideally current definition of pod in podfile would change from:

generate_multiple_pod_projects => true
pod 'Fabric', '~> 3.14', :project_name => 'Logging'
pod 'Crashlytics', '~> 3.14', :project_name => 'Logging'

to

generate_multiple_pod_projects => true
pod 'Fabric', '~> 3.14', :project_name => 'Logging'
pod 'Crashlytics', '~> 3.14', :generate_project => false

Then pods marked like this would stay in Pods.xcodeproj as a target where the rest of them would be in separate project files.

Thanks!

@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Oct 21, 2019

Can you not specify :project_name => 'Pods'? Admittedly I haven't tried it so I do not know if it will work.

If it doesn't then I will mark this as an enhancement.

@Kaspik
Copy link
Author

@Kaspik Kaspik commented Oct 21, 2019

@dnkoutso Interesting idea! Tried, but CocoaPods crashed.

Command

/usr/local/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15 (19A602)
       Xcode : 11.1 (11A1027)
         Git : git version 2.21.0 (Apple Git-122)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : cocoapods - git - https://github.com/CocoaPods/Specs.git @ d3a4583b933138036c231984325783e37790c386
               trunk - CDN - https://cdn.cocoapods.org/

Plugins

claide-plugins        : 0.9.2
cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

source 'https://cdn.cocoapods.org/'

platform :ios, '11.0'
use_frameworks!

install! 'cocoapods', :generate_multiple_pod_projects => true, :incremental_installation => true

workspace './ClassDojo'
project 'ClassDojo.xcodeproj'

# ignore all warnings from all pods
inhibit_all_warnings!

def extension_includes
    # Logging
    pod 'Crashlytics', '~> 3.14', :project_name => 'Logging'

    # Other
    pod 'SAMKeychain', '~> 1.5', :project_name => 'Other'
    pod 'DeviceUtil', '~> 6.0', :project_name => 'Other'
end

def all_pods
    
    extension_includes

    # Firebase
    pod 'Firebase/Messaging', :project_name => 'Firebase'
    pod 'Firebase/Analytics', :project_name => 'Firebase'

    # Logging
    pod 'CocoaLumberjack', '~> 3.5', :project_name => 'Logging'
    pod 'LogglyLogger-CocoaLumberjack', '~> 3.0', :project_name => 'Logging'

    # Networking
    pod 'Alamofire', '~> 5.0.0-rc.2', :project_name => 'Networking'
    pod 'PINRemoteImage', '3.0.0-beta.14', :subspecs => ['iOS', 'PINCache', 'WebP'], :project_name => 'Networking'

    # Other
    pod 'Cache', '~> 5.2', :project_name => 'Other'
    pod 'DifferenceKit', '~> 1.1', :project_name => 'Other'
    pod 'iRate', :git => 'https://github.com/classdojo/iRate', :branch => 'master', :project_name => 'Other'
    pod 'PromiseKit/CorePromise', '~> 6.11', :project_name => 'Other'
    pod 'PubNub', '~> 4.10', :project_name => 'Other'
    pod 'SSZipArchive', :project_name => 'Other'
    pod 'SwiftLint', '~> 0.35', :project_name => 'Other'
    pod 'SwiftyStoreKit', '~> 0.15', :project_name => 'Other'
    pod 'Texture', '~> 2.8', :subspecs => ['Core', 'Video', 'Photos'], :project_name => 'Other'

    # UI
    pod 'AMPopTip', '~> 4.1', :project_name => 'UI'
    pod 'FLAnimatedImage', '~> 1.0', :project_name => 'UI'
    pod 'Hero', '~> 1.4', :project_name => 'UI'
    pod 'JDStatusBarNotification', '~> 1.5', :project_name => 'UI' # Not supported anymore
    pod 'Layout', '~> 0.6', :project_name => 'UI'
    pod 'lottie-ios', '~> 3.1', :project_name => 'UI'
    pod 'pop', '~> 1.0', :project_name => 'UI'
    pod 'SnapKit', '~> 5.0', :project_name => 'UI'
    pod 'SwiftEntryKit', '~> 1.1', :project_name => 'UI'
    pod 'TTTAttributedLabel', '~> 2.0', :project_name => 'UI'
    pod 'UICollectionViewLeftAlignedLayout', '~> 1.0', :project_name => 'UI'
    pod 'UIImageViewModeScaleAspect', '~> 1.5', :project_name => 'UI'

    # Debugging
    #    pod 'GDCoreDataConcurrencyDebugging', :project_name => 'Debugging'
    pod 'Tweaks', '~> 2.3', :project_name => 'Debugging'
end

abstract_target 'App' do
    all_pods
    
    target 'ClassDojo' do
        target 'ClassDojo Unit Tests' do
            inherit! :search_paths
            pod 'OHHTTPStubs/Swift', '~> 8.0', :project_name => 'Testing'
            pod 'SnapshotTesting', '~> 1.6', :project_name => 'Testing'
            pod 'Criollo', '~> 0.5', :project_name => 'Pods'
        end

        target 'UI Tests' do
            inherit! :search_paths
            pod 'OHHTTPStubs/Swift', '~> 8.0', :project_name => 'Testing'
            pod 'SnapshotTesting', '~> 1.6', :project_name => 'Testing'
            pod 'Criollo', '~> 0.5', :project_name => 'Pods'
        end

        target 'Integration Tests' do
            pod 'Criollo', '~> 0.5', :project_name => 'Pods'
        end

        pod 'FLEX', '~> 3.0', :configurations => ['Debug'], :project_name => 'Debugging'
    end
    
    target 'ClassDojo_Alpha' do
        pod 'FLEX', '~> 3.0', :project_name => 'Debugging'
    end
end

abstract_target 'Extensions' do

    target 'Notifications Service' do
        extension_includes
    end
end

post_install do |installer|
    installer.generated_projects.each do |project|
        project.targets.each do |target|
            if target.name == "Tweaks"
                target.build_configurations.each do |config|
                    config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FB_TWEAK_ENABLED=1']
                end
            end
            if target.name == "SwiftyStoreKit"
                target.build_configurations.each do |config|
                    if config.name == 'Testing'
                        config.build_settings['ENABLE_TESTABILITY'] = 'YES'
                    end
                end
            end
        end
    end
end

Error

NoMethodError - undefined method `real_path' for nil:NilClass
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project/object/container_item_proxy.rb:96:in `container_portal_annotation'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project/object/container_item_proxy.rb:105:in `to_hash_as'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project/object.rb:421:in `to_ascii_plist'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project.rb:297:in `block in to_ascii_plist'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project.rb:295:in `each'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project.rb:295:in `to_ascii_plist'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project.rb:364:in `block in save'
/Library/Ruby/Gems/2.6.0/gems/atomos-0.1.3/lib/atomos.rb:21:in `block in atomic_write'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tempfile.rb:295:in `open'
/Library/Ruby/Gems/2.6.0/gems/atomos-0.1.3/lib/atomos.rb:17:in `atomic_write'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.13.0/lib/xcodeproj/project.rb:363:in `save'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:56:in `block (2 levels) in write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:145:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:42:in `block in write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:41:in `each'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:41:in `write!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:326:in `block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:303:in `create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:294:in `generate_pods_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:173:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:162:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
@stale stale bot removed the s1:awaiting input label Oct 21, 2019
@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Oct 21, 2019

Yeah probably not working out properly. I'll mark this as enhancement.

@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Oct 21, 2019

This can be accomplished by fixing the crash instead.

@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Oct 23, 2019

I switched that to being a bug and we can fix it for 1.9.x

@Kaspik
Copy link
Author

@Kaspik Kaspik commented Dec 27, 2019

1.9.0.beta.2 is out, but I believe there is no change related to any of this (Either :project_name => 'Pods' (that would be great, but no idea how to fix the crash) or option to not do it for specific pod).

I hope Milestone 1.9.0 still applies! 🎉

@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Jan 13, 2020

We discussed this and I think its actually way more complicated to support than I had initially thought.

I am not quite sure we will get to it in 1.9 or if ever to be honest.

cc @sebastianv1

@Kaspik
Copy link
Author

@Kaspik Kaspik commented Jan 13, 2020

Does it apply also to fixing the crash when project name is “Pods”?

@dnkoutso
Copy link
Contributor

@dnkoutso dnkoutso commented Feb 10, 2020

I think so? Not quite certain.

@dnkoutso dnkoutso removed this from the 1.9.0 milestone Feb 10, 2020
iMacHumphries added a commit to iMacHumphries/analytics-ios-integration-adobe-analytics that referenced this issue Mar 24, 2020
Motivation:
Fix build errors with CocoaPods project using new generate_multiple_pod_projects
CocoaPods/CocoaPods#9274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.