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

Do not validate modular header dependencies for pre-built Swift pods. #10914

Merged
merged 1 commit into from Sep 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: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* None.
* Do not validate modular header dependencies for pre-built Swift pods.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10912](https://github.com/CocoaPods/CocoaPods/issues/10912)


## 1.11.0 (2021-09-01)
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods/installer/xcode/target_validator.rb
Expand Up @@ -129,7 +129,7 @@ def verify_swift_pods_swift_version
def verify_swift_pods_have_module_dependencies
error_messages = []
pod_targets.each do |pod_target|
next unless pod_target.uses_swift?
next unless pod_target.uses_swift? && pod_target.should_build?

non_module_dependencies = []
pod_target.dependent_targets.each do |dependent_target|
Expand Down
24 changes: 24 additions & 0 deletions spec/unit/installer/xcode/target_validator_spec.rb
Expand Up @@ -448,6 +448,7 @@ def create_validator(sandbox, podfile, lockfile)
@validator = create_validator(config.sandbox, podfile, lockfile)
@validator.stubs(:pod_targets).returns([stub('MultiSwift',
:uses_swift? => true,
:should_build? => true,
:swift_version => nil,
:dependent_targets => [],
:spec_swift_versions => ['4.0'])])
Expand Down Expand Up @@ -519,6 +520,29 @@ def create_validator(sandbox, podfile, lockfile)
@validator.pod_targets.find { |pt| pt.name == 'matryoshka' }.stubs(:should_build?).returns(false)
lambda { @validator.validate! }.should.not.raise
end

it 'does not raise when a pre built swift target depends upon a target that requires building' do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

verified I saw the same issue as reported without my code change.

fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Podfile.new do
project(fixture_path + 'SampleProject/SampleProject').to_s
platform :ios, '12.0'
install! 'cocoapods', :integrate_targets => false
pod 'VendoredSwiftFramework', :path => (fixture_path + 'prebuilt-swift-framework').to_s
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a nice fixture of a pre-built swift framework that cocoapods 1.11.x now treats uses_swift? as true.

pod 'matryoshka', :path => (fixture_path + 'matryoshka').to_s
target 'SampleProject'
target 'TestRunner'
end
lockfile = generate_lockfile

@validator = create_validator(config.sandbox, podfile, lockfile)
podfile.target_definition_list.find { |td| td.name == 'SampleProject' }.swift_version = '3.0'
podfile.target_definition_list.find { |td| td.name == 'TestRunner' }.swift_version = '3.0'
vendored_swift_framework_pod_target = @validator.pod_targets.find { |pt| pt.name == 'VendoredSwiftFramework' }
matryoshka_pod_target = @validator.pod_targets.find { |pt| pt.name == 'matryoshka' }
vendored_swift_framework_pod_target.stubs(:dependent_targets).returns([matryoshka_pod_target])
lambda { @validator.validate! }.should.not.raise
end
end

describe '#verify_no_multiple_project_names' do
Expand Down