Skip to content

Variables in build settings are not resolved #505

@mgrebenets

Description

@mgrebenets

Variables defined in xcconfig files and then used in build settings are not properly resolved.

Here's a sample project:
https://github.com/mgrebenets/XcodeprojBuildSettingsDemo

For example, PROVISIONING_PROFILE_SPECIFIER build setting is configured like so:
image

Both variables are defined in xcconfig files and are correctly resolved by Xcode:
image

The variables are also properly resolved by xcodebuild -showBuildSettings, for example:

xcodebuild -showBuildSettings -project  XcodeprojBuildSettingsDemo.xcodeproj` -configuration Release

# Output:
#  PROVISIONING_PROFILE_SPECIFIER = au.com.company.app

xcodebuild -showBuildSettings -project  XcodeprojBuildSettingsDemo.xcodeproj` -configuration Debug

# Output:
# PROVISIONING_PROFILE_SPECIFIER = match Development dev-au.com.company.app.prod

Using xcodeproj gem, however, fails to resolve the build settings:

path = 'path/to/XcodeprojBuildSettingsDemo/XcodeprojBuildSettingsDemo.xcodeproj'
p = Xcodeproj::Project.open(path)
t = p.targets.first
bc = t.build_configurations[1]
bs = bc.resolve_build_setting('PROVISIONING_PROFILE_SPECIFIER')
puts bs

# Output:
# $(COM_RELEASE_PROVISIONING_PROFILE_SPECIFIER_PROD)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions