Annotate dependency tags for dependencies of installed files

Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: Ic22603a5c0718b5a21686672a7471f952b4d1017
This commit is contained in:
Colin Cross
2020-11-10 18:12:15 -08:00
parent a615901b53
commit 62a0cfd054
14 changed files with 338 additions and 29 deletions

View File

@@ -598,6 +598,10 @@ var (
// has dependencies on all the OS variants.
CommonOS = NewOsType("common_os", Generic, false)
// CommonArch is the Arch for all modules that are os-specific but not arch specific,
// for example most Java modules.
CommonArch = Arch{ArchType: Common}
osArchTypeMap = map[OsType][]ArchType{
Linux: []ArchType{X86, X86_64},
LinuxBionic: []ArchType{Arm64, X86_64},
@@ -661,7 +665,7 @@ func NewOsType(name string, class OsClass, defDisabled bool) OsType {
if _, found := commonTargetMap[name]; found {
panic(fmt.Errorf("Found Os type duplicate during OsType registration: %q", name))
} else {
commonTargetMap[name] = Target{Os: os, Arch: Arch{ArchType: Common}}
commonTargetMap[name] = Target{Os: os, Arch: CommonArch}
}
return os
@@ -819,9 +823,6 @@ type archDepTag struct {
// Identifies the dependency from CommonOS variant to the os specific variants.
var commonOsToOsSpecificVariantTag = archDepTag{name: "common os to os specific"}
// Identifies the dependency from arch variant to the common variant for a "common_first" multilib.
var firstArchToCommonArchDepTag = archDepTag{name: "first arch to common arch"}
// Get the OsType specific variants for the current CommonOS variant.
//
// The returned list will only contain enabled OsType specific variants of the
@@ -960,12 +961,6 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
addTargetProperties(m, targets[i], multiTargets, i == 0)
m.base().setArchProperties(mctx)
}
if multilib == "common_first" && len(modules) >= 2 {
for i := range modules[1:] {
mctx.AddInterVariantDependency(firstArchToCommonArchDepTag, modules[i+1], modules[0])
}
}
}
func addTargetProperties(m Module, target Target, multiTargets []Target, primaryTarget bool) {