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

Fix missing -ObjC for xcframeworks - take 2 #10460

Merged
merged 3 commits into from Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do these need to be compact?

Copy link
Contributor

@dnkoutso dnkoutso Feb 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess not it seems it only selects the ones that are static frameworks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since select just needs a boolean we don't need to return the path

select do |path|
   Xcode::XCFramework.new(path).build_type == BuildType.static_framework
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed. Thanks @amorde !

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