Sha256: 7d56a90d384e09633b6a0c3d1a9bf2c5cb38fb15462ccfcf35cd4753ea0313f2

Contents?: true

Size: 1.19 KB

Versions: 20

Compression:

Stored size: 1.19 KB

Contents

require 'xcodeproj'
module Pod
  class XBuilder
    module XcodeProjHelper
      include PodUtil
      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
      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

      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
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
cocoapods-bb-xcframework-0.2.6.4 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.6.3 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.6.2 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.6.1 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.6 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.5 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-framework-tj-0.0.6 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-framework-tj-0.0.5 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-framework-tj-0.0.4 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.4.1 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-framework-tj-0.0.3 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-framework-tj-0.0.2 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-xcframework-0.2.4 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.3 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.2 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.1 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.2.0 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-bb-xcframework-0.1.0 lib/cocoapods-xcframework/xbuilder/xcodeproj_helper.rb
cocoapods-xcframework-0.2.1 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb
cocoapods-xcframework-0.2.0 lib/cocoapods-framework/xbuilder/xcodeproj_helper.rb