From ad429d0cd2f34a244b0965fffd33d001e9e1f103 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 17 Dec 2020 19:31:17 +0900 Subject: [PATCH] SOONG_* variables are emitted only for the BuildOS variants When HOST_OS=linux and HOST_CROSS_OS=linux_bionic, then a module enabled for the target "linux" is mutated for both linux(linux_glibc) and linux_bionic. Although this is WAI for most of the host modules, but also causes duplocated SOONG_* variables from prebuilt_build_tools modules. They are configured as HostSupportedNoCross, but linux_glibc and linux_bionic are not considered as HostCross on the regular linux/x86 machines, because it can run artifacts from both variants natively. Since the problem is at SOONG_* variables, not in the fact that linux_bionic is not considered as HostCross, fixing the problem by emitting the variable only for the variants whose OS is the same as the build system OS (android.BuildOS). Bug: N/A Test: apply aosp/1512778, lunch mainline_sdk && m nothing. out/soong/make_vars-mainline_sdk.mk doesn't have duplicated SOONG_* variables. Change-Id: Ieb51d180b7c1ee758e7a376a960a8c3b91c836c9 --- android/prebuilt_build_tool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/prebuilt_build_tool.go b/android/prebuilt_build_tool.go index b00dc2f2e..516d0420a 100644 --- a/android/prebuilt_build_tool.go +++ b/android/prebuilt_build_tool.go @@ -86,6 +86,9 @@ func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) { func (t *prebuiltBuildTool) MakeVars(ctx MakeVarsModuleContext) { if makeVar := String(t.properties.Export_to_make_var); makeVar != "" { + if t.Target().Os != BuildOs { + return + } ctx.StrictRaw(makeVar, t.toolPath.String()) } }