diff --git a/CHANGELOG.md b/CHANGELOG.md index add70b2c7b..2cdac21c28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb b/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb index c9fd0bb7cd..35fb2f33ad 100644 --- a/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +++ b/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb @@ -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 diff --git a/lib/cocoapods/validator.rb b/lib/cocoapods/validator.rb index c7ba864c24..2611e1ad42 100644 --- a/lib/cocoapods/validator.rb +++ b/lib/cocoapods/validator.rb @@ -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