Explicitly disable layering check for TFLM bazel packages.

Note that we will need to manually ensure that any new bazel package has
the leyering_check disabled.

The internal builds have layering_check turned on by default, while the
open-source builds have them turned off by default. Ideally, we would
explicitly turn them on for the open-source build.

However, turning it on (with `layering_check` instead of
`-layering_check`) and building with this command:

```
bazel build tensorflow/lite/micro/kernels:add_test --repo_env=CC=`which clang`
```

results in a number of additional build errors that will need much
broader changes to the TFLM BUILD files to fix.

As a result, we are currently turning off the layering_check to at least
make the internal and external builds consistent.

Fixes #46347

See http://b/177257332 for more internal-only context.
This commit is contained in:
Advait Jain 2021-01-11 11:53:27 -08:00
parent c9e25cdf51
commit 892bbc9797
13 changed files with 44 additions and 15 deletions

View File

@ -10,6 +10,7 @@ load(
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0 licenses = ["notice"], # Apache 2.0
) )

View File

@ -1,6 +1,9 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@bazel_skylib//rules:build_test.bzl", "build_test")
licenses(["notice"]) # Apache 2.0 package(
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
package_group( package_group(
name = "micro_top_level", name = "micro_top_level",

View File

@ -10,9 +10,11 @@ load(
"micro_copts", "micro_copts",
) )
package(default_visibility = ["//visibility:public"]) package(
default_visibility = ["//visibility:public"],
licenses(["notice"]) # Apache 2.0 features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
cc_library( cc_library(
name = "model", name = "model",

View File

@ -6,7 +6,10 @@ load(
"tflite_micro_cc_test", "tflite_micro_cc_test",
) )
licenses(["notice"]) # Apache 2.0 package(
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
cc_library( cc_library(
name = "image_model_data", name = "image_model_data",

View File

@ -6,9 +6,11 @@ load(
"tflite_micro_cc_test", "tflite_micro_cc_test",
) )
package(default_visibility = ["//visibility:public"]) package(
default_visibility = ["//visibility:public"],
licenses(["notice"]) # Apache 2.0 features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
cc_library( cc_library(
name = "magic_wand_model_data", name = "magic_wand_model_data",

View File

@ -8,6 +8,7 @@ load(
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0 licenses = ["notice"], # Apache 2.0
) )

View File

@ -7,6 +7,7 @@ load(
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0 licenses = ["notice"], # Apache 2.0
) )

View File

@ -6,9 +6,11 @@ load(
"tflite_micro_cc_test", "tflite_micro_cc_test",
) )
package(default_visibility = ["//visibility:public"]) package(
default_visibility = ["//visibility:public"],
licenses(["notice"]) # Apache 2.0 features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
cc_library( cc_library(
name = "model_settings", name = "model_settings",

View File

@ -1,6 +1,9 @@
# Description: # Description:
# TensorFlow Lite for Microcontrollers Vision Example Utils. # TensorFlow Lite for Microcontrollers Vision Example Utils.
licenses(["notice"]) # Apache 2.0 package(
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
py_binary( py_binary(
name = "raw_to_bitmap", name = "raw_to_bitmap",

View File

@ -7,7 +7,10 @@ load(
"micro_copts", "micro_copts",
) )
licenses(["notice"]) # Apache 2.0 package(
licenses = ["notice"], # Apache 2.0
features = ["-layering_check"],
)
config_setting( config_setting(
name = "xtensa_hifimini", name = "xtensa_hifimini",
@ -670,6 +673,7 @@ cc_library(
"//tensorflow/lite/c:common", "//tensorflow/lite/c:common",
"//tensorflow/lite/kernels/internal:compatibility", "//tensorflow/lite/kernels/internal:compatibility",
"//tensorflow/lite/kernels/internal:types", "//tensorflow/lite/kernels/internal:types",
"//tensorflow/lite/micro:debug_log",
], ],
) )

View File

@ -1,6 +1,9 @@
load("@bazel_skylib//rules:build_test.bzl", "build_test") load("@bazel_skylib//rules:build_test.bzl", "build_test")
licenses(["notice"]) package(
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
cc_binary( cc_binary(
name = "generate_flexbuffers_data", name = "generate_flexbuffers_data",

View File

@ -9,6 +9,7 @@ load(
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0 licenses = ["notice"], # Apache 2.0
) )

View File

@ -4,7 +4,10 @@ load(
"tflite_micro_cc_test", "tflite_micro_cc_test",
) )
licenses(["notice"]) # Apache 2.0 package(
features = ["-layering_check"],
licenses = ["notice"], # Apache 2.0
)
package_group( package_group(
name = "micro", name = "micro",