This is my code monorepo. I don't have a lot of code, but I want to have it
all in a single repository, so that I can reuse tooling. I also want to use
bazel
.
The idea is to have a single repository for all personal code I may write. Since
I am interested in organization of code and how we can do more with less effort, I
am tempted to think that a monorepo built with bazel
may be an answer to that.
I should be able to git clone
and build the source code after bootstrapping
the environment with the scripts within the repo. Nothing should be needed on
the system in addition to git
and potentially a compiler.
The structure of the monorepo is:
.
├── artifacts # artifacts that are built by the CI scripts, in .gitignore.
├── src # All source code.
├── target # Rust build dir, in .gitignore.
├── third_party # third_party dependencies
├── tools # scripts and tools to make life easier, should be in PATH.
...
- Clone the repo
- Install the build/env dependencies:
direnv
g++
- Run bootstrap:
$ direnv allow
$ bootstrap.sh
There is a list of known issues, that I would like to address before I deem this to be working perfectly:
-
rules_go
does not provide an IDE integration for generated files.gopls
works pretty well for source code and jumping to definition for standard library or dependencies used via go modules though. Tracked in bazelbuild/rules_go#512 -
cargo-raze
does not work well with the IDE. There have been a few improvements that may be used to make this better, but I have not made it to work yet. Related links:- google/cargo-raze#42
- https://fuchsia.dev/fuchsia-src/development/languages/rust/editors
- bazelbuild/rules_rust#71
- bazelbuild/rules_rust#384
It is possible to get autocompletion working if one symlinks //cargo/{target,Cargo.{toml,lock}} files to the library directory and moves the
.rs
files into asrc
subdir.