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
This commit is contained in:
Jiyong Park 2020-12-17 19:31:17 +09:00
parent 1a74be780b
commit ad429d0cd2

View file

@ -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())
}
}