A mono repo for everything you need to build a galaxy with bazel, while pulling critical libraries in the form of source code part of the source tree.
- Using this repo requires gclient from depot_tools. Please follow the installation guide to get started.
- Create an empty directory and switch to it.
- run
gclient config https://github.com/bazelment/galaxy
to initialize the config of gclient. - run
gclient sync
to check out everything.
-
Update
DEPS
file to include the SCM link of the given library, and a directory where the library should be included in the source tree. The general rule is most third party libraries should be under third_party.- A optional commit hash/version tag/branch name can be included in the SCM link to pin the version of the library.
-
Update the bazel
WORKSPACE
file to include the given library.
- If the given library has bazel
WORKSPACE
file in its directory already, just uselocal_repository
to include it. - If the given library doesn't have bazel
BUILD
file orWORKSPACE
file. There are two ways to add bazel BUILD support.- Put its source code inside
third_party/foo/src
, and create bazel BUILD file inthird_party/foo/BUILD
. Then they can be built withbazel build third_party/foo/...
- Put its source inside
third_party/foo
', and create athird_party/foo.BUILD
BUILD file, updateWORKSPACE
file to usenew_local_repository
rule to create another repo, with something like:new_local_repository( name = "com_github_cares_cares", path = "third_party/c-ares", build_file = "@com_github_grpc_grpc//third_party:cares/cares.BUILD", )
- Put its source code inside
For some other languages like Java, when there is not significant benefit of building from source, and the upstream doesn't change frequently, it might be preferred to just pull in prebuilt artifacts from maven. The following section talks about how to pull in maven dependencies.