cocopods与Bazel安装颤抖时的错误
我正在尝试使用bazel和flutter构建ipa
文件,然后我有以下构建文件:
genrule(
name = "flutter_build_ios",
srcs = glob(["ios/**","lib/**","assets/**", "pubspec.yaml"]),
outs = ["mobile.ipa"],
cmd_bash = "flutter build ipa --export-options-plist ios/Runner/ExportOptions.plist --obfuscate --split-debug-info=build/app/outputs/symbols && cp build/ios/ipa/mobile.ipa $@ && cp build/app/outputs/symbols $(@D)",
tags = ["local"]
)
当我尝试执行bazel命令:@bazel build //:flutter_build_ios- verbose_failures
我有错误:
(Could not create '/var/root/.cocoapods/repos', the CocoaPods repo cache directory.
Errno::EACCES: Permission denied @ dir_s_mkdir - /var/root/.cocoapods)
You can try adding it manually in `/var/root/.cocoapods/repos` or via `pod repo add`.
我不知道为什么巴泽尔试图使用/var/root
而不是〜/library/caches/caches/cocoapods/
。我尝试在终端中执行相同的命令,而无需Bazel:flutter build ipa -export-options-plist ios/runner/exportoptions.plist-obfuscate-obfuscate -split-debug-info = build/app/app/outputs/outputs/outputs/outputs/outputs/outputs/outputs/outputs/outputs/outputs/outputs/utputs/符号
,一切正常。
我想我错过了巴泽尔如何在引擎盖下工作的东西。
解决方案: 执行CMD
命令( https:https: //bazel.build/reference/be/general#genrule-environment ),并且由于cocopods
依靠某些环境变量,我需要设置以下export cp_home_dir = /tmp/cocoapods-repo
执行任何内容。
I'm trying to build an ipa
file using bazel and flutter, then I have the following BUILD file:
genrule(
name = "flutter_build_ios",
srcs = glob(["ios/**","lib/**","assets/**", "pubspec.yaml"]),
outs = ["mobile.ipa"],
cmd_bash = "flutter build ipa --export-options-plist ios/Runner/ExportOptions.plist --obfuscate --split-debug-info=build/app/outputs/symbols && cp build/ios/ipa/mobile.ipa $@ && cp build/app/outputs/symbols $(@D)",
tags = ["local"]
)
When I try to execute the bazel command: @bazel build //:flutter_build_ios --verbose_failures
I got error:
(Could not create '/var/root/.cocoapods/repos', the CocoaPods repo cache directory.
Errno::EACCES: Permission denied @ dir_s_mkdir - /var/root/.cocoapods)
You can try adding it manually in `/var/root/.cocoapods/repos` or via `pod repo add`.
I don't know why bazel is trying to use /var/root
instead of ~/Library/Caches/CocoaPods/
. I tried execute the same command in my terminal, without bazel: flutter build ipa --export-options-plist ios/Runner/ExportOptions.plist --obfuscate --split-debug-info=build/app/outputs/symbols
and everything works fine.
I think I'm missing something about how bazel works under the hood.
Solution:
Genrule keeps only basic environment variables when executing cmd
commands (https://bazel.build/reference/be/general#genrule-environment), and since cocopods
rely on some environment variables, I have needed to set the following export CP_HOME_DIR=/tmp/cocoapods-repo
before execute anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论