/bazel-demo

A bazel demo.

Primary LanguageStarlarkApache License 2.0Apache-2.0

Bazel Container

Getting started with Bazel.

1, A google account

You need a google account!

2, Install Command line tool which contains gcloud

Install Google Cloud SDK from Google.

3, Pull image from Google Cloud Marketplace.

gcloud auth configure-docker && docker pull l.gcr.io/google/bazel:latest

Build monorepo with Bazel Container

Generate BUILD.bazel for every Golang Package

Scans sources files, then generates and updates build files.

./gazelle.sh

Import repositories

Import repositories from go.mod.

./gazelle-update-repos.sh

Build

./build.sh

Conclusion

Bazel 设计**跟 cmake 差不多,用下来的整体感觉就是非常蠢,现代构建工具应该通过分析源码自动识别出包以及包的依赖关系,而不是让用户去背诵一堆屎一样的规则然后侵入每个包手写(或者用工具生成) BUILD 文件。