fix: required property doesn't track deps to java, apex, ...
This change fixes a bug that the required property doesn't track dependencies to modules whose arch is common. Bug: 321000103 Bug: 321626681 Test: go test ./... Change-Id: I3d2b3ad8cb2a9f1c5c3d5345bf05402a787f011a
This commit is contained in:
parent
fc095e6796
commit
73e5babafe
3 changed files with 30 additions and 7 deletions
|
@ -1074,14 +1074,22 @@ func (m *ModuleBase) addRequiredDeps(ctx BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var deviceTargets []Target
|
||||||
|
deviceTargets = append(deviceTargets, ctx.Config().Targets[Android]...)
|
||||||
|
deviceTargets = append(deviceTargets, ctx.Config().AndroidCommonTarget)
|
||||||
|
|
||||||
|
var hostTargets []Target
|
||||||
|
hostTargets = append(hostTargets, ctx.Config().Targets[ctx.Config().BuildOS]...)
|
||||||
|
hostTargets = append(hostTargets, ctx.Config().BuildOSCommonTarget)
|
||||||
|
|
||||||
if m.Device() {
|
if m.Device() {
|
||||||
for _, depName := range m.RequiredModuleNames() {
|
for _, depName := range m.RequiredModuleNames() {
|
||||||
for _, target := range ctx.Config().Targets[Android] {
|
for _, target := range deviceTargets {
|
||||||
addDep(target, depName)
|
addDep(target, depName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, depName := range m.HostRequiredModuleNames() {
|
for _, depName := range m.HostRequiredModuleNames() {
|
||||||
for _, target := range ctx.Config().Targets[ctx.Config().BuildOS] {
|
for _, target := range hostTargets {
|
||||||
addDep(target, depName)
|
addDep(target, depName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1089,7 +1097,7 @@ func (m *ModuleBase) addRequiredDeps(ctx BottomUpMutatorContext) {
|
||||||
|
|
||||||
if m.Host() {
|
if m.Host() {
|
||||||
for _, depName := range m.RequiredModuleNames() {
|
for _, depName := range m.RequiredModuleNames() {
|
||||||
for _, target := range ctx.Config().Targets[ctx.Config().BuildOS] {
|
for _, target := range hostTargets {
|
||||||
// When a host module requires another host module, don't make a
|
// When a host module requires another host module, don't make a
|
||||||
// dependency if they have different OSes (i.e. hostcross).
|
// dependency if they have different OSes (i.e. hostcross).
|
||||||
if m.Target().HostCross != target.HostCross {
|
if m.Target().HostCross != target.HostCross {
|
||||||
|
@ -1099,7 +1107,7 @@ func (m *ModuleBase) addRequiredDeps(ctx BottomUpMutatorContext) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, depName := range m.TargetRequiredModuleNames() {
|
for _, depName := range m.TargetRequiredModuleNames() {
|
||||||
for _, target := range ctx.Config().Targets[Android] {
|
for _, target := range deviceTargets {
|
||||||
addDep(target, depName)
|
addDep(target, depName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,9 @@ bootstrap_go_package {
|
||||||
"soong",
|
"soong",
|
||||||
"soong-android",
|
"soong-android",
|
||||||
"soong-bpf", // for testing
|
"soong-bpf", // for testing
|
||||||
"soong-phony", // for testing
|
"soong-java", // for testing
|
||||||
"soong-linkerconfig",
|
"soong-linkerconfig",
|
||||||
|
"soong-phony", // for testing
|
||||||
],
|
],
|
||||||
srcs: [
|
srcs: [
|
||||||
"avb_add_hash_footer.go",
|
"avb_add_hash_footer.go",
|
||||||
|
|
|
@ -23,6 +23,7 @@ import (
|
||||||
"android/soong/bpf"
|
"android/soong/bpf"
|
||||||
"android/soong/cc"
|
"android/soong/cc"
|
||||||
"android/soong/etc"
|
"android/soong/etc"
|
||||||
|
"android/soong/java"
|
||||||
"android/soong/phony"
|
"android/soong/phony"
|
||||||
|
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
@ -34,9 +35,12 @@ func TestMain(m *testing.M) {
|
||||||
|
|
||||||
var fixture = android.GroupFixturePreparers(
|
var fixture = android.GroupFixturePreparers(
|
||||||
android.PrepareForIntegrationTestWithAndroid,
|
android.PrepareForIntegrationTestWithAndroid,
|
||||||
|
android.PrepareForTestWithAndroidBuildComponents,
|
||||||
bpf.PrepareForTestWithBpf,
|
bpf.PrepareForTestWithBpf,
|
||||||
etc.PrepareForTestWithPrebuiltEtc,
|
|
||||||
cc.PrepareForIntegrationTestWithCc,
|
cc.PrepareForIntegrationTestWithCc,
|
||||||
|
etc.PrepareForTestWithPrebuiltEtc,
|
||||||
|
java.PrepareForTestWithJavaBuildComponents,
|
||||||
|
java.PrepareForTestWithJavaDefaultModules,
|
||||||
phony.PrepareForTestWithPhony,
|
phony.PrepareForTestWithPhony,
|
||||||
PrepareForTestWithFilesystemBuildComponents,
|
PrepareForTestWithFilesystemBuildComponents,
|
||||||
)
|
)
|
||||||
|
@ -88,12 +92,21 @@ func TestFileSystemDeps(t *testing.T) {
|
||||||
|
|
||||||
phony {
|
phony {
|
||||||
name: "phony",
|
name: "phony",
|
||||||
required: ["libquz"],
|
required: [
|
||||||
|
"libquz",
|
||||||
|
"myapp",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "libquz",
|
name: "libquz",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
android_app {
|
||||||
|
name: "myapp",
|
||||||
|
platform_apis: true,
|
||||||
|
installable: true,
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// produces "myfilesystem.img"
|
// produces "myfilesystem.img"
|
||||||
|
@ -101,6 +114,7 @@ func TestFileSystemDeps(t *testing.T) {
|
||||||
|
|
||||||
fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem)
|
fs := result.ModuleForTests("myfilesystem", "android_common").Module().(*filesystem)
|
||||||
expected := []string{
|
expected := []string{
|
||||||
|
"app/myapp/myapp.apk",
|
||||||
"bin/foo",
|
"bin/foo",
|
||||||
"lib/libbar.so",
|
"lib/libbar.so",
|
||||||
"lib64/libbar.so",
|
"lib64/libbar.so",
|
||||||
|
|
Loading…
Reference in a new issue