从终端设置xcode"build setting"?

niz*_*zle 8 xcode xcodebuild xcrun

无论如何我可以在不打开xcode的情况下更改xcode中的设置吗?我有一个自动xcodebuild/xcrun进程,但我需要更改1值:

目标>选择目标>构建设置>代码签名资源规则路径添加:$(SDKROOT)/ResourceRules.plist

我找不到任何文件,我可能会把这行...

Opa*_*pal 12

你能做的就是跑:

xcodebuild -target <target> -configuration <configuration> -showBuildSettings
Run Code Online (Sandbox Code Playgroud)

此命令显示为传递的目标配置填充的所有设置.找到包含的密钥的名称$(SDKROOT)/ResourceRules.plist(让我们称之为THE_KEY),然后尝试:

xcodebuild -target <target> -configuration <configuration> THE_KEY=<new_value>
Run Code Online (Sandbox Code Playgroud)

不保证它会起作用.


Hus*_*ion 5

你可以试试pbxproj。这是一个 Python 模块,可帮助您使用命令行操作 XCode 项目。

与您的问题相关的部分可能是https://github.com/kronenthaler/mod-pbxproj/wiki/flags#add-code-sign

你可以pip install pbxproj拥有它。

这是官方存储库中提供的示例:

from pbxproj import XcodeProject
# open the project
project = XcodeProject.load('myapp.xcodeproj/project.pbxproj')

# add a file to it, force=false to not add it if it's already in the project
project.add_file('MyClass.swift', force=False)

# set a Other Linker Flags
project.add_other_ldflags('-ObjC')

# save the project, otherwise your changes won't be picked up by Xcode
project.save()
Run Code Online (Sandbox Code Playgroud)