Class: Fastlane::Actions::BuildSettingsToFlagsAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BuildSettingsToFlagsAction
- Defined in:
- lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb
Overview
Action to map build settings to build flags.
Xcspecs collapse
-
.load_complete_spec(name, xcode:) ⇒ Xcspec
Load complete spec.
-
.load_spec(name, xcode:) ⇒ Xcspec
Load xcspec.
Info and Options collapse
-
.authors ⇒ Object
Plugin action authors.
-
.available_options ⇒ Object
Plugin action available options.
-
.category ⇒ Object
Plugin action category.
-
.description ⇒ Object
Plugin action description.
-
.details ⇒ Object
Plugin action details.
-
.is_supported?(platform) ⇒ Boolean
Check if platform is supported by the action.
-
.return_value ⇒ Object
Plugin action return value.
Class Method Summary collapse
-
.run(params) ⇒ Hash
Run action.
Class Method Details
.authors ⇒ Object
Plugin action authors.
90 91 92 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 90 def self. ["Maksym Grebenets"] end |
.available_options ⇒ Object
Plugin action available options.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 115 def self. [ FastlaneCore::ConfigItem.new(key: :build_settings, env_name: "XCCONFIG_ACTIONS_BUILD_FLAGS_BUILD_SETTINGS", description: "Build settings to convert to build flags", optional: true, type: Hash, verify_block: proc do |value| UI.user_error!("Missing build settings") if value.nil? end), FastlaneCore::ConfigItem.new(key: :xcode, env_name: "XCCONFIG_ACTIONS_BUILD_FLAGS_XCODE", description: "Xcode version of path to Xcode.app", optional: true, default_value: "10.2", type: String), FastlaneCore::ConfigItem.new(key: :output_path, env_name: "XCCONFIG_ACTIONS_BUILD_FLAGS_OUTPUT_PATH", description: "Output path to save build settings JSON", optional: true, type: String) ] end |
.category ⇒ Object
Plugin action category.
110 111 112 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 110 def self.category :building end |
.description ⇒ Object
Plugin action description.
85 86 87 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 85 def self.description "Map xcconfig build settings to compiler and linker build flags" end |
.details ⇒ Object
Plugin action details.
100 101 102 103 104 105 106 107 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 100 def self.details [ "Build flags keys:", "- compiler_flags: CXX compiler flags for clang compiler", "- swift_compiler_flags: Compiler flags for Swift compiler", "- linker_flags: Linker flags for clang linker (Cxx and Swift)" ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
Check if platform is supported by the action.
142 143 144 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 142 def self.is_supported?(platform) [:ios, :mac].include?(platform) end |
.load_complete_spec(name, xcode:) ⇒ Xcspec
Load complete spec.
64 65 66 67 68 69 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 64 def self.load_complete_spec(name, xcode:) Xcspec.new( ActionHelper.find_xcspec(name, xcode: xcode), core_build_system_spec: load_spec("CoreBuildSystem*", xcode: xcode) ) end |
.load_spec(name, xcode:) ⇒ Xcspec
Load xcspec.
75 76 77 78 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 75 def self.load_spec(name, xcode:) spec_path = ActionHelper.find_xcspec(name, xcode: xcode) Xcspec.new(spec_path) end |
.return_value ⇒ Object
Plugin action return value.
95 96 97 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 95 def self.return_value "Build flags dictionary" end |
.run(params) ⇒ Hash
Run action.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fastlane/plugin/xcconfig_actions/actions/build_settings_to_flags_action.rb', line 22 def self.run(params) build_settings = params[:build_settings] || Actions.lane_context[SharedValues::XCCONFIG_ACTIONS_BUILD_SETTINGS] UI.user_error!("Missing build settings input") unless build_settings xcode = params[:xcode] # TODO: Add support for com.apple.compilers.llvm.clang.1_0.analyzer tool. clang_spec = load_complete_spec("Clang*", xcode: xcode) swift_spec = load_complete_spec("Swift*", xcode: xcode) linker_spec = load_complete_spec("Ld*", xcode: xcode) clang_mapping = clang_spec.map_build_settings(build_settings) swift_mapping = swift_spec.map_build_settings(build_settings) linker_mapping = linker_spec.map_build_settings(build_settings) flags = { "compiler_flags" => clang_mapping.flags, "swift_compiler_flags" => swift_mapping.flags, "linker_flags" => [ linker_mapping.flags, linker_mapping.linker_flags, clang_mapping.linker_flags, swift_mapping.linker_flags ].reject(&:empty?).join(" ") } Actions.lane_context[SharedValues::XCCONFIG_ACTIONS_BUILD_FLAGS] = flags if params[:output_path] File.open(params[:output_path], "w") { |f| f.puts(flags.to_json) } else return flags end end |