如何从命令行设置Xcode的自定义路径?

4
在Xcode中,位置下的首选项允许手动设置自定义路径。我想从命令行读取和写入这些值。我没有看到xcodebuild中有这样做的选项。
如何完成?

Custom Paths

通过设置自定义路径,我可以将它们用于相对路径,这非常有帮助。
1个回答

1
这可以通过使用defaults命令更新Xcode的NSUserDefaults来完成。

https://gist.github.com/brennanMKE/7d9f190859a0f15fdc32c0811bf24386

# Note: Xcode shows these values in Settings -> Locations -> Custom Paths
# Xcode does not hot reload these values so you must restart Xcode to get the changes.

# Define a dictionary entry for LUMBERJACK_DIR with a display name
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict-add LUMBERJACK_DIR "\$LUMBERJACK_DIR"
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 1.0"

# Change the display name
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add LUMBERJACK_DIR "Lumberjack 2.0"

# View the values which match this key
defaults read com.apple.dt.Xcode IDEApplicationwideBuildSettings | grep LUMBERJACK_DIR
defaults read com.apple.dt.Xcode IDESourceTreeDisplayNames | grep LUMBERJACK_DIR

# Your Xcode project can define the $LUMBERJACK_DIR value in an .xcconfig variable.
# Be sure to add your .xcconfig to your project configuration for your current build configuration.

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接