tuist / tuist

Tuist's CLI
https://tuist.io
MIT License
4.57k stars 554 forks source link

Tuist rewrite GCC_PREFIX_HEADER when resource bundle synthesizer enabled ignoring user-defined values #6318

Closed Ernest0-Production closed 4 months ago

Ernest0-Production commented 5 months ago

What happened?

When I enable resource bundle synthesizer from Project.Options tuist specify custom GCC_PREFIX_HEADER in base configuration of targets that contains objc files.

But in my project already exists custom .pch files.

Workaround:

Specify custom GCC_PREFIX_HEADER in SettingsDictionary of settings.configurations for each configuration:

extension Array<Target> {
    fileprivate func appendingCustomCPrefixHeader() -> [Target] {
        map { target in
            guard var settings = target.settings else {
                return target
            }

            for configurationIndex in settings.configurations.indices {
                settings.configurations[configurationIndex].settings.merge(SettingsDictionary()
                    .cPrefixHeader("path/to/MyPrefix.pch"))
                )
            }

            return transforming(target) {
                $0.settings = settings
            }
        }
    }
}

How do we reproduce it?

-

Error log

-

macOS version

Sonoma

Tuist version

4.11

Xcode version

15.3

pepicrft commented 5 months ago

@Ernest0-Production would you be interested in contributing a fix yourself? This line seems to be overriding whatever value exists in the settings. What you can do instead is to use this helper method to prevent overriding the value.

Ernest0-Production commented 4 months ago

@pepicrft Hi! I would really be interested in becoming a tuist contributor, since I have already reported several issues.

But unfortunately, I still can’t find free time to participate in fixing at least one of the issues I created ☹️

pepicrft commented 4 months ago

Sure! No worries, it's very understandable :). I flagged it as a good first-time issue, so hopefully, someone will pick it up earlier than us. Otherwise I'm afraid it'll take a bit longer for us to pick it up.

fortmarek commented 4 months ago

Hey!

This should have been fixed by: https://github.com/tuist/tuist/pull/6388

We can reopen if that's not the case 🤞