blob: a485922654802fca7a10a3e63a0941820a8868f0 [file] [log] [blame] [view]
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +02001# Nexantic monorepo
Leopold Schabel67f9d092019-10-22 15:41:42 +02002
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +02003This is the monorepo storing all of nexantic's internal projects and libraries.
Leopold Schabel67f9d092019-10-22 15:41:42 +02004
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +02005## Environment
Leopold Schabel5c80aca2019-10-22 15:48:58 +02006
Leopold Schabeldb6283e2020-01-06 17:05:54 +01007We assume a Fedora host system provisioned using rW, and IntelliJ as the IDE.
Leopold Schabel67f9d092019-10-22 15:41:42 +02008
Leopold Schabel8b9c0552019-11-15 14:07:45 +01009For better reproducibility, all builds are executed in containers.
Leopold Schabel67f9d092019-10-22 15:41:42 +020010
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020011#### Usage
Leopold Schabel5c80aca2019-10-22 15:48:58 +020012
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020013Spinning up: `scripts/create_container.sh`
Leopold Schabel5c80aca2019-10-22 15:48:58 +020014
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020015Spinning down: `scripts/destroy_container.sh`
16
Leopold Schabel8b9c0552019-11-15 14:07:45 +010017Running commands: `scripts/run_in_container.sh <...>`
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020018
Leopold Schabel8b9c0552019-11-15 14:07:45 +010019Using bazel using a wrapper script: `scripts/bin/bazel <...>` (add to your local $PATH for convenience)
Leopold Schabel2ab141d2020-01-07 20:50:07 +010020
21#### Creating local symlinks for generated Go code
22
23Unfortunately, the Go tooling does not yet know about Bazel, so we need to copy generated code to
24the source tree such that native Go modules work.
25
26This creates a fake GOPATH and symlinks for generated packages:
27
28 scripts/symlink_generated_files.sh
29 bazel build :gopath
30
31Any top-level Go targets that use generated code have to be dependencies of the :gopath target.
32
33See https://phab.monogon.dev/D305 for details.
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020034
Leopold Schabel8b9c0552019-11-15 14:07:45 +010035#### IntelliJ
36
37This repository is compatible with the IntelliJ Bazel plugin. All commands run inside the container, and
38necessary paths are mapped into the container.
39
40We check the entire .ijwb project directory into the repository, which requires everyone to use the latest
41version of both IntelliJ and the Bazel plugin, but eliminates manual setup steps.
42
43The following steps are necessary:
44
45- Install Google's official Bazel plugin in IntelliJ.
46
47- Add the absolute path to your ~/.cache/bazel-nxt folder to your idea64.vmoptions (Help Edit Custom VM Options)
48 and restart IntelliJ:
49
50 `-Dbazel.bep.path=/home/leopold/.cache/bazel-nxt`
51
52- Set "*Bazel Binary Location*" in Other Settings Bazel Settings to the absolute path of scripts/bin/bazel.
53 This is a wrapper that will execute Bazel inside the container.
54
55- Open the `.ijwb` folder as IntelliJ project.
56
57- Disable Vgo support for the project.
58
59- Run a non-incremental sync in IntelliJ
60
61The plugin will automatically resolve paths for generated files.
62
63If you do not use IntelliJ, you need to use the scripts/bazel_copy_generated_for_ide.sh script to copy files locally.