Add a variant with tracing macros disabled
Setting a static max level effectively removes tracing macros from the
user apps. Useful for disabling tracing compile-time.
Bug: 288876814
Test: m libtracing_max_level_off
Test: Integration tests in another CL
Change-Id: Id47f5c699db58dbc28e109672ae0f6fde4f0e2ca
diff --git a/Android.bp b/Android.bp
index 414bd43..e05e052 100644
--- a/Android.bp
+++ b/Android.bp
@@ -46,3 +46,26 @@
product_available: true,
vendor_available: true,
}
+
+rust_library {
+ name: "libtracing_max_level_off",
+ // has rustc warnings
+ host_supported: true,
+ crate_name: "tracing",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.37",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ features: ["max_level_off"],
+ rustlibs: [
+ "libcfg_if",
+ "libpin_project_lite",
+ "libtracing_core",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+ product_available: true,
+ vendor_available: true,
+}
diff --git a/cargo2android.json b/cargo2android.json
index fe43c3f..4131f2e 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,4 +1,12 @@
{
"run": true,
- "device": true
+ "device": true,
+ "variants": [
+ {
+ },
+ {
+ "features": "max_level_off",
+ "suffix": "_max_level_off"
+ }
+ ]
}