CocoaPods / CocoaPods/Xcodeproj

resolved_build_setting does not consider variables with same key from project xcconfig

Open
#883 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
2.4k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

Given a Xcode project with a `xcconfig` file defining `PRODUCT_BUNDLE_IDENTIFIER` and targets using the setting with the same key (e.g. `$(PRODUCT_BUNDLE_IDENTIFIER).suffix`), I would expect the targets to have the variable in the value resolved with the value defined in `xcconfig` when querying with `resolved_build_setting`.

```native_target_spec.rb
#native_target_spec.rb

it 'returns the resolved build setting string value for a given key considering variable substitution: target referencing project xcconfig' do
project_xcconfig = @project.new_file(fixture_path('project.xcconfig'))
@project.build_configuration_list.build_configurations.each { |build_config| build_config.base_configuration_reference = project_xcconfig }
@target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', '$(PRODUCT_BUNDLE_IDENTIFIER).suffix')
expected_value_release = 'com.cocoapods.app.suffix'
expected_value_debug = 'com.cocoapods.app.dev.suffix'
@target.resolved_build_setting('PRODUCT_BUNDLE_IDENTIFIER', true).should == { 'Release' => expected_value_release, 'Debug' => expected_value_debug }
end
```

However, only the value of the `xcconfig` file is used:

```
Bacon::Error: {"Release"=>"com.cocoapods.app", "Debug"=>"com.cocoapods.app.dev"}.==({"Release"=>"com.cocoapods.app.suffix", "Debug"=>"com.cocoapods.app.dev.suffix"}) failed
```

As far as I see, this only happens when using a variable with the same name as the key.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.