Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude private headers from public #61

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.0
3 changes: 2 additions & 1 deletion lib/cocoapods/bazel/target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: [[]])
Expand Down
3 changes: 2 additions & 1 deletion lib/cocoapods/bazel/xcconfig_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module XCConfigResolver
def resolved_build_setting_value(setting, settings:)
return unless (value = settings[setting])

sub_prefix = ->(s) { s.sub(%r{\A:/}, '') }
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)
Expand Down