Question or problem
I have some questions about the settings
property.
When I use the .settings(bsae: configurations: defaultSettings)
api, what are the override relationships of these three properties?
I am curious about this question in both the Project
and Target
objects.
I found this issue: Avoids override xcconfig provided settings with Tuist defaults. To be honest, I don’t quite understand why defaultSettings
was designed to have the highest priority from the beginning? I think it’s most intuitive that xcconfig
has the highest priority.
After further testing, I found that it is not possible to say “defaultSettings
has the highest priority”. Different Keys will have different behaviors, and the same Key may not have the same overriding behavior in Project
and Target
. For example, in Project
, I don’t need to add CODE_SIGN_IDENTITY
in excluding
, but if I don’t add it in Target
, the setting will be overwritten by defaultSettings
.
Expectation
I hope there is at least a clear document that can show the overriding behavior of each key (at least most commonly used keys, which can be handed over to the community through PR later)
Context
Based on my usage, I have summarized some Keys that will be overwritten by defaultSettings
in Project
:
CLANG_CXX_LANGUAGE_STANDARD
DEBUG_INFORMATION_FORMAT
ENABLE_TESTABILITY
GCC_OPTIMIZATION_LEVEL
GCC_PREPROCESSOR_DEFINITIONS
MTL_ENABLE_DEBUG_INFO
ONLY_ACTIVE_ARCH
The following keys will not be overridden by defaultSettings
:
ENABLE_NS_ASSERTIONS
VALIDATE_PRODUCT
SWIFT_COMPILATION_MODE
Hey @rakuyoMo 
Tuist doesn’t have the capability to read .xcconfig
files which is why Tuist’s default settings override those defined in .xcconfig
– which is not the case if you define your settings directly in Project.swift
.
You either:
- need to use the
.none
settings and fully take control of your settings
- add
excluding
for recommended or base settings that you want to override
- move your settings definition to the
Project.swift
(or ProjectDescriptionHelpers
)
Ideally, we’d be able to read .xcconfig
files and respect your defaults – unfortunately, reading .xcconfig
files without building the project means reading them using regex, which is very hard to get right. We’re open to contributions here, but it’s unlikely something we are to implement.
@marekfort Hello, thank you for your answer. I understand the current technical difficulties.
Can you give me a github address with default settings? By looking at the code, I think I can do a better job and give some help to others who see this post.