Open tww0003 opened 2 years ago
You can apply the setting to the whole project under the top level settings
, instead of in a target
Still an issue.
Setting it on the project level works, but I believe it should also be possible setting on individual targets.
I'm not sure I understand the issue? What is Xcode doing that is different? If when you're applying this in Xcode using the Build Settings tab, it applies the set build setting depending at which level you click on (target, project, config..etc). Is there something specific about this particular build setting I'm not understanding?
I am trying to create a reproducible example
Ok I tried it multiple times even before posting my comment with a project from scratch, but could not reproduce it. I can still reproduce it in our mono-repo with an Xcode workspace and two Xcode Projects containing a variety of targets. I just tried to reduce the project to minimal version, so I can upload it here, but for some reason the issue disappeared during that.
But to give you some insights on the issue, I can at least give further explanation:
First my project file looked roughly like this:
targets:
Editor:
type: application
platform: iOS
sources:
- Sources
settingPresets: all
settings:
base:
INFOPLIST_FILE: Generated/XcodeGen/Editor/Base.lproj/Info.plist
Which resulted in this warning:
So I added the necessary settings:
targets:
Editor:
type: application
platform: iOS
sources:
- Sources
settingPresets: all
settings:
base:
INFOPLIST_FILE: Generated/XcodeGen/Editor/Base.lproj/Info.plist
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: 'YES'
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: 'NO'
ENABLE_USER_SCRIPT_SANDBOXING: 'NO'
The warning still persists, but now the 'Enable User Script Sandboxing' is gone:
I expected all warnings to be resolved. Now if I move the settings to a project wide settings
area, like this:
settings:
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: 'YES'
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: 'NO'
ENABLE_USER_SCRIPT_SANDBOXING: 'NO'
targets:
Editor:
type: application
platform: iOS
sources:
- Sources
settingPresets: all
settings:
base:
INFOPLIST_FILE: Generated/XcodeGen/Editor/Base.lproj/Info.plist
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: 'YES'
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: 'NO'
ENABLE_USER_SCRIPT_SANDBOXING: 'NO'
The warnings are gone, and the diff of the project.pbxproj
looks like this for the 'Debug', 'Staging' and 'Production' configuration:
Now if I remove the settings from the target like the following:
settings:
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: 'YES'
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: 'NO'
ENABLE_USER_SCRIPT_SANDBOXING: 'NO'
#########
# Targets
#########
targets:
Editor:
type: application
platform: iOS
sources:
- Sources
settingPresets: all
settings:
base:
INFOPLIST_FILE: Generated/XcodeGen/Editor/Base.lproj/Info.plist
# CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED: 'YES'
# ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS: 'NO'
# ENABLE_USER_SCRIPT_SANDBOXING: 'NO'
The errors are still gone and the changes in the project.pbxproj
look like this:
Clang settings appear to be added to the wrong configuration list within the
project.pbxproj
file.When trying to set
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED
toYES
in order to silence a warning, Xcodegen adds them to thePBXNativeTarget
build configuration list while changing the setting within Xcode applies it within thePBXProject
build configuration list.Is there a way to make sure that this setting gets applied to the correct configuration list?