You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ImplementationReadme.md
+14-3
Original file line number
Diff line number
Diff line change
@@ -12,14 +12,25 @@ Hello, and thanks for your interest in the codebase :)
12
12
13
13
We'd recommend setting up for rapid iteration as follows:
14
14
15
-
Get a local copy. (e.g. `git clone git@github.com:hedronvision/bazel-compile-commands-extractor.git`)
15
+
Get a local copy. (e.g. `git clone https://github.com/hedronvision/bazel-compile-commands-extractor`, though you probably want to make a fork and clone that so you can easily contribute back.)
16
16
17
-
Then point your main repo (from which you're seeing issues) to use your local development copy of the compile commands. To do that, open `WORKSPACE`, and swap out the `http_archive` loading `hedron_compile_commands` with the following.
17
+
Then point your main repo (from which you're seeing issues) to use your local development copy of the compile commands by doing the following.
18
+
19
+
If you're bringing in this tool via your `MODULE.bazel` file, swap out the `git_override` loading `hedron_compile_commands` with the following.
20
+
```Starlark
21
+
local_path_override(
22
+
module_name="hedron_compile_commands",
23
+
path="../bazel-compile-commands-extractor"# Assuming this tool is cloned next to your project's repo
24
+
)
25
+
``````
26
+
27
+
28
+
If you're bringing in this tool via your `WORKSPACE` file, swap out the `http_archive` loading `hedron_compile_commands` with the following.
18
29
19
30
```Starlark
20
31
local_repository(
21
32
name="hedron_compile_commands",
22
-
path="../bazel-compile-commands-extractor", #Or wherever you put it.
33
+
path="../bazel-compile-commands-extractor", #Assuming this tool is cloned next to your project's repo
Copy file name to clipboardExpand all lines: README.md
+23-21
Original file line number
Diff line number
Diff line change
@@ -42,9 +42,27 @@ Howdy, Bazel user 🤠. Let's get you set up fast with some awesome tooling for
42
42
43
43
There's a bunch of text here but only because we're trying to spell things out and make them easy. If you have issues, let us know; we'd love your help making things even better and more complete—and we'd love to help you!
44
44
45
-
### If you're using the WORKSPACE system (you probably are), do the usual WORKSPACE setup:
45
+
### First, add this tool to your Bazel setup.
46
46
47
-
Copy this into your Bazel `WORKSPACE` file to add this repo as an external dependency, making sure to update to the [latest commit](https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main) per the instructions below.
47
+
#### If you have a MODULE.bazel file and are using the new [bzlmod](https://bazel.build/external/migration) system
48
+
Copy this into your `MODULE.bazel`, making sure to update to the [latest commit](https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main) per the instructions below.
# Replace the commit hash (above) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main); the stale one here is too old to work with bzlmod.
59
+
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
60
+
)
61
+
```
62
+
63
+
#### If you're using the traditional WORKSPACE system
64
+
65
+
Copy this into your Bazel `WORKSPACE` file, making sure to update to the [latest commit](https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main) per the instructions below.
# Replace the commit hash in both places (below) with the latest, rather than using the stale one here.
76
+
# Replace the commit hash (ed994039a951b736091776d677f324b3903ef939) in both places (below) with the latest (https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main), rather than using the stale one here.
59
77
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
### If you're using Bazel's new [bzlmod](https://bazel.build/external/migration) system:
69
-
You're probably using bzlmod if you have `common --enable_bzlmod` in your `.bazelrc` (or are using Bazel v7+). If so, copy this into your Bazel `MODULE.bazel` file to add this repo as an external dependency, making sure to update to the [latest commit](https://github.com/hedronvision/bazel-compile-commands-extractor/commits/main) per the instructions below.
# Replace the commit hash (above) with the latest, the stale one here is too old to work with bzlmod.
78
-
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
79
-
)
80
-
```
81
-
82
-
#### Suggestion: Updates
86
+
#### Either way: Get Updates via Renovate
83
87
84
88
Improvements come frequently, so we'd recommend keeping up-to-date.
85
89
86
90
We'd strongly recommend you set up [Renovate](https://github.com/renovatebot/renovate) (or similar) at some point to keep this dependency (and others) up-to-date by default. [We aren't affiliated with Renovate or anything, but we think it's awesome. It watches for new versions and sends you PRs for review or automated testing. It's free and easy to set up. It's been astoundingly useful in our codebase, and we've worked with the wonderful maintainer to make things great for Bazel use. And it's used in official Bazel repositories.] Here's a [Renovate configuration example from one of our projects](https://github.com/hedronvision/bazel-cc-filesystem-backport/blob/main/renovate.json5), in the hope that it might save you time.
87
91
88
92
If not now, maybe come back to this step later, or watch this repo for updates. [Or hey, maybe give us a quick star, while you're thinking about watching.] Like Abseil, we live at head; the latest commit to the main branch is the commit you want. So don't rely on release notifications; use [Renovate](https://github.com/renovatebot/renovate) or poll manually for new commits.
89
93
90
-
### Get the extractor running.
94
+
### Second, get the extractor running.
91
95
92
96
We'll generate a `compile_commands.json` file in the root of the Bazel workspace.
93
97
@@ -236,8 +240,6 @@ If you're using Bazel for the C language family, you'll likely also want some of
236
240
1. A good way of making secure network requests: [hedronvision/bazel-make-cc-https-easy](https://github.com/hedronvision/bazel-make-cc-https-easy)
237
241
2. A way to use std::filesystem across platforms: [hedronvision/bazel-cc-filesystem-backport](https://github.com/hedronvision/bazel-cc-filesystem-backport)
238
242
239
-
If so, please check out our other project, [hedronvision/bazel-make-cc-https-easy](https://github.com/hedronvision/bazel-make-cc-https-easy).
240
-
241
243
---
242
244
*Looking for implementation details instead? Want to dive into the codebase?*
243
245
See [ImplementationReadme.md](./ImplementationReadme.md).
hedron_compile_commands_extension=module_extension(# Note: Doesn't break loading from WORKSPACE as far back as Bazel 5.0.0
16
24
implementation=hedron_compile_commands_setup,
17
-
# This extension is loaded when using bzlmod (MODULE.bazel) and will run the same function as WORKSPACE,
18
-
# but passes in a module_ctx object for advanced context of the whole project, allowing for complex, project wide modifiying extensions
19
-
# It's not currently used but is always passed in. ctx is defaulted to None for compatibility with workspace setup.
25
+
# This extension is automatically loaded when using bzlmod (from MODULE.bazel) and will run the same function as WORKSPACE,
26
+
# but passes in a module_ctx object for advanced context of the whole project, allowing for complex, project wide modifiying extensions and distinguishing between WORKSPACE and bzlmod setups.
0 commit comments