From 6715080ebc1769eb9d098fef543fb2a384fbcd00 Mon Sep 17 00:00:00 2001 From: radex Date: Sat, 5 Aug 2023 20:29:55 +0200 Subject: [PATCH] doc/codelabs: stub of bazel-go.md Change-Id: Icf408f9edddfb5e446b2675485c6f9e17ff7357a Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1564 Reviewed-by: q3k --- doc/codelabs/getting-started/bazel-go.md | 35 +++++++++++++++++++ doc/codelabs/getting-started/checking-out.md | 4 +-- .../getting-started/your-first-change.md | 2 +- doc/codelabs/index.md | 1 + hswaw/laserproxy/README.md | 11 ------ 5 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 doc/codelabs/getting-started/bazel-go.md diff --git a/doc/codelabs/getting-started/bazel-go.md b/doc/codelabs/getting-started/bazel-go.md new file mode 100644 index 00000000..2ee8085f --- /dev/null +++ b/doc/codelabs/getting-started/bazel-go.md @@ -0,0 +1,35 @@ +Bazel & Go basics +================= + +_sad-trombone.wav_ + +TODO: This guide has not really been written yet. But here's a few bits and pieces you might find helpful to get started if you're not familiar with Bazel (until the full guide is written). + +[TOC] + +Installing Bazel on macOS +------------------------- + + $ brew install bazelisk ibazel + +You want to have `bazelisk` installed instead of `bazel` so that the correct version of Bazel is used instead of the latest one. + +Bazel basics +------------ + + $ bazel run //hswaw/site + $ bazel run //hswaw/laserproxy + +This builds and runs project at specified [depot paths](checking-out.md). + +You can pass flags to build product after `--`, like so: + + $ bazel run //hswaw/site -- -hspki_disable + +BTW: `-hspki_disable` is a common flag to use to run a project locally without HTTPS setup. + +By convention, most projects will show you available flags like so: + + $ bazel run //hswaw/laserproxy -- -h + +For some projects, you might want interactive development, where rebuild happens automatically on any change to the project. In this case, replace `bazel run` with `ibazel run`. diff --git a/doc/codelabs/getting-started/checking-out.md b/doc/codelabs/getting-started/checking-out.md index 1e3a8c6d..8b9d829e 100644 --- a/doc/codelabs/getting-started/checking-out.md +++ b/doc/codelabs/getting-started/checking-out.md @@ -62,7 +62,7 @@ What's up with `//these/paths`? These paths, sometimes called *depot paths*, are a convention to refer to paths within hscloud. For example, `//foo/bar` means a file or directory named `bar` within a directory named `foo` in the root of the hscloud repository. -These paths are notably used by Bazel, our build system, which extends the syntax slightly: `//foo/bar:baz` means a file or *build target* named baz within a directory bar within a diredctory foo inside hscloud. +These paths are notably used by Bazel, our build system, which extends the syntax slightly: `//foo/bar:baz` means a file or *build target* named baz within a directory bar within a directory foo inside hscloud. What are changes? ----------------- @@ -106,5 +106,5 @@ Further steps Now that you have a local hscloud checkout and mostly know why it exists and how it's laid out, there's a few next steps you can take: - [Your first hscloud Change](your-first-change.md) will guide you through using Gerrit to send your first contribution to hscloud - a small file change in your personal directory. - - **TODO** will guide you through building some code using Bazel, and then writing a tiny bit of Go code of your own. + - [Bazel & Go basics](bazel-go.md) will (TODO) guide you through building some code using Bazel, and then writing a tiny bit of Go code of your own. - **TODO** will guide you through accessing our production Kubernetes cluster and running some code on it. diff --git a/doc/codelabs/getting-started/your-first-change.md b/doc/codelabs/getting-started/your-first-change.md index d0b6fadf..5bde6a22 100644 --- a/doc/codelabs/getting-started/your-first-change.md +++ b/doc/codelabs/getting-started/your-first-change.md @@ -188,6 +188,6 @@ Further steps ------------- - If you need a **Git refresher** - we highly recommend the [Git Visual Reference](https://marklodato.github.io/visual-git-guide/index-en.html) - - **TODO** will guide you through building some code using Bazel, and then writing a tiny bit of Go code of your own. + - [Bazel & Go basics](bazel-go.md) will (TODO) guide you through building some code using Bazel, and then writing a tiny bit of Go code of your own. - **TODO** will guide you through accessing our production Kubernetes cluster and running some code on it. diff --git a/doc/codelabs/index.md b/doc/codelabs/index.md index 1d6dea5e..70f1af2b 100644 --- a/doc/codelabs/index.md +++ b/doc/codelabs/index.md @@ -10,3 +10,4 @@ Getting started - [**Checking out hscloud**](getting-started/checking-out.md) - how to get a copy of hscloud, how to navigate around it, and what's what. This is nearly **mandatory** for anyone who wishes to interact with hscloud. - [**Your First Change**](getting-started/your-first-change.md) - how to use Gerrit and git to send your first change to hscloud, and an intro to personal directories. Using Gerrit can be somewhat confusing even (or especially) if you're used to Gitflow or GitHub. +- [**Bazel & Go basics**](getting-started/bazel-go.md) - will (TODO) guide you through building some code using Bazel, and then writing a tiny bit of Go code of your own. diff --git a/hswaw/laserproxy/README.md b/hswaw/laserproxy/README.md index 0743a082..d9e4a95a 100644 --- a/hswaw/laserproxy/README.md +++ b/hswaw/laserproxy/README.md @@ -23,17 +23,6 @@ Something similar to this should work for you locally enough to open the web app bazel run //hswaw/laserproxy -- -hspki_disable -laser_network 127.0.0.1 -client_network 127.0.0.1 -This will show you available flags you can pass: - - bazel run //hswaw/laserproxy -- -h - -If you've never used `bazel`, this should work for y'all macOS newbs: - - brew install bazel - brew install postgresql - -_TODO(q3k): move this to the bazel codelab once it's finished_ - Deployment ----------