rich
rich

Reputation: 461

Running pod update changes Pods build settings

When I run

pod upate

against my Podfile certain Build Settings for Architectures section for Pods project are changed:

  1. Supported Platforms changes to OS X (from iOS)
  2. Build Active Architectures Only changes to Yes (from No)
  3. Base SDK changes to No SDK (latest OS X) from Latest iOS

I don't know why it's changing that. Could it be something I'm having (or not having) in my podspec file for my dependencies? Here is an example of one of my podspec files:

Pod::Spec.new do |spec|
  spec.name                  = 'pi-ios-sdk'
  spec.version               = '1.2.0'
  spec.license               = { :type => 'Copyright', :text => 'Copyright 2014 <...>. All rights reserved.' }
  spec.homepage              = 'http://<...>.com/'
  spec.authors               = '<...> Grid Mobile Frameworks Team'
  spec.summary               = '<...> Identity authentication GRID projects.'
  spec.description           = 'The <...> Identity Client iOS SDK framework (Pi-ios-client) assists in accessing the services provided by the <...> Identity API.'
  spec.ios.deployment_target = '7.1'
  spec.requires_arc          = true
  spec.source                = { :git => 'ssh://git@devops-tools.<...>.com/mp/pi-ios-sdk.git', :tag => 'tag/1.2.0' }
  spec.source_files          = 'framework/src/xcode/Pi-ios-client/*.{h,m}'
  spec.header_dir            = 'Pi-ios-client'
  spec.exclude_files         = 'framework/src/xcode/Pi-ios-client/PGMPiTokenRefreshOperationTests.m'
  spec.ios.frameworks        = 'Foundation', 'UIKit'
end

And my Podfile:

platform :ios, "7.1"

target "CourseListClient" do
  pod 'core-ios-sdk', '1.2.0'
  pod 'pi-ios-sdk', '1.2.0'
  pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
end

target "CourseListClientTests" do
  pod 'core-ios-sdk', '1.2.0'
  pod 'pi-ios-sdk', '1.2.0'
  pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
end

I'm thinking - having those same dependencies for test target is probably unnecessary, but what else do I need to change? Thank you.

Upvotes: 8

Views: 2753

Answers (1)

altagir
altagir

Reputation: 640

add this at the end of your Podfile :

post_install do |installer_representation|
    projectSDK = nil

    puts"Updating all of the POD targets to not default to ONLY_ACTIVE_ARCH for debug"
    installer_representation.project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            if projectSDK.nil?
                projectSDK = config.build_settings['SDKROOT']
            end
        end
    end
    puts "Updating ONLY_ACTIVE_ARCH for the project, as well. While the project settings aren't supposed to matter, I've not found that to be the case."
    puts "Also setting the base SDK of the project to match that of the targets (doesn't matter which one); otherwise it defaults to No SDK (Latest OS X)"
    installer_representation.project.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        config.build_settings['SDKROOT'] = projectSDK
    end
end

source: Supported platforms, base SDK, build active architecture only settings reverted after pod update

if you are using the latest gem (gem install cocoapods --pre), replace the 2 ".project" above by ".pods_project"

regards

Upvotes: 7

Related Questions