Skip to content

Enhancement Request: deployment_target should be settable in the subspec alone #1987

Closed
ghost opened this Issue Mar 31, 2014 · 6 comments

3 participants

@ghost
ghost commented Mar 31, 2014

My current project is a static library provided in both iOS6 and iOS7 versions. I'd much prefer using subspecs over maintaining two different podspecs. Right now it passes lint, not sure what happens when I go to actually try and use it. If you look at the spec, you can see that there is a deployment target specified in the root spec, since not having one results in lint errors. Yet there are no source files in the root spec. Setting a deployment target in the subspecs appears to work - no lint errors - so if my usage of a podspec is within the envisioned functionality, then the requirement for a root deployment target should go away.

Pod::Spec.new do |s|
  s.name                  = 'Sailthru_SDK_iOS'
  s.license               = { :type => 'Apache License, Version 2.0' }
  s.version               = '3.2.6'
  s.summary               = 'Supports Sailthru Push Notifications and Analytics.'
  s.homepage              = 'https://github.com/sailthru/sailthru-mobile-ios'
  s.author                = "Sailthru, Inc"
  s.platform              = :ios
  s.ios.deployment_target = '7.0' # not having this causes lint errors
  s.source                = { :git => 'https://github.com/sailthru/sailthru-mobile-ios.git', :branch => 'master', :tag => "v" +  s.version.to_s }
  s.requires_arc          = true
  s.default_subspec       = 'ios7'
  s.subspec 'ios7' do |sp|
    sp.source_files        = "SailThruSDK/*.h"
    sp.preserve_paths      = 'SailThruSDK/README', 'SailThruSDK/ios7/libSailthru.a'
    sp.ios.vendored_library = 'SailThruSDK/ios7/libSailthru.a'
    sp.library             = 'Sailthru'
    sp.xcconfig            = { 'LIBRARY_SEARCH_PATHS' => '$(SRC_ROOT)/Pods/Sailthru_SDK_iOS/SailThruSDK/ios7' }
    sp.frameworks          = 'Foundation'
    sp.platform              = :ios
    sp.ios.deployment_target = '7.0'
  end

  s.subspec 'ios6' do |sp|
    sp.source_files        = "SailThruSDK/*.h"
    sp.preserve_paths      = 'SailThruSDK/README', 'SailThruSDK/ios6/libSailthru.a'
    sp.ios.vendored_library = 'SailThruSDK/ios6/libSailthru.a'
    sp.library             = 'Sailthru'
    sp.xcconfig            = { 'LIBRARY_SEARCH_PATHS' => '$(SRC_ROOT)/Pods/Sailthru_SDK_iOS/SailThruSDK/ios6' }
    sp.frameworks          = 'Foundation'
    sp.platform              = :ios
    sp.ios.deployment_target = '6.0'
  end
  s.description           = <<-DESC
...DESC
end
@mxcl
mxcl commented Aug 20, 2014

I absolutely need this for PromiseKit since currently I have to set a deployment_target that is the maximum possible target or the whole spec won't lint, and since some of my subspecs require 10.10/8.0 features I cannot lint the Podspec. Which is frustrating.

@fabiopelosin
CocoaPods member

I have to set a deployment_target that is the maximum possible target or the whole spec won't lint

This makes sense to me, the whole spec (unless otherwise specified) includes all the subspecs so its deployment target should be highest one of all the subspecs.

@segiddins
CocoaPods member

@fabiopelosin / @alloy this might be a reason to start build each subspec into separate targets.

@fabiopelosin
CocoaPods member

@segiddins why?

@segiddins
CocoaPods member

So they can each have a separate deployment target set.

@segiddins
CocoaPods member

This should already be possible if not using the platform DSL attribute

@segiddins segiddins closed this Sep 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.