xcconfig-extractor

0.5.0

Refactor BuildSettings into xcconfigs
toshi0383/xcconfig-extractor

What's New

0.5.0

2018-12-30T04:19:25Z

xcconfig-extractor

Refactor buildSettings into xcconfigs.

Build Status patreon

Requirements

  • Xcode10+ is officially supported, but should work against older ones too.

Usage

$ 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. ✏️

xcode's general tab

Available Options

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.

$ 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 #includeing xcconfigs. (See: #8 (comment)) So if you have any existing xcconfig configured on your project, it might cause problems. This article 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.

/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

Binary install

I've written install/release scripts for SwiftPM executable.
This should be the easiest way.

bash <(curl -sL https://raw.githubusercontent.com/toshi0383/scripts/master/swiftpm/install.sh) toshi0383/xcconfig-extractor

Or go to the release page and download xcconfig-extractor.zip go download the standalone binary manually.

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.

patreon

License

MIT

Description

  • Swift Tools 4.2.0
View More Packages from this Author

Dependencies

Last updated: Thu Oct 17 2024 23:13:07 GMT-0900 (Hawaii-Aleutian Daylight Time)