Skip to content

Commit 0c03d3d

Browse files
authored
build(bazel): pin bazel version to 7.0.0 (#2360)
Pin the Bazel version used and executed by Bazelisk to guarantee that TFLM is built with a specified version of Bazel. When the latest release of Bazel went from version 6.3 to 7.0, our builds, which were set to follow the latest release (because there was no .bazelversion), were disrupted due to incompatibilities. By pinning the Bazel version, we prevent such surprises in the future. Revise the developer documentation to mandate the use of Bazelisk. According to [Bazelisk documentation](https://github.com/bazelbuild/bazelisk/blob/9d3fc7d5e356071d2d40b75e69694a0c124e5e33/README.md#ensuring-that-your-developers-use-bazelisk-rather-than-bazel), direct installations of bazel typically use a wrapper script which checks .bazelversion also. BUG=see description
1 parent 77f655c commit 0c03d3d

File tree

2 files changed

+39
-22
lines changed

2 files changed

+39
-22
lines changed

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.0.0

CONTRIBUTING.md

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,27 @@ https://github.com/ekalinin/github-markdown-toc#auto-insert-and-update-toc
44
-->
55

66
<!--ts-->
7-
* [How to Contribute](#how-to-contribute)
8-
* [Contributor License Agreement](#contributor-license-agreement)
9-
* [Community Guidelines](#community-guidelines)
10-
* [Code Contribution Guidelines](#code-contribution-guidelines)
11-
* [General Pull Request Guidelines](#general-pull-request-guidelines)
12-
* [Guidelines for Specific Contribution Categories](#guidelines-for-specific-contribution-categories)
13-
* [Bug Fixes](#bug-fixes)
14-
* [Reference Kernel Implementations](#reference-kernel-implementations)
15-
* [Optimized Kernel Implementations](#optimized-kernel-implementations)
16-
* [New Target / Platform / IDE / Examples](#new-target--platform--ide--examples)
17-
* [Development Workflow Notes](#development-workflow-notes)
18-
* [Initial Setup](#initial-setup)
19-
* [Before submitting your PR](#before-submitting-your-pr)
20-
* [During the PR review](#during-the-pr-review)
21-
* [Reviewer notes](#reviewer-notes)
22-
* [Python notes](#python-notes)
23-
* [Continuous Integration System](#continuous-integration-system)
24-
25-
<!-- Added by: advaitjain, at: Thu 16 Sep 2021 11:43:42 AM PDT -->
7+
* [How to Contribute](#how-to-contribute)
8+
* [Contributor License Agreement](#contributor-license-agreement)
9+
* [Community Guidelines](#community-guidelines)
10+
* [Code Contribution Guidelines](#code-contribution-guidelines)
11+
* [General Pull Request Guidelines](#general-pull-request-guidelines)
12+
* [Guidelines for Specific Contribution Categories](#guidelines-for-specific-contribution-categories)
13+
* [Bug Fixes](#bug-fixes)
14+
* [Reference Kernel Implementations](#reference-kernel-implementations)
15+
* [Optimized Kernel Implementations](#optimized-kernel-implementations)
16+
* [New Target / Platform / IDE / Examples](#new-target--platform--ide--examples)
17+
* [Development Environment](#development-environment)
18+
* [Prerequisites](#prerequisites)
19+
* [Recommendations](#recommendations)
20+
* [Development Workflow Notes](#development-workflow-notes)
21+
* [Before submitting your PR](#before-submitting-your-pr)
22+
* [During the PR review](#during-the-pr-review)
23+
* [Reviewer notes](#reviewer-notes)
24+
* [Python notes](#python-notes)
25+
* [Continuous Integration System](#continuous-integration-system)
26+
27+
<!-- Added by: rkuester, at: Fri Dec 15 04:25:41 PM CST 2023 -->
2628

2729
<!--te-->
2830

@@ -143,10 +145,20 @@ Please see the [optimized kernel implementations guide](tensorflow/lite/micro/do
143145
Please see the [new platform support guide](tensorflow/lite/micro/docs/new_platform_support.md)
144146
for documentation on how to add TFLM support for your particular platform.
145147

148+
# Development Environment
146149

147-
# Development Workflow Notes
150+
We support amd64-architecture development and testing on Ubuntu 22.04, although
151+
other OSes may work.
152+
153+
## Prerequisites
154+
155+
TFLM's primary build system is [Bazel](https://bazel.build). Add
156+
[Bazelisk](https://github.com/bazelbuild/bazelisk) as the `bazel` executable in
157+
your PATH ([e.g., copy it to `/usr/local/bin/bazel`](ci/install_bazelisk.sh)) to
158+
automatically download and run the correct Bazel version as specified in
159+
`//.bazelversion`.
148160

149-
## Initial Setup
161+
## Recommendations
150162

151163
Below are some tips that might be useful and improve the development experience.
152164

@@ -156,7 +168,9 @@ Below are some tips that might be useful and improve the development experience.
156168
* Code search the [TfLite Micro codebase](https://sourcegraph.com/github.com/tensorflow/tflite-micro@main)
157169
on Sourcegraph. And optionally install the [plugin that enables GitHub integration](https://docs.sourcegraph.com/integration/github#github-integration-with-sourcegraph).
158170

159-
* Install [bazel](ci/install_bazelisk.sh) and [buildifier](ci/install_buildifier.sh).
171+
* Install
172+
[Buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md)
173+
([e.g.](ci/install_buildifier.sh)) to format Bazel BUILD and .bzl files.
160174

161175
* Install the latest clang and clang-format. For example, [here](ci/Dockerfile.micro)
162176
is the what we do for the TFLM continuous integration Docker container.
@@ -184,6 +198,8 @@ Below are some tips that might be useful and improve the development experience.
184198
cp tensorflow/lite/micro/tools/dev_setup/pre-push.tflm .git/hooks/pre-push
185199
```
186200

201+
# Development Workflow Notes
202+
187203
## Before submitting your PR
188204

189205
1. Run in-place clang-format on all the files that are modified in your git

0 commit comments

Comments
 (0)