From 6147c6972a4ba3c0cb0871ae6a72b1f56caeb13a Mon Sep 17 00:00:00 2001 From: Vishwath Mohan Date: Mon, 30 Oct 2017 20:33:41 -0700 Subject: [PATCH] Hide mutated variant in non-make builds. This CL hides (using Module.Properties.PreventInstall) either the sanitized or stock variant for non-make embedded builds (based on whether a sanitizer is enabled or not) so we don't have duplicate rules for installing the same target. Bug: 30227045 Test: OUT_DIR=out build/soong/scripts/build-ndk-prebuilts.sh # no longer generates a duplicate build error. Change-Id: I0b2dbb0afd5d426b32da67f951e2a4f9fbb3f3b9 --- cc/sanitize.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cc/sanitize.go b/cc/sanitize.go index 53de14bd3..ea6a33e2f 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -574,22 +574,22 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) { modules[1].(*Module).sanitize.Properties.InSanitizerDir = true modules[1].(*Module).sanitize.SetSanitizer(cfi, false) } - } else { + } + if mctx.AConfig().EmbeddedInMake() && !mctx.Device() { + if isSanitizerEnabled { + modules[0].(*Module).Properties.HideFromMake = true + } else { + modules[1].(*Module).Properties.HideFromMake = true + } + } + if !mctx.AConfig().EmbeddedInMake() || !mctx.Device() { if isSanitizerEnabled { modules[0].(*Module).Properties.PreventInstall = true } else { modules[1].(*Module).Properties.PreventInstall = true } } - if mctx.AConfig().EmbeddedInMake() { - if !mctx.Device() { - if isSanitizerEnabled { - modules[0].(*Module).Properties.HideFromMake = true - } else { - modules[1].(*Module).Properties.HideFromMake = true - } - } - } + } c.sanitize.Properties.SanitizeDep = false }