将 buildSettings 重构为 xcconfig 文件。
$ xcconfig-extractor /path/to/Your.xcodeproj Configurations
这将在 Configuration
目录下创建 xcconfig 文件。 配置将从 pbxproj 的 buildSettings
部分中删除。
生成的 xcconfig 文件会自动添加到您的项目中。 ✏️
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.
xcconfig-extractor
是一个重构工具。 它不应影响您的 App 实际的 "Build Setting"。
检查构建设置的推荐方法是使用 xcodebuild
命令。 确保在前后之间输出没有变化。
$ xcodebuild -showBuildSettings -configuration Release > before
$ # apply xcconfig-extractor
$ xcodebuild -showBuildSettings -configuration Release > after
$ diff before after # should prints nothing!
如果输出不同,请手动修复它,例如,只需将缺少的值添加到目标的 xcconfig 文件中。
xcconfig 不允许从 #include
的 xcconfig 中继承任何 $(inherited)
。(参见:#8 (comment)) 因此,如果您在项目中配置了任何现有的 xcconfig 文件,则可能会导致问题。这篇文章有助于理解继承是如何工作的。
如果您使用 agvtool
进行自动版本控制,则在应用 xcconfig-extractor
后将无法使用它。
只有在 Xcode 的 buildSettings 部分配置了 INFOPLIST_FILE
时,agvtool
才能正确更新版本。
所以请确保您
INFOPLIST_FILE
。或者
agvtool
并回退到其他工具,如 /usr/libexec/PlistBuddy
来更新 Info.plist。例如:
/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
mint install toshi0383/xcconfig-extractor
swift build -c release
。.build/release/xcconfig-extractor
中创建。如果您认为这是一个有用的工具,请考虑捐赠以维护项目。
MIT