是否可以通过脚本/命令行从Xcodeproj中删除构建配置和方案,而无需编辑(project.pbxproj)(project.pbxproj)(project.pbxproj),希望它不会交叉验证并影响验证构建。
我尝试了xcodeproj
,可以让您阅读并表示PRJ为yaml,我想要一个可以编辑yaml并从中生成xcodeproj的地方。
我也尝试删除xcshareddata
表格的方案仍然没有提高性能。
shell> xcodebuild -project myproject.xcodeproj -list
# output
Information about project "myproject":
Targets:
myproject
myprojectTests
ScreensForManPages
UITestsCA
....
....
UITestsUS
Build Configurations:
ae-debug
ae-debug-another-condition
ae-release
ae-release-another-condition
...
...
250+ build config in between
...
...
zw-debug
zw-debug-another-condition
zw-release
zw-release-another-condition
If no build configuration is specified and -scheme is not passed then "ae-release-another-condition" is used.
Schemes:
myproject-ae-debug
myproject-ae-debug-another-condition
myproject-ae-release
...
...
250+ schemes in between
...
...
myproject-zw-debug
myproject-zw-debug-another-condition
myproject-zw-release
myproject-zw-release-another-condition
原因:
我最近继承了一个有250多个构建配置和250多个方案的项目。不幸的是,我的工作机是很好的旧MBP,HDD运行OSX Mojave具有Xcode 10无法打开该项目。(.xcodeproj文件约为10MB)
我可以打开proj,但是每次点击彩虹轮都需要超过10分钟的时间来列出目标,而且我不知道Xcode中的选项一次都可以一次删除多个配置/方案。
P.S:
Apple脚本解决方案没有帮助的Xcode不会及时响应
在开始
之前
Xcode
需要完全关闭。- 如果您要手动编辑
Xcode
Project 绝对 在尝试此事之前进行备份!
方案:
删除您不需要的方案文件:
/MyApp/MyApp.xcodeproj/xcshareddata/xcschemes
编辑管理PLIST :
/MyApp/MyApp.xcodeproj/xcuserdata/Username.xcuserdatad/xcschemes/xcschememanagement.plist
在文件中删除您不需要的方案(例如MyApp Custom
):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
///////////////////////////////////////////////// remove start
<key>MyApp Custom.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
///////////////////////////////////////////////// remove end
<key>MyApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>AFDACD5A2209867B00004213</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
构建配置:
/MyApp/SomeProgram.xcodeproj/project.pbxproj
我不建议您手动编辑此文件,而是通过Xcode
删除构建配置,但是,如果您在文件中勇敢,则会看到配置。您还可以使用PLIST编辑器(PlistBuddy等)编辑此文件 - 删除您不需要的文件:
AFADF25C22269ABE000D354D = {
buildSettings = {
...
};
isa = XCBuildConfiguration;
name = Custom;
};
您还将看到与其他配置分组的相应UID
:
AFDACD542209865600004213 = {
buildConfigurations = (
AFDACD552209865600004213,
AFDACD562209865600004213,
AFADF25C22269ABE000D354D ////// remove
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
isa = XCConfigurationList;
};
现在打开.xcodeproj
时,应反映更改。