module Pod::XBuilder::XcodeProjHelper

Public Instance Methods

modify_xcode_project_sdk_to_simullator(path) click to toggle source
# File lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb, line 6
def modify_xcode_project_sdk_to_simullator path
  sdks = xcode_sdks
  project = Xcodeproj::Project.open path

  project.targets.each do |target|
    simulator_sdk = to_native_simulator_platform target.sdk
    if not simulator_sdk.nil?
      canonicalName = sdks[simulator_sdk]["canonicalName"]
      target.build_configurations.each do |configuration|
        configuration.build_settings["SDKROOT"] = canonicalName
      end
    end
  end
  project.save
end

Private Instance Methods

to_native_simulator_platform(name) click to toggle source
# File lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb, line 34
def to_native_simulator_platform name
  case name
  when 'iphoneos' then 'iphonesimulator'
  when 'macOS' then nil
  when 'appletvos' then 'appletvsimulator'
  when 'watchos' then 'watchsimulator'
  else
    name
  end
end
xcode_sdks() click to toggle source
# File lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb, line 23
def xcode_sdks
  return @x_sdks if @x_sdks
  outputs = `xcodebuild -showsdks -json`
  sdks = JSON.parse outputs
  @x_sdks = {}
  sdks.each do |sdk|
    @x_sdks[sdk["platform"]] = sdk
  end
  @x_sdks
end