本文是对于bazel使用的一个学习小册子。
转帖请注明出处~
官网
http://www.bazel.io/
安装步骤
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install bazel
主要包含WORLDSPACE和BUILD文件的语法
一、 BUILD文件的语法
cc_library() cc_binary() cc_proto_library()case1: (看个样子)
cc_library(
name = "hello-greet",
srcs = ["hello-greet.cc"],
hdrs = ["hello-greet.h"],
)
cc_binary(
name = "hello-world",
srcs = ["hello-world.cc"],
deps = [
":hello-greet",
],
)
case2:(关于proto)
cc_library(
name = "lib",
deps = [":foo_cc_proto"],
)
cc_proto_library(
name = "foo_cc_proto",
deps = [":foo_proto"],
)
proto_library(
name = "foo_proto",
srcs = ["address.proto"],
deps = [":zip_code_proto"]
)
srcs 源文件