XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Clear specific build setting

Open acecilia opened this issue 6 years ago • 9 comments

Hi:

I am using xcconfig files to inject build settings to the xcode project. I managed to remove all build settings from the project except for SDKROOT by doing:

options:
  settingPresets: none

Is there any way I can clear SDKROOT from the project build settings, as I have it set in the xcconfig files?

For example:

settings:
  SDKROOT: none

Thanks

acecilia avatar Apr 01 '19 13:04 acecilia

Hi @acecilia If you want to override that you can set the target setting to ${inherited}

settings:
  SDKROOT: ${inherited}

May I ask, do your SDKROOT settings not align with what XcodeGen generates by default?

yonaskolb avatar Apr 02 '19 12:04 yonaskolb

Hi @yonaskolb: Ideally, I would like to not specify any platform, as I already set SDKROOT with the xcconfig files. I saw that platform is mandatory, and that is the reason I was looking into clearing SDKROOT (as it is set automatically).

To answer your question:

  • Yes, the platform information I introduce in project.yml is the same as the one I have set with SDKROOT using xcconfig files. But its duplication of information, that is why I would like to only rely in the xcconfig files.

Thanks for your answer! I tried your approach, but it still appears in the xcode project as set:

Screenshot 2019-04-02 at 17 04 42

acecilia avatar Apr 02 '19 15:04 acecilia

At this point, being able to clear that setting isn't possible. As it's the same value as your own settings though, I don't see an issue here

yonaskolb avatar Apr 06 '19 10:04 yonaskolb

I'd like to 2nd this issue. We have a modular app and moved to exclusively .xcconfig files about a year ago. We have a danger check to validate that each project.pbxproj has an empty build settings array, forcing .xcconfig usage. Despite using settingPresets: none I too am getting a couple of build settings to still come through, INFOPLIST_FILE and FRAMEWORK_SEARCH_PATHS.

Is there a reason that any config is still set with settingPresets: none applied? I'd be happy to go track down why they're still being set if you'd be okay with merging the PR afterwards.

bclymer avatar Aug 23 '19 19:08 bclymer

I'd like this ability too, or at least that the CODE_SIGN_IDENTITY wouldn't default to "".

PadraigK avatar Dec 09 '19 23:12 PadraigK

We have the same issue, we have a danger check to ensure no project files have any settings in them and everything is in xcconfig files. We can remove the build settings after generating the project with a ruby script using xcodeproj but we have 30+ targets and deleting the settings and saving the projects take a while and the process as a whole takes more than twice as much time so I'd rather generate the project without it

akaralar avatar Jan 22 '21 19:01 akaralar

I'd welcome a PR that doesn't apply any build settings if options.settingsPresets: none. In hindsight the name of that option isn't great, as settings coming from the preset yaml files is just an implementation detail. I also welcome other ideas of how to configure this

yonaskolb avatar Feb 25 '21 06:02 yonaskolb

IMO: Don't validate or lint pbxproj itself as it's an implementation detail already. Validate output of xcodebuild -showBuildSetting in Danger like script in your CI workflow so it's safer.

toshi0383 avatar Feb 25 '21 13:02 toshi0383

Just hit this as well. I wrote a quick script to just remove all build settings after generating the pbxproj:

#!/usr/bin/env bash

xcode_project="${1}"
pbxproj_file="${xcode_project}/project.pbxproj"

perl -0pe 's/buildSettings = \{[^}]*\};/buildSettings = \{\};/gms' "${pbxproj_file}" > fixed.pbxproj
mv fixed.pbxproj "${pbxproj_file}"

armcknight avatar Jul 28 '22 02:07 armcknight