Skip to content

Commit

Permalink
Merge pull request #10460 from CocoaPods/pb-xcf-objc
Browse files Browse the repository at this point in the history
Fix missing -ObjC for xcframeworks - take 2
  • Loading branch information
dnkoutso committed Jul 2, 2021
2 parents 84d8154 + 725e969 commit 65c23ed
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 33 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -24,6 +24,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* Fix missing `-ObjC` for static XCFrameworks - take 2
[Paul Beusterien](https://github.com/paulb777)
[#10459](https://github.com/CocoaPods/CocoaPods/issuess/10459)

* Change URL validation failure to a note
[Paul Beusterien](https://github.com/paulb777)
[#10291](https://github.com/CocoaPods/CocoaPods/issues/10291)
Expand Down
11 changes: 10 additions & 1 deletion lib/cocoapods/sandbox/file_accessor.rb
Expand Up @@ -172,6 +172,15 @@ def vendored_dynamic_frameworks
end
end

# @return [Array<Pathname>] The paths of the dynamic xcframework bundles
# that come shipped with the Pod.
#
def vendored_static_xcframeworks
vendored_xcframeworks.select do |path|
Xcode::XCFramework.new(path).build_type == BuildType.static_framework
end
end

# @return [Array<Pathname>] The paths of the static (fake) framework
# bundles that come shipped with the Pod.
#
Expand Down Expand Up @@ -289,7 +298,7 @@ def vendored_dynamic_artifacts
# that come shipped with the Pod.
#
def vendored_static_artifacts
vendored_static_libraries + vendored_static_frameworks
vendored_static_libraries + vendored_static_frameworks + vendored_static_xcframeworks
end

# @return [Hash{String => Array<Pathname>}] A hash that describes the
Expand Down
16 changes: 0 additions & 16 deletions lib/cocoapods/target/build_settings.rb
Expand Up @@ -1263,24 +1263,8 @@ def other_swift_flags_without_swift?
end
end

# @return [Boolean]
define_build_settings_method :any_vendored_static_xcframeworks?, :memoized => true do
pod_targets.any? do |pt|
pt.build_settings.any? do |bs|
if bs.respond_to?(:vendored_xcframeworks)
bs.vendored_xcframeworks.any? do |xcf|
xcf.build_type == BuildType.static_framework
end
end
end
end
end

# @return [Boolean]
define_build_settings_method :any_vendored_static_artifacts?, :memoized => true do
if any_vendored_static_xcframeworks?
return true
end
pod_targets.any? do |pt|
pt.file_accessors.any? do |fa|
!fa.vendored_static_artifacts.empty?
Expand Down
16 changes: 1 addition & 15 deletions spec/unit/target/build_settings_spec.rb
Expand Up @@ -352,19 +352,13 @@ def aggregate(aggregate_target, configuration_name = 'Release')
file_accessor = stub('file_accessor',
:spec => spec,
:spec_consumer => consumer,
:vendored_static_artifacts => [],
:vendored_static_artifacts => [1, 2, 3],
:vendored_static_libraries => [],
:vendored_dynamic_libraries => [],
:vendored_static_frameworks => [],
:vendored_dynamic_frameworks => [],
:vendored_xcframeworks => [],
)
vendored_xcframework = stub('vendored_xcframework',
:build_type => BuildType.static_framework,
)
build_setting = stub('build_setting',
:vendored_xcframeworks => [vendored_xcframework],
)
pod_target = stub('pod_target',
:any_vendored_static_artifacts? => true,
:file_accessors => [file_accessor],
Expand All @@ -377,7 +371,6 @@ def aggregate(aggregate_target, configuration_name = 'Release')
:spec_consumers => [consumer],
:build_as_static? => false,
:build_as_dynamic? => false,
:build_settings => [build_setting],
:product_basename => 'PodTarget',
:target_definitions => [target_definition],
:root_spec => spec,
Expand Down Expand Up @@ -407,12 +400,6 @@ def aggregate(aggregate_target, configuration_name = 'Release')
:vendored_dynamic_frameworks => [],
:vendored_xcframeworks => [],
)
vendored_xcframework = stub('vendored_xcframework',
:build_type => BuildType.dynamic_framework,
)
build_setting = stub('build_setting',
:vendored_xcframeworks => [vendored_xcframework],
)
pod_target = stub('pod_target',
:any_vendored_static_artifacts? => true,
:file_accessors => [file_accessor],
Expand All @@ -425,7 +412,6 @@ def aggregate(aggregate_target, configuration_name = 'Release')
:spec_consumers => [consumer],
:build_as_static? => false,
:build_as_dynamic? => false,
:build_settings => [build_setting],
:product_basename => 'PodTarget',
:target_definitions => [target_definition],
:root_spec => spec,
Expand Down

0 comments on commit 65c23ed

Please sign in to comment.