class Pod::Xcode::XCFramework::Slice
Attributes
@return [Pathname] the path to the headers
@return [String] the framework identifier
@return [Pathname] the path to the .framework or .a of this slice
@return [Platform] the supported platform
@return [Symbol] the platform variant. Either :simulator or nil
@return [Array<String>] list of supported architectures
Public Class Methods
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 31 def initialize(path, identifier, archs, platform, platform_variant: nil, headers: path.join('Headers')) @path = path @identifier = identifier @supported_archs = archs @platform = Pod::Platform.new(platform) @platform_variant = platform_variant.to_sym unless platform_variant.nil? @headers = headers end
Public Instance Methods
@return [Pathname] the path to the bundled binary
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 123 def binary_path @binary_path ||= begin case package_type when :framework path + name when :library path else raise Informative, "Invalid package type `#{package_type}`" end end end
@return [BuildType] the build type of the binary
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 105 def build_type @build_type ||= begin linkage = Xcode::LinkageAnalyzer.dynamic_binary?(binary_path) ? :dynamic : :static ext = File.extname(path) packaging = case ext when '.framework' :framework when '.a' :library else raise Informative, "Invalid XCFramework slice type `#{ext}`" end BuildType.new(:linkage => linkage, :packaging => packaging) end end
@return [Boolean] true if this slice contains a dynamically-linked binary
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 99 def dynamic? build_type.dynamic? end
@return [Boolean] true if this slice is a framework, not a library
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 81 def framework? build_type.framework? end
@return [Boolean] true if this slice is a library, not a framework
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 87 def library? build_type.library? end
@return [String] the name of the framework
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 42 def name @name ||= begin case package_type when :framework File.basename(path, '.framework') when :library result = File.basename(path, '.a').gsub(/^lib/, '') result[0] = result.downcase[0] result else raise Informative, "Invalid package type `#{package_type}`" end end end
@return [Symbol] the package type of the slice - either :framework or :library
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 65 def package_type @package_type ||= begin ext = File.extname(path) case ext when '.framework' :framework when '.a' :library else raise Informative, "Invalid XCFramework slice type `#{ext}`" end end end
@return [Boolean] true if this is a slice built for simulator
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 59 def simulator_variant? @platform_variant == :simulator end
@return [Boolean] true if this slice contains a statically-linked binary
# File lib/cocoapods/xcode/xcframework/xcframework_slice.rb, line 93 def static? build_type.static? end