[meta-tensorflow][PATCH 10/25] bazel-native/bazel.bbclass: replace deprecated --local_resources


hongxu
 

1. Use --local_ram_resources and --local_cpu_resources to replace
deprecated --local_resources

2. Add options to bazel-native build

|ERROR: --local_resources is deprecated. Please use --local_ram_resources and/or --local_cpu_resources

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
classes/bazel.bbclass | 2 +-
recipes-devtools/bazel/bazel-native_3.1.0.bb | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/classes/bazel.bbclass b/classes/bazel.bbclass
index b4c2a7f..2a64156 100644
--- a/classes/bazel.bbclass
+++ b/classes/bazel.bbclass
@@ -75,7 +75,7 @@ bazel_do_configure () {
cat > "${S}/bazelrc" <<-EOF
build --verbose_failures
build --spawn_strategy=standalone --genrule_strategy=standalone
-build --jobs=${BAZEL_JOBS} --local_resources=4096,${BAZEL_JOBS},1.0
+buuld --jobs=${BAZEL_JOBS} --local_ram_resources=4096 --local_cpu_resources=${BAZEL_JOBS}
test --verbose_failures --verbose_test_summary
test --spawn_strategy=standalone --genrule_strategy=standalone

diff --git a/recipes-devtools/bazel/bazel-native_3.1.0.bb b/recipes-devtools/bazel/bazel-native_3.1.0.bb
index 0555f2f..1336da8 100644
--- a/recipes-devtools/bazel/bazel-native_3.1.0.bb
+++ b/recipes-devtools/bazel/bazel-native_3.1.0.bb
@@ -26,11 +26,21 @@ DEPENDS = "coreutils-native \
S="${WORKDIR}"

TS_DL_DIR ??= "${DL_DIR}"
+
+BAZEL_JOBS ??= "4"
+EXTRA_BAZEL_ARGS = " \
+ --host_javabase=@local_jdk//:jdk \
+ --python_path=python3 \
+ --jobs=${BAZEL_JOBS} \
+ --local_ram_resources=4096 \
+ --local_cpu_resources=${BAZEL_JOBS} \
+"
+
do_compile () {
export JAVA_HOME="${STAGING_LIBDIR_NATIVE}/jvm/openjdk-8-native"
TMPDIR="${TOPDIR}/bazel" \
VERBOSE=yes \
- EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk --python_path=python3" \
+ EXTRA_BAZEL_ARGS="${EXTRA_BAZEL_ARGS}" \
./compile.sh
}

--
2.21.0

Join yocto@lists.yoctoproject.org to automatically receive all group messages.