Class: Fastlane::Actions::CreateXcframeworkAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::CreateXcframeworkAction
- Defined in:
- fastlane/lib/fastlane/actions/create_xcframework.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Methods inherited from Fastlane::Action
action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
114 115 116 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 114 def self. ["jgongo"] end |
.available_options ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 53 def self. [ FastlaneCore::ConfigItem.new(key: :frameworks, env_name: "FL_CREATE_XCFRAMEWORK_FRAMEWORKS", description: "Frameworks to add to the target xcframework", type: Array, optional: true, conflicting_options: [:libraries], verify_block: proc do |value| value.each do |framework| UI.user_error!("#{framework} doesn't end with '.framework'. Is this really a framework?") unless framework.end_with?('.framework') UI.user_error!("Couldn't find framework at #{framework}") unless File.exist?(framework) UI.user_error!("#{framework} doesn't seem to be a framework") unless File.directory?(framework) end end), FastlaneCore::ConfigItem.new(key: :libraries, env_name: "FL_CREATE_XCFRAMEWORK_LIBRARIES", description: "Libraries to add to the target xcframework, with their corresponding headers", type: Hash, optional: true, conflicting_options: [:frameworks], verify_block: proc do |value| value.each do |library, headers| UI.user_error!("Couldn't find library at #{library}") unless File.exist?(library) UI.user_error!("#{headers} doesn't exist or is not a directory") unless headers.empty? || File.directory?(headers) end end), FastlaneCore::ConfigItem.new(key: :output, env_name: "FL_CREATE_XCFRAMEWORK_OUTPUT", description: "The path to write the xcframework to", type: String, optional: false), FastlaneCore::ConfigItem.new(key: :allow_internal_distribution, env_name: "FL_CREATE_XCFRAMEWORK_ALLOW_INTERNAL_DISTRIBUTION", description: "Specifies that the created xcframework contains information not suitable for public distribution", type: Boolean, optional: true, default_value: false) ] end |
.category ⇒ Object
110 111 112 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 110 def self.category :building end |
.description ⇒ Object
31 32 33 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 31 def self.description "Package multiple build configs of a library/framework into a single xcframework" end |
.details ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 35 def self.details <<~DETAILS Utility for packaging multiple build configurations of a given library or framework into a single xcframework. If you want to package several frameworks just provide an array containing the list of frameworks to be packaged using the :frameworks parameter. If you want to package several libraries with their corresponding headers provide a hash containing the library as the key and the directory containing its headers as the value (or an empty string if there are no headers associated with the provided library). Finally specify the location of the xcframework to be generated using the :output parameter. DETAILS end |
.example_code ⇒ Object
103 104 105 106 107 108 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 103 def self.example_code [ "create_xcframework(frameworks: ['FrameworkA.framework', 'FrameworkB.framework'], output: 'UniversalFramework.xcframework')", "create_xcframework(libraries: { 'LibraryA.so' => '', 'LibraryB.so' => 'LibraryBHeaders'}, output: 'UniversalFramework.xcframework')" ] end |
.is_supported?(platform) ⇒ Boolean
118 119 120 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 118 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.output ⇒ Object
94 95 96 97 98 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 94 def self.output [ ['XCFRAMEWORK_PATH', 'Location of the generated xcframework'] ] end |
.return_value ⇒ Object
100 101 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 100 def self.return_value end |
.run(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'fastlane/lib/fastlane/actions/create_xcframework.rb', line 8 def self.run(params) UI.user_error!("Please provide either :frameworks or :libraries to be packaged into the xcframework") unless params[:frameworks] || params[:libraries] create_command = ['xcodebuild', '-create-xcframework'] create_command << params[:frameworks].map { |framework| ['-framework', "\"#{framework}\""] }.flatten if params[:frameworks] create_command << params[:libraries].map { |library, headers| ['-library', "\"#{library}\""] + (headers.empty? ? [] : ['-headers', "\"#{headers}\""]) } if params[:libraries] create_command << ['-output', "\"#{params[:output]}\""] create_command << ['-allow-internal-distribution'] if params[:allow_internal_distribution] if File.directory?(params[:output]) UI.("Deleting existing: #{params[:output]}") FileUtils.remove_dir(params[:output]) end Actions.lane_context[SharedValues::XCFRAMEWORK_PATH] = params[:output] sh(create_command) end |