Skip to content

Commit

Permalink
Merge pull request #10937 from CocoaPods/info_plist_fix
Browse files Browse the repository at this point in the history
Set `INFOPLIST_FILE` build setting to `$(SRCROOT)/App/App-Info.plist`…
  • Loading branch information
dnkoutso committed Sep 10, 2021
2 parents c39584d + 48973fb commit 4855e1d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,6 +12,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Bug Fixes

* Set `INFOPLIST_FILE` build setting to `$(SRCROOT)/App/App-Info.plist` during lint.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10927](https://github.com/CocoaPods/CocoaPods/issues/10927)

* Set `PRODUCT_BUNDLE_IDENTIFIER` for generated app during lint.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#10933](https://github.com/CocoaPods/CocoaPods/issues/10933)
Expand Down
Expand Up @@ -48,17 +48,23 @@ def update_changed_file(generator, path)
# @param [Hash] additional_entries
# any additional entries to include in this Info.plist file.
#
# @param [String] build_setting_value
# an optional value to set for the `INFOPLIST_FILE` build setting on the
# native target. If none is specified then the value is calculated from the
# Info.plist path relative to the sandbox root.
#
# @return [void]
#
def create_info_plist_file_with_sandbox(sandbox, path, native_target, version, platform,
bundle_package_type = :fmwk, additional_entries: {})
bundle_package_type = :fmwk, additional_entries: {},
build_setting_value: nil)
UI.message "- Generating Info.plist file at #{UI.path(path)}" do
generator = Generator::InfoPlistFile.new(version, platform, bundle_package_type, additional_entries)
update_changed_file(generator, path)

relative_path_string = path.relative_path_from(sandbox.root).to_s
build_setting_value ||= path.relative_path_from(sandbox.root).to_s
native_target.build_configurations.each do |c|
c.build_settings['INFOPLIST_FILE'] = relative_path_string
c.build_settings['INFOPLIST_FILE'] = build_setting_value
end
end
end
Expand Down
8 changes: 7 additions & 1 deletion lib/cocoapods/validator.rb
Expand Up @@ -583,7 +583,13 @@ def create_app_project
app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name, deployment_target)
sandbox = Sandbox.new(config.sandbox_root)
info_plist_path = app_project.path.dirname.+('App/App-Info.plist')
Pod::Installer::Xcode::PodsProjectGenerator::TargetInstallerHelper.create_info_plist_file_with_sandbox(sandbox, info_plist_path, app_target, '1.0.0', Platform.new(consumer.platform_name), :appl)
Pod::Installer::Xcode::PodsProjectGenerator::TargetInstallerHelper.create_info_plist_file_with_sandbox(sandbox,
info_plist_path,
app_target,
'1.0.0',
Platform.new(consumer.platform_name),
:appl,
:build_setting_value => '$(SRCROOT)/App/App-Info.plist')
Pod::Generator::AppTargetHelper.add_swift_version(app_target, derived_swift_version)
app_target.build_configurations.each do |config|
# Lint will fail if a AppIcon is set but no image is found with such name
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/validator_spec.rb
Expand Up @@ -998,7 +998,7 @@ def podspec_path(name = 'JSONKit', version = '1.4', source = nil)
target.deployment_target.should.be.nil
target.platform_name.should == :ios
target.build_configurations.each do |c|
File.basename(c.build_settings['INFOPLIST_FILE']).should == 'App-Info.plist'
c.build_settings['INFOPLIST_FILE'].should == '$(SRCROOT)/App/App-Info.plist'
end
Xcodeproj::Project.schemes(project.path).should == %w(App)
end
Expand Down

0 comments on commit 4855e1d

Please sign in to comment.