Module: Pod::Bazel::XCConfigResolver
- Included in:
- Target
- Defined in:
- lib/cocoapods/bazel/xcconfig_resolver.rb
Class Method Summary collapse
- .resolve_xcconfig(xcconfig, default_xcconfigs: []) ⇒ Object
- .resolved_build_setting_value(setting, settings:) ⇒ Object
Class Method Details
.resolve_xcconfig(xcconfig, default_xcconfigs: []) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cocoapods/bazel/xcconfig_resolver.rb', line 37 def resolve_xcconfig(xcconfig, default_xcconfigs: []) matching_defaults = default_xcconfigs.select do |_, config| (config.keys - xcconfig.keys).empty? end xcconfig.each_key { |k| xcconfig[k] = resolved_build_setting_value(k, settings: xcconfig) } xcconfig.delete_if do |k, v| UNRESOLVED_SETTINGS.include?(k) || v.empty? end unless matching_defaults.empty? transformed = matching_defaults.map do |name, default_config| [name, xcconfig.reject do |k, v| v == default_config[k] end] end name, xcconfig = transformed.min_by { |(_, config)| config.size } end [name, xcconfig] end |
.resolved_build_setting_value(setting, settings:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cocoapods/bazel/xcconfig_resolver.rb', line 8 def resolved_build_setting_value(setting, settings:) return unless (value = settings[setting]) # Removes the : bazel prefix for current directory. sub_prefix = ->(s) { s.sub(%r{\A:/}, '') } resolved = Pod::Bazel::Util.resolve_value(value, resolved_values: settings) if Pod::Target::BuildSettings::PLURAL_SETTINGS.include?(setting) resolved.shellsplit.reject(&:empty?).map(&sub_prefix) else sub_prefix[resolved] end end |