Skip to content

Commit ba753ce

Browse files
authored
[CI] Fix build (#3194)
- Upgraded the Bazel BuildTool to the latest version (8.2.1). - Updated the `tflm-ci` Docker image and pushed the new tag (0.6.1) to the `ghcr.io/tflm-bot/tflm-ci registry`. - Updated the WORKSPACE to load `rules_cc` and `rules_shell` explicitly - Ran `buildifier` to ensure all BUILD files to have all the fixes. BUG=Clean-up
1 parent aa6e625 commit ba753ce

File tree

43 files changed

+127
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+127
-54
lines changed

BUILD

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
12
load("@hedron_compile_commands//:refresh_compile_commands.bzl", "refresh_compile_commands")
23

34
# `bazel run` this target to generate compile_commands.json, which can be used
@@ -8,8 +9,6 @@ refresh_compile_commands(
89
targets = ["//..."],
910
)
1011

11-
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
12-
1312
bool_flag(
1413
name = "with_compression",
1514
build_setting_default = False,

WORKSPACE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ load("//tensorflow:workspace.bzl", "workspace")
1919

2020
workspace()
2121

22+
# init for rules_shell
23+
load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
24+
25+
rules_shell_dependencies()
26+
27+
rules_shell_toolchains()
28+
2229
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2330

2431
# compile_commands.json generator

ci/Dockerfile.micro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ COPY ci/install_qemu.sh ./
2828
RUN ./install_qemu.sh /tmp/qemu_install
2929

3030
# This stage is the final CI container.
31-
FROM python:3.10-bullseye as tflm-ci
31+
FROM python:3.10-bullseye AS tflm-ci
3232

3333
RUN apt-get update
3434

ci/install_buildifier.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
set -e
1818
# Download buildifier.
19-
wget https://github.com/bazelbuild/buildtools/releases/download/4.2.3/buildifier-linux-amd64
19+
wget https://github.com/bazelbuild/buildtools/releases/download/v8.2.1/buildifier-linux-amd64
2020
mv buildifier-linux-amd64 buildifier
2121
chmod +x buildifier
2222
sudo mv buildifier /usr/local/bin/.
2323

2424
# Download buildozer.
25-
wget https://github.com/bazelbuild/buildtools/releases/download/4.2.3/buildozer-linux-amd64
25+
wget https://github.com/bazelbuild/buildtools/releases/download/v8.2.1/buildozer-linux-amd64
2626
mv buildozer-linux-amd64 buildozer
2727
chmod +x buildozer
2828
sudo mv buildozer /usr/local/bin/.

codegen/examples/hello_world/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
12
load("//codegen:build_def.bzl", "tflm_inference_library")
23

34
package(default_visibility = ["//visibility:public"])

python/tests/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
load("@rules_cc//cc:cc_test.bzl", "cc_test")
2+
13
cc_test(
24
name = "cc_deps_link_test",
35
size = "small",

python/tflite_micro/BUILD

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
2-
load("@rules_python//python:defs.bzl", "py_library", "py_test")
32
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
4-
load("//python:py_namespace.bzl", "py_namespace")
5-
load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars")
3+
load("@rules_python//python:defs.bzl", "py_library", "py_test")
64
load("@rules_python//python:packaging.bzl", "py_package", "py_wheel")
5+
load("@rules_shell//shell:sh_test.bzl", "sh_test")
76
load("@tflm_pip_deps//:requirements.bzl", "requirement")
8-
load(
9-
"//tensorflow/lite/micro:build_def.bzl",
10-
"tflm_cc_library",
11-
)
7+
load("//python:py_namespace.bzl", "py_namespace")
128
load(
139
"//tensorflow:extra_rules.bzl",
1410
"tflm_python_op_resolver_friends",
1511
)
12+
load(
13+
"//tensorflow/lite/micro:build_def.bzl",
14+
"tflm_cc_library",
15+
)
16+
load("//tools:expand_stamp_vars.bzl", "expand_stamp_vars")
1617

1718
package(
1819
features = ["-layering_check"],

python/tflite_micro/signal/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
12
load("@rules_python//python:defs.bzl", "py_library", "py_test")
3+
load("@tflm_pip_deps//:requirements.bzl", "requirement")
24
load("//python/tflite_micro/signal:tflm_signal.bzl", "py_tflm_signal_library")
35
load("//tensorflow:extra_rules.bzl", "tflm_signal_friends")
4-
load("@tflm_pip_deps//:requirements.bzl", "requirement")
56

67
package(
78
default_visibility = [":__subpackages__"],

python/tflite_micro/signal/tflm_signal.bzl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Build rule for wrapping a custom TF OP from .cc to python."""
22

3+
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
4+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
35
load("@rules_python//python:defs.bzl", "py_library")
46

57
# TODO(b/286890280): refactor to be more generic build target for any custom OP
@@ -37,7 +39,7 @@ def py_tflm_signal_library(
3739
if cc_op_defs:
3840
binary_name = "ops/_" + name + ".so"
3941
library_name = name + "_cc"
40-
native.cc_library(
42+
cc_library(
4143
name = library_name,
4244
copts = select({
4345
"//conditions:default": ["-pthread"],
@@ -49,8 +51,7 @@ def py_tflm_signal_library(
4951
["@tensorflow_cc_deps//:cc_library"] +
5052
select({"//conditions:default": []}),
5153
)
52-
53-
native.cc_binary(
54+
cc_binary(
5455
name = binary_name,
5556
copts = select({
5657
"//conditions:default": ["-pthread"],
@@ -80,7 +81,7 @@ def tflm_signal_kernel_library(
8081
deps = [],
8182
copts = [],
8283
alwayslink = 1):
83-
native.cc_library(
84+
cc_library(
8485
name = name,
8586
srcs = srcs,
8687
hdrs = hdrs,

python/tflite_micro/signal/utils/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
2+
13
# Signal python utilities.
24
load("@rules_python//python:defs.bzl", "py_library", "py_test")
35
load("@tflm_pip_deps//:requirements.bzl", "requirement")
4-
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
56

67
package(
78
default_visibility = [

0 commit comments

Comments
 (0)