https://github.com/toshi0383/xcconfig-extractor
Refactor BuildSettings into xcconfigs
https://github.com/toshi0383/xcconfig-extractor
swift xcconfig xcode
Last synced: 9 months ago
JSON representation
Refactor BuildSettings into xcconfigs
- Host: GitHub
- URL: https://github.com/toshi0383/xcconfig-extractor
- Owner: toshi0383
- License: mit
- Created: 2017-04-06T14:57:05.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-24T14:38:13.000Z (over 5 years ago)
- Last Synced: 2025-01-11T20:22:26.825Z (over 1 year ago)
- Topics: swift, xcconfig, xcode
- Language: Swift
- Homepage:
- Size: 170 KB
- Stars: 128
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# xcconfig-extractor
Refactor buildSettings into xcconfigs.
[](https://app.bitrise.io/app/31197448d2a1080e)
[](https://www.patreon.com/bePatron?u=13627375)
# Requirements
- Xcode10+ is officially supported, but should work against older ones too.
# Usage
```bash
$ xcconfig-extractor /path/to/Your.xcodeproj Configurations
```
This will create xcconfig files under `Configuration` dir. Configurations are removed from `buildSettings` section of pbxproj.
Generated xcconfigs are added to your project automatically. ✏️

# Available Options
```bash
Options:
--no-trim-duplicates [default: false] - Don't extract duplicated lines to common xcconfig files, simply map each buildSettings to one file.
--no-edit-pbxproj [default: false] - Do not modify pbxproj at all.
--include-existing [default: true] - `#include` already configured xcconfigs.
--no-set-configurations [default: false] - Do not set xcconfig(baseConfigurationReference) in pbxproj. Ignored if `--no-edit-pbxproj` is true.
```
# Build Setting Validation
⚠️ ***Waring*** ⚠️
`xcconfig-extractor` is a refactoring tool. It shouldn't affect your App's actual "Build Setting".
Recommended way to check Build Settings is to use `xcodebuild` command. Make sure outputs does not change between before and after.
```bash
$ xcodebuild -showBuildSettings -configuration Release > before
$ # apply xcconfig-extractor
$ xcodebuild -showBuildSettings -configuration Release > after
$ diff before after # should prints nothing!
```
If outputs differ, fix it manually e.g. simply by adding missing value to target's xcconfig.
xcconfig does not allow any `$(inherited)` from `#include`ing xcconfigs. (See: https://github.com/toshi0383/xcconfig-extractor/pull/8#issuecomment-298234943) So if you have any existing xcconfig configured on your project, it might cause problems.
[This article](https://pewpewthespells.com/blog/xcconfig_guide.html#BuildSettingInheritance) is helpful to understand how inheritance works.
# agvtool compatibility
⚠️ ***Waring*** ⚠️
If you use `agvtool` for automatic versioning, it won't work after applying `xcconfig-extractor`.
`agvtool` updates versions correctly iff `INFOPLIST_FILE` is configured in Xcode's buildSettings section.
So make sure you either
- Restore `INFOPLIST_FILE` in Xcode's buildSettings section.
or
- Quit using `agvtool` and fallback to other tools like `/usr/libexec/PlistBuddy` to update Info.plist.
e.g.
```bash
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $(git describe --tags --abbrev=0)" App/Info.plist
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BITRISE_BUILD_NUMBER}-${BITRISE_GIT_BRANCH}" App/Info.plist
```
# Install
## [Mint](https://github.com/yonaskolb/Mint)
```
mint install toshi0383/xcconfig-extractor
```
## Build from source
- Clone this repo and run `swift build -c release`.
- Executable will be created at `.build/release/xcconfig-extractor`.
# Donate
If you think it's a useful tool, consider donation to maintain project.
[](https://www.patreon.com/bePatron?u=13627375)
# License
MIT