X $ C $ 4:可靠地检测项目/工作区的DerivedData目录 [英] xcode4: reliably detect the DerivedData directory of a project/workspace
问题描述
X $ C $的C 4建立万事成 $ HOME /库/开发/ X code / DerivedData / $项目 - $ UUID
,其中 $ UUID
是一个看似随机字符串(它不是真正随机的,它只是看起来是随机的)。
Xcode 4 builds everything into $HOME/Library/Developer/Xcode/DerivedData/$PROJECT-$UUID
, where $UUID
is a seemingly random string (it's not really random, it just looks random).
我如何可靠地检测上述的 $项目 - $ UUID
部分?我见过一个脚本( https://gist.github.com/949831 ),通过假设猜测它是在DerivedData最后修改目录 - 但如果我的CI机器处于平行建设的几个项目,这不是事实。
How can I reliably detect the $PROJECT-$UUID
part of the above? I've seen a script (https://gist.github.com/949831) that guesses by assuming it is the last modified directory in DerivedData -- but that's not true if my CI machine is building a few projects in parallel.
推荐答案
没有人回答,所以我一直在寻找的想法,直到我发现下面的一个,这满足了我的需求。它可以进一步修饰为更安全
Nobody answered, so I kept looking for ideas until I found the one below, which satisfies my needs. It can be further modified to be even safer.
- 在X code,增加一个运行脚本生成阶段目标(主要目标,在构建同一项目数)。
- 在脚本中,把这个行:
LN -sf$ BUILD_DIRBuildDir
现在,当目标是建立一个符号链接到项目的DerivedData目录将在项目目录中创建。
如果需要,还可以/而是创建BuildDir作为一个文件谁的内容是$ BUILD_DIR:
Now, when the target is built a symlink to the project's DerivedData directory will be created in the project directory. If desirable, you can also/instead create BuildDir as a file who's content is the $BUILD_DIR:
回声$ BUILD_DIR> BuildDir
然后在脚本中使用 $(猫BuildDir)
进行检索。
Then in a script use $(cat BuildDir)
to retrieve it.
这篇关于X $ C $ 4:可靠地检测项目/工作区的DerivedData目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!