From abc17eac1a8f5f0d6fa3f17fc42ee49288933eaf Mon Sep 17 00:00:00 2001 From: Chris Wailes Date: Thu, 12 Sep 2024 15:37:34 -0700 Subject: [PATCH] Add SOONG_DISABLE_CLIPPY environment variable This environment variable will be used for testing the Rust toolchain for correctness before updating the Android codebase to resolve new lints. Test: Introduce lint Test: SOONG_DISABLE_CLIPPY=true m out/soong/.intermediates/frameworks/minikin/rust/libminikin_rust_ffi/android_arm_armv8-a_rlib_rlib-std/libminikin_rust_ffi.rlib.clippy Change-Id: If7236c7f16a3e0a0b27a90577211549f2dc1a344 --- rust/clippy.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust/clippy.go b/rust/clippy.go index 6f0ed7ff1..426fd7393 100644 --- a/rust/clippy.go +++ b/rust/clippy.go @@ -38,11 +38,14 @@ func (c *clippy) props() []interface{} { } func (c *clippy) flags(ctx ModuleContext, flags Flags, deps PathDeps) (Flags, PathDeps) { - enabled, lints, err := config.ClippyLintsForDir(ctx.ModuleDir(), c.Properties.Clippy_lints) + dirEnabled, lints, err := config.ClippyLintsForDir(ctx.ModuleDir(), c.Properties.Clippy_lints) if err != nil { ctx.PropertyErrorf("clippy_lints", err.Error()) } - flags.Clippy = enabled + + envDisable := ctx.Config().IsEnvTrue("SOONG_DISABLE_CLIPPY") + + flags.Clippy = dirEnabled && !envDisable flags.ClippyFlags = append(flags.ClippyFlags, lints) return flags, deps }