-
Notifications
You must be signed in to change notification settings - Fork 458
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
Variables in build settings are not resolved #505
Comments
This has been picked up as fastlane gym issue: fastlane/fastlane#10315 |
Can you try passing the root target? https://github.com/CocoaPods/Xcodeproj/blob/master/lib/xcodeproj/project/object/build_configuration.rb#L85, in this case it would be something like:
|
Actually, looks like for some of the times when I tried I forgot to use Anyways, when I try with It doesn't seem to be resolving it right if I understand it correctly. |
I'm happy to take a look at this later today. Thank you for trying out master. |
I had a look at this and the problem is that you're using @segiddins any hints on how to support include statements here? |
It'd probably require parsing the included file, and merging in the current file's settings on top of it |
In terms of workarounds that'd definitely one way to solve it temporarily. In the long term we'd need to get back to using Another thing that I noticed, that variable substitution logic in Do you think I should open a separate issue for |
Separate issue
I meant that as the way this would likely be implemented in Xcodeproj |
after updated to 1.5.3, arguments like And if I change it to |
As @truebit points out, arguments with recursion don't work yet in version 1.5.9. Any estimation for fixing this? |
Please open up another issue, and contributions are welcome to add that functionality! |
For anyone still coming across this issue, wrote a quick method which solves our somewhat limited use case of having arguments like # Augments config.resolve_build_setting from xcproject
# to continue expanding build settings and evaluate modifiers
def resolve_recursive_build_setting(config, setting)
resolution = config.resolve_build_setting(setting)
# finds values with one of
# $VALUE
# $(VALLUE)
# $(VALUE:modifier)
# ${VALUE}
# ${VALUE:modifier}
resolution.gsub(/\$[\(\{]?.+[\)\}]?/) do |raw_value|
# strip $() characters
unresolved = raw_value.gsub(/[\$\(\)\{\}]/, '')
# Get the modifiers after the ':' characters
name, *modifiers = unresolved.split(':')
# Expand variable name
subresolution = resolve_recursive_build_setting(config, name)
# Apply modifiers
# NOTE: not all cases accounted for
#
# See http://codeworkshop.net/posts/xcode-build-setting-transformations
# for various modifier options
modifiers.each do |modifier|
case modifier
when 'lower'
subresolution.downcase!
when 'upper'
subresolution.upcase!
else
# Fastlane message
UI.error("Unknown modifier: `#{modifier}` in `#{raw_value}")
end
end
subresolution
end
end Can replaced uses of resolve_recursive_build_setting(config, 'PRODUCT_BUNDLE_IDENTIFIER') |
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:Both variables are defined in
xcconfig
files and are correctly resolved by Xcode:The variables are also properly resolved by
xcodebuild -showBuildSettings
, for example:Using
xcodeproj
gem, however, fails to resolve the build settings:The text was updated successfully, but these errors were encountered: