|  | 
|  | 1 | +# Glint Bazel Toolchain - Summary | 
|  | 2 | + | 
|  | 3 | +## What was implemented: | 
|  | 4 | + | 
|  | 5 | +1. **Added rules_rust to versions.bzl** | 
|  | 6 | +   - Added rules_rust dependency (v0.58.0) | 
|  | 7 | +   - Added placeholders for glint binary SHA256 hashes (to be updated after first release) | 
|  | 8 | +   - Added VERSION_GLINT constant | 
|  | 9 | + | 
|  | 10 | +2. **Created glint toolchain structure** (`/bazel/toolchains/glint/`) | 
|  | 11 | +   - `glint_toolchain.bzl`: Toolchain definition with GlintInfo provider | 
|  | 12 | +   - `BUILD`: Toolchain targets (hermetic and preinstalled) | 
|  | 13 | +   - `current_toolchain.bzl`: Helper rule for depending on current toolchain | 
|  | 14 | +   - `README.md`: Documentation | 
|  | 15 | +   - `test/BUILD`: Test to verify toolchain works | 
|  | 16 | +   - `examples/BUILD`: Example usage in genrules | 
|  | 17 | + | 
|  | 18 | +3. **Created glint archive setup** (`/bazel/glint/`) | 
|  | 19 | +   - `archives.bzl`: Downloads prebuilt binaries for amd64/arm64 | 
|  | 20 | +   - `setup.bzl`: Main setup function | 
|  | 21 | +   - `SHA256_UPDATE.md`: Instructions for updating hashes after release | 
|  | 22 | + | 
|  | 23 | +4. **Updated main Bazel configuration** | 
|  | 24 | +   - `deps.bzl`: Added rules_rust dependencies and glint setup | 
|  | 25 | +   - `packages.bzl`: Added rust crate repository setup | 
|  | 26 | +   - `WORKSPACE`: Added crate repositories loading | 
|  | 27 | +   - `toolchains/register.bzl`: Added glint toolchain registration | 
|  | 28 | + | 
|  | 29 | +5. **Created BUILD files for Rust code** | 
|  | 30 | +   - `/rust/BUILD`: Exports Cargo files | 
|  | 31 | +   - `/rust/glint/BUILD`: Defines glint_binary target for building from source | 
|  | 32 | + | 
|  | 33 | +6. **Fixed issues** | 
|  | 34 | +   - Fixed Rust edition from "2024" to "2021" in glint's Cargo.toml | 
|  | 35 | + | 
|  | 36 | +## How it works: | 
|  | 37 | + | 
|  | 38 | +1. **For amd64/arm64 architectures**: Downloads prebuilt binaries from GitHub releases | 
|  | 39 | +2. **For other architectures**: Falls back to building from source using rules_rust | 
|  | 40 | +3. **Toolchain priority**: Hermetic (prebuilt/source) > Preinstalled | 
|  | 41 | + | 
|  | 42 | +## Next steps: | 
|  | 43 | + | 
|  | 44 | +1. **After the next bazel-bins release**: | 
|  | 45 | +   - Download the released glint binaries | 
|  | 46 | +   - Calculate SHA256 hashes | 
|  | 47 | +   - Update `glint_amd64_sha256` and `glint_arm64_sha256` in versions.bzl | 
|  | 48 | +   - Test the toolchain with: `bazel test //toolchains/glint/test:glint_toolchain_test` | 
|  | 49 | + | 
|  | 50 | +2. **Usage in other projects**: | 
|  | 51 | +   ```python | 
|  | 52 | +   # In WORKSPACE: | 
|  | 53 | +   load("@envoy_toolshed//bazel:deps.bzl", "resolve_dependencies") | 
|  | 54 | +   resolve_dependencies() | 
|  | 55 | + | 
|  | 56 | +   # In BUILD files: | 
|  | 57 | +   load("@envoy_toolshed//toolchains/glint:current_toolchain.bzl", "current_glint_toolchain") | 
|  | 58 | + | 
|  | 59 | +   genrule( | 
|  | 60 | +       name = "lint_files", | 
|  | 61 | +       srcs = ["file.txt"], | 
|  | 62 | +       outs = ["lint_report.json"], | 
|  | 63 | +       cmd = "$(location @envoy_toolshed//toolchains/glint:current_glint_toolchain) $(SRCS) > $@", | 
|  | 64 | +       tools = ["@envoy_toolshed//toolchains/glint:current_glint_toolchain"], | 
|  | 65 | +   ) | 
|  | 66 | +   ``` | 
|  | 67 | + | 
|  | 68 | +## Notes: | 
|  | 69 | +- Glint is a whitespace linter, not a grep tool | 
|  | 70 | +- It checks for trailing whitespace, tabs, and missing final newlines | 
|  | 71 | +- Use `--fix` flag to automatically fix issues | 
0 commit comments