AOSP没有工具/供应商/ Google3项目

时间:2018-06-20 10:36:46

标签: android-studio bazel

当我使用“ build Android Studio”命令从源代码中bazel build //tools/adt/idea/...时,总是无法找到“工具/供应商/谷歌3”模块,谷歌不是没有开源项目吗?

zhangyang@zhangyang-OptiPlex-7040:~/aosp/gradle_3.1.2$ bazel build //tools/adt/idea/...
WARNING: ignoring http_proxy in environment.
Starting local Bazel server and connecting to it...
..............................
ERROR: error loading package '': Encountered error while reading extension file 'binds.bzl': no such package '@blaze//': /home/zhangyang/.cache/bazel/_bazel_zhangyang/e54d4cb13781c1d72b64dc99700261fe/external/blaze must be an existing directory
ERROR: error loading package '': Encountered error while reading extension file 'binds.bzl': no such package '@blaze//': /home/zhangyang/.cache/bazel/_bazel_zhangyang/e54d4cb13781c1d72b64dc99700261fe/external/blaze must be an existing directory
INFO: Elapsed time: 0.621s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

bazel工作空间:     load(“ // tools / base / bazel:repositories.bzl”,“ setup_external_repositories”)     setup_external_repositories()

local_repository(
     name = "blaze",
     path = "tools/vendor/google3/blaze",
)
load("@blaze//:binds.bzl", "blaze_binds")
blaze_binds()

http_archive(
 name = "bazel_toolchains",
 urls = [
  "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/b49ba3689f46ac50e9277dafd8ff32b26951f82e.tar.gz",
 "https://github.com/bazelbuild/bazel-toolchains/archive/b49ba3689f46ac50e9277dafd8ff32b26951f82e.tar.gz",
 ],
 strip_prefix = "bazel-toolchains-b49ba3689f46ac50e9277dafd8ff32b26951f82e",
 sha256 = "1266f1e27b4363c83222f1a776397c7a069fbfd6aacc9559afa61cdd73e1b429",
)

但是Aosp没有工具/供应商/ google3项目

2 个答案:

答案 0 :(得分:0)

TL; DR:

  • Bazel版本在AOSP中被破坏
  • 改为使用<studio-master-dev>/tools/idea/build_studio.sh
  • 或者,如果您只想在tools/base内构建子模块,只需运行gradle build。您可能必须从gradle.build中删除一些无效的依赖关系,但这并不难解决。

长版:

我遇到了相同的错误消息,并查看了external目录:

ls -lah ~/.cache/bazel/_bazel_xxx/89112fe8516b5fa5b01df0651312df31/external/
total 16K
drwxrwxr-x 2 xxx xxx 4.0K Dec 12 14:04 .
drwxrwxr-x 7 xxx xxx 4.0K Dec 12 14:04 ..
-rw-rw-r-- 1 xxx xxx   33 Dec 12 14:04 @bazel_tools.marker
lrwxrwxrwx 1 xxx xxx  110 Dec 12 14:04 bazel_tools -> /home/xxx/.cache/bazel/_bazel_xxx/install/35f799b1c96ee2522d30a28ff4ef485a/_embedded_binaries/embedded_tools
lrwxrwxrwx 1 xxx xxx   55 Dec 12 14:04 blaze -> /home/xxx/studio-master-dev/tools/vendor/google3/blaze

/tools/vendor/google3/blaze实际上是缺少的。快速的Google搜索显示,“火焰”是bazel的内部版本,仅在Google内部使用。

Android Studio的问题跟踪器中的

A thread还确认AOSP中的bazel构建已被破坏,并且studio-master-dev分支中的构建指令的一些额外提示都已过时(哎呀)。在撰写本文时,该问题仍然存在,因此,如果您要构建Android Studio(或相关工具),则可能需要查看那里的最新讨论。

答案 1 :(得分:0)

从 tools/base/bazel/toplevel.WORKSPACE 中删除对 tools/vendor/google 的所有引用:

https://android.googlesource.com/platform/tools/idea/+/refs/heads/studio-master-dev/RELEASE.md