add target_compatible_with stanza for host targets
Soong modules that are specific for the host platform (e.g. java_library_host, cc_binary_host, java_genrule_host, etc.) should not be built on the target platform (Android), so we add a target_compatible_with attribute to skip this type of module on an Android target build. Bug: 215229742 Test: go test ./bp2build Change-Id: Ifb76ef4e0dc4cb3adb6a64b5c375ce36f7973e48
This commit is contained in:
@@ -48,9 +48,17 @@ java_library_host {
|
||||
makeBazelTarget("java_library", "java-lib-host-1", attrNameToString{
|
||||
"srcs": `["a.java"]`,
|
||||
"deps": `[":java-lib-host-2"]`,
|
||||
"target_compatible_with": `select({
|
||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
}),
|
||||
makeBazelTarget("java_library", "java-lib-host-2", attrNameToString{
|
||||
"srcs": `["c.java"]`,
|
||||
"target_compatible_with": `select({
|
||||
"//build/bazel/platforms/os:android": ["@platforms//:incompatible"],
|
||||
"//conditions:default": [],
|
||||
})`,
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
Reference in New Issue
Block a user