无法理解 xcode 构建参数:“${BUILD_DIR%Build/*}”
我正在集成 WireGuardKit,根据其自述文件,我需要创建一个用于构建wireguard-go-bridge 库的外部构建系统目标。
在外部构建系统目标的信息选项卡中。文档说我应该使用这个位置: ${BUILD_DIR%Build/*}SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
外部构建系统目标的构建失败。由于路径无法解析。 如果我使用正确的绝对路径更改路径,则构建将会成功。
谁能告诉我这个 ${BUILD_DIR%Build/*}
的含义是什么,看起来 firebase 也在使用这个神奇的变量,请参阅 Firebase Crashlytics | Swift 包管理器 (SPM) 运行脚本?
I'm integrating the WireGuardKit, according to its README file, I need to create an external build system target to build wireguard-go-bridge library.
In the external build system target's info tab. The documentation says I should use this location: ${BUILD_DIR%Build/*}SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
The build for the external build system target failed. As the path can't be resolved.
If I change the path with a correct, absolute path, the build will succeed.
Can anyone tell me what's the meaning of this ${BUILD_DIR%Build/*}
, looks firebase is also using this magic variable, see Firebase Crashlytics | Swift Package Manager (SPM) Run Script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一番谷歌搜索后,我明白了:
引用超级用户贡献者 Marek Rost 的帖子:
所以假设 ${BUILD_DIR} 是
什么 ${BUILD_DIR%Build/*} 的意思是从 ${BUILD_DIR} 后面删除最短出现的子字符串
Build/*
(星号是通配符)多变的。在这种情况下,Build/Products
将被删除。那么我们得到的结果是:由于该项目使用的所有 SPM 包都在
~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/
的子目录中检出,因此最终解析的路径应该be:至于为什么构建不成功,我认为是Xcode的bug。我已向苹果报告了一个错误。对于任何正在尝试构建的人。
使用以下作为解决方法:
更新:这是 Apple 关于此“问题”的回复
After some googling, I figured it out:
Quote SuperUser contributor Marek Rost's Post:
So suppose ${BUILD_DIR} is
What ${BUILD_DIR%Build/*} mean is delete the shortest occurrence of substring
Build/*
(the star sign is a wildcard) from the back of ${BUILD_DIR} variable. In this case, theBuild/Products
will be removed. then we have the result:So since all the SPM packages used by this project checks out at a child directory at
~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/
, the final resolved path should be:As for why the build is not succeed, I think it's a Xcode bug. I have reported a bug to apple. For anyone who is trying to build.
Use below as a workaround:
Update: Here is the response from Apple regarding to this 'issue'
有同样的问题,这篇文章解决了它
Had the same issue, this article solved it