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 AppHost infoplist integration #11692 #11820

Open
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[MagnificentMiles](https://github.com/MagnificentMiles)
[#12159](https://github.com/CocoaPods/CocoaPods/pull/12159)

* Fix AppHost infoplist integration, inject `info_plist_entries` into AppHost application.
[blastmann](https://github.com/blastmann)
[#11692](https://github.com/CocoaPods/CocoaPods/issues/11692)

## 1.14.3 (2023-11-19)

##### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,11 @@ def add_test_app_host_targets
end

target.test_spec_consumers.select(&:requires_app_host?).reject(&:app_host_name).group_by { |consumer| target.app_host_target_label(consumer.spec) }.
map do |(_, target_name), _|
AppHostInstaller.new(sandbox, project, target.platform, target_name, target.pod_name, target_name).install!
end
map do |(_, target_name), consumer| # expose consumer to the block
info_plist_entries = consumer.map(&:info_plist).reduce({}, &:merge)
# integrate `info_plist_entries` to AppHost for Photos\Location API testing
AppHostInstaller.new(sandbox, project, target.platform, target_name, target.pod_name, target_name, :info_plist_entries => info_plist_entries).install!
end
end

# Adds the app targets for the library to the Pods project with the
Expand Down
3 changes: 3 additions & 0 deletions spec/fixtures/watermelon-lib/WatermelonLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Pod::Spec.new do |s|

s.test_spec 'SnapshotTests' do |test_spec|
test_spec.requires_app_host = true
test_spec.info_plist = {
'NSPhotoLibraryUsageDescription' => 'Photo Library Access Warning.'
}
test_spec.source_files = 'SnapshotTests/*.{h,m}'
test_spec.dependency 'iOSSnapshotTestCase/Core'
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ class PodsProjectGenerator
installation_result.app_native_targets.count.should == 1
end

it 'snapshot tests must contains info_plist_entries' do
@ios_installer.install!
apphost_target = @project.targets[5]
info_plist_config_path = apphost_target.build_configurations[0].build_settings['INFOPLIST_FILE']
info_plist_path = temporary_sandbox.root.join(info_plist_config_path)
info_plist = info_plist_path.read
info_plist.should =~ %r{<key>NSPhotoLibraryUsageDescription<\/key>}
info_plist.should =~ %r{<string>Photo Library Access Warning.<\/string>}
end

it 'raises when a test spec has no source files' do
@watermelon_ios_pod_target.test_spec_consumers.first.stubs(:source_files).returns([])
e = ->() { @ios_installer.install! }.should.raise Informative
Expand Down