From a71a20267fc4ec8a7c60fc72477820de7f9d4ca6 Mon Sep 17 00:00:00 2001 From: Oleg Fedyakin Date: Fri, 14 Jan 2022 14:05:33 +0300 Subject: [PATCH 1/3] Fix in case when xcconfig have numbers --- lib/cocoapods/bazel/xcconfig_resolver.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cocoapods/bazel/xcconfig_resolver.rb b/lib/cocoapods/bazel/xcconfig_resolver.rb index 1383ff6..e22deba 100644 --- a/lib/cocoapods/bazel/xcconfig_resolver.rb +++ b/lib/cocoapods/bazel/xcconfig_resolver.rb @@ -8,7 +8,11 @@ module XCConfigResolver def resolved_build_setting_value(setting, settings:) return unless (value = settings[setting]) - sub_prefix = ->(s) { s.sub(%r{\A:/}, '') } + sub_prefix = ->(s) { + str_value = s.to_s + str_value.sub(%r{\A:/}, '') + return str_value + } resolved = resolve_string_with_build_settings(value, settings: settings) if Pod::Target::BuildSettings::PLURAL_SETTINGS.include?(setting) resolved.shellsplit.reject(&:empty?).map(&sub_prefix) From 4559526502a7ac1f4905a50e6e8fa57b4496d45f Mon Sep 17 00:00:00 2001 From: Oleg Fedyakin Date: Wed, 26 Jan 2022 12:40:48 +0300 Subject: [PATCH 2/3] Fix codestyle --- lib/cocoapods/bazel/xcconfig_resolver.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/cocoapods/bazel/xcconfig_resolver.rb b/lib/cocoapods/bazel/xcconfig_resolver.rb index e22deba..2ea45d5 100644 --- a/lib/cocoapods/bazel/xcconfig_resolver.rb +++ b/lib/cocoapods/bazel/xcconfig_resolver.rb @@ -8,11 +8,8 @@ module XCConfigResolver def resolved_build_setting_value(setting, settings:) return unless (value = settings[setting]) - sub_prefix = ->(s) { - str_value = s.to_s - str_value.sub(%r{\A:/}, '') - return str_value - } + sub_prefix = ->(s) { s.to_s.sub(%r{\A:/}, '') } + resolved = resolve_string_with_build_settings(value, settings: settings) if Pod::Target::BuildSettings::PLURAL_SETTINGS.include?(setting) resolved.shellsplit.reject(&:empty?).map(&sub_prefix) From 34f2b91cf8c0feed500c3d3c353c7f35a7ba7b2c Mon Sep 17 00:00:00 2001 From: Oleg Fedyakin Date: Thu, 3 Feb 2022 15:06:27 +0300 Subject: [PATCH 3/3] Exclude private headers in public headers section --- .ruby-version | 1 + lib/cocoapods/bazel/target.rb | 3 ++- lib/cocoapods/bazel/xcconfig_resolver.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..e70b452 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.6.0 diff --git a/lib/cocoapods/bazel/target.rb b/lib/cocoapods/bazel/target.rb index 11a075c..0bc2369 100644 --- a/lib/cocoapods/bazel/target.rb +++ b/lib/cocoapods/bazel/target.rb @@ -278,13 +278,14 @@ def common_pod_target_infoplists(additional_plist: nil) def to_rule_kwargs kwargs = RuleArgs.new do |args| + private_header_files_array = file_accessors.map(&:spec_consumer).flat_map(&:private_header_files).flat_map { |g| expand_glob(g, expand_directories: false) } args .add(:name, label) .add(:module_name, product_module_name, defaults: [label]) .add(:module_map, !non_library_spec && file_accessors.map(&:module_map).find(&:itself)&.relative_path_from(@package_dir)&.to_s, defaults: [nil, false]). # public headers - add(:public_headers, glob(attr: :public_headers, sorted: false).yield_self { |f| case f when Array then f.reject { |path| path.include? '.framework/' } else f end }, defaults: [[]]) + add(:public_headers, glob(attr: :public_headers, sorted: false, excludes: private_header_files_array).yield_self { |f| case f when Array then f.reject { |path| path.include? '.framework/' } else f end }, defaults: [[]]) .add(:private_headers, glob(attr: :private_headers).yield_self { |f| case f when Array then f.reject { |path| path.include? '.framework/' } else f end }, defaults: [[]]) .add(:pch, glob(attr: :prefix_header, return_files: true).first, defaults: [nil]) .add(:data, glob(attr: :resources, exclude_directories: 0), defaults: [[]]) diff --git a/lib/cocoapods/bazel/xcconfig_resolver.rb b/lib/cocoapods/bazel/xcconfig_resolver.rb index 2ea45d5..205a665 100644 --- a/lib/cocoapods/bazel/xcconfig_resolver.rb +++ b/lib/cocoapods/bazel/xcconfig_resolver.rb @@ -9,7 +9,7 @@ def resolved_build_setting_value(setting, settings:) return unless (value = settings[setting]) sub_prefix = ->(s) { s.to_s.sub(%r{\A:/}, '') } - + resolved = resolve_string_with_build_settings(value, settings: settings) if Pod::Target::BuildSettings::PLURAL_SETTINGS.include?(setting) resolved.shellsplit.reject(&:empty?).map(&sub_prefix)