class Pod::Xcode::XCFramework
Attributes
@return [Pod::Version] the format version of the .xcframework
@return [Pathname] path the path to the .xcframework on disk
@return [Hash] the contents of the parsed plist
@return [Array<XCFramework::Slice>] the slices contained inside this .xcframework
@return [String] target_name
the target name this XCFramework
belongs to
Public Class Methods
Initializes an XCFramework
instance with a path on disk
@param [String] target_name
@see target_name
@param [Pathname, String] path @see path
@return [XCFramework] the xcframework at the given path
# File lib/cocoapods/xcode/xcframework.rb, line 35 def initialize(target_name, path) @target_name = target_name @path = Pathname.new(path).tap do |p| raise 'Absolute path is required' unless p.absolute? end @plist = Xcodeproj::Plist.read_from_path(plist_path) parse_plist_contents end
Public Instance Methods
@return [Pod::BuildType] the build type of the contained slices
@note As CocoaPods does not support mixed packaging nor linkage for xcframework slices,
we pick the first slice and assume all are the same
# File lib/cocoapods/xcode/xcframework.rb, line 74 def build_type @build_type ||= slices.first.build_type end
@return [Boolean] true if any slices use dynamic linkage
# File lib/cocoapods/xcode/xcframework.rb, line 59 def includes_dynamic_slices? build_type.dynamic? end
@return [Boolean] true if any slices use dynamic linkage
# File lib/cocoapods/xcode/xcframework.rb, line 65 def includes_static_slices? build_type.static? end
@return [String] the basename of the framework
# File lib/cocoapods/xcode/xcframework.rb, line 53 def name File.basename(path, '.xcframework') end
@return [Pathname] the path to the Info.plist
# File lib/cocoapods/xcode/xcframework.rb, line 47 def plist_path path + 'Info.plist' end
Private Instance Methods
# File lib/cocoapods/xcode/xcframework.rb, line 80 def parse_plist_contents @format_version = Pod::Version.new(plist['XCFrameworkFormatVersion']) @slices = plist['AvailableLibraries'].map do |library| identifier = library['LibraryIdentifier'] relative_path = library['LibraryPath'] archs = library['SupportedArchitectures'] platform_name = library['SupportedPlatform'] platform_variant = library['SupportedPlatformVariant'] headers = library['HeadersPath'] slice_root = path.join(identifier) slice_path = slice_root.join(relative_path) headers = slice_root.join(headers) unless headers.nil? XCFramework::Slice.new(slice_path, identifier, archs, platform_name, :platform_variant => platform_variant, :headers => headers) end raise Informative, "XCFramework at #{path} does not contain any frameworks or libraries." if slices.empty? end