From 749d5bb68db212c24be578804a36b30e6959b483 Mon Sep 17 00:00:00 2001 From: Jose Ulises Nino Rivera Date: Wed, 12 Feb 2020 17:03:27 -0800 Subject: [PATCH] android: update bazel flag config (#684) Description: envoyproxy/envoy#9767 introduced the bazel option and #663 brought it into envoy mobile. This PR changes the bazel config for android to turn on the logger by default when building on android. It also updates a couple other stale flags and docs. Risk Level: low Testing: tested locally and saw logs Fixes #34 Signed-off-by: Jose Nino Signed-off-by: JP Simard --- mobile/.bazelrc | 3 ++- .../docs/root/development/performance/cpu_battery_impact.rst | 2 +- mobile/docs/root/start/building/building.rst | 4 ++-- mobile/docs/root/start/examples/hello_world.rst | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mobile/.bazelrc b/mobile/.bazelrc index 0300d0d841c6..37ffe658d8ff 100644 --- a/mobile/.bazelrc +++ b/mobile/.bazelrc @@ -27,7 +27,7 @@ build --javabase=@bazel_tools//tools/jdk:jdk build:ios --define=manual_stamp=manual_stamp # Default flags for builds targeting Android -build:android --fat_apk_cpu=x86_64 +build:android --define logger=android # Common flags for release builds # TODO: Enable `--copt -ggdb3`. Issues were encountered previously with this: @@ -42,4 +42,5 @@ build:release-ios --config=release-common build:release-ios --copt=-fembed-bitcode # Flags for release builds targeting Android or the JVM +build:release-android --config=android build:release-android --config=release-common diff --git a/mobile/docs/root/development/performance/cpu_battery_impact.rst b/mobile/docs/root/development/performance/cpu_battery_impact.rst index 581d3e5f4ec7..26015429657c 100644 --- a/mobile/docs/root/development/performance/cpu_battery_impact.rst +++ b/mobile/docs/root/development/performance/cpu_battery_impact.rst @@ -94,7 +94,7 @@ a process listening to traffic sent over this connection. Getting the build: -1. Build the library using ``bazel build android_dist --config=android`` +1. Build the library using ``bazel build android_dist --config=android --fat_apk_cpu=armeabi-v7a`` 2. Control: ``bazel mobile-install //examples/kotlin/control:hello_control_kt`` 3. Envoy: ``bazel mobile-install //examples/kotlin/hello_world:hello_envoy_kt --fat_apk_cpu=armeabi-v7a`` diff --git a/mobile/docs/root/start/building/building.rst b/mobile/docs/root/start/building/building.rst index 0c8a5a8e2f1d..c70b34634feb 100644 --- a/mobile/docs/root/start/building/building.rst +++ b/mobile/docs/root/start/building/building.rst @@ -51,7 +51,7 @@ Android AAR Envoy Mobile can be compiled into an ``.aar`` file for use with Android apps. This command is defined in the main :repo:`BUILD ` file of the repo, and may be run locally: -``bazel build android_dist --config=android`` +``bazel build android_dist --config=android --fat_apk_cpu=`` Upon completion of the build, you'll see an ``envoy.aar`` file at :repo:`dist/envoy.aar `. @@ -63,7 +63,7 @@ an example of how this artifact may be used. **When building the artifact for release** (usage outside of development), be sure to include the ``--config=release-android`` option, along with the architectures for which the artifact is being built: -``bazel build android_dist --config=release-android --fat_apk_cpu=x86,x86_64,armeabi-v7a,arm64-v8a`` +``bazel build android_dist --config=release-android --fat_apk_cpu=x86,armeabi-v7a,arm64-v8a`` For a demo of a working app using this artifact, see the :ref:`hello_world` example. diff --git a/mobile/docs/root/start/examples/hello_world.rst b/mobile/docs/root/start/examples/hello_world.rst index 5b2635f55fdd..a0d0cb0561d2 100644 --- a/mobile/docs/root/start/examples/hello_world.rst +++ b/mobile/docs/root/start/examples/hello_world.rst @@ -23,7 +23,7 @@ Next, make sure you have an Android simulator running. Run the :repo:`sample app ` using the following Bazel build rule: -``bazel mobile-install //examples/java/hello_world:hello_envoy --fat_apk_cpu=x86`` +``bazel mobile-install //examples/java/hello_world:hello_envoy --fat_apk_cpu=`` You should see a new app installed on your simulator called ``Hello Envoy``. Open it up, and requests will start flowing! @@ -38,7 +38,7 @@ Next, make sure you have an Android simulator running. Run the :repo:`sample app ` using the following Bazel build rule: -``bazel mobile-install //examples/kotlin/hello_world:hello_envoy_kt --fat_apk_cpu=x86`` +``bazel mobile-install //examples/kotlin/hello_world:hello_envoy_kt --fat_apk_cpu=`` You should see a new app installed on your simulator called ``Hello Envoy Kotlin``. Open it up, and requests will start flowing!