Update transitive lib propagation

Only propagate transitive libs by way of library-like references. This
avoids inclusion of transitive deps from tools like lint modules that
are unncessary for R8.

This yields build speedups for a number of targets, including:
 * services.jar:            -22% (66s -> 51s)
 * telephony-common.jar:    -27% (29s -> 21s)
 * updatable-media.jar:     -41% (17s -> 10s)
 * framework-appsearch.jar: -46% (13s ->  7s)

Bug: 302383328
Bug: 307273642
Test: m
Change-Id: I60bb30e84dabe522ea9ac9333f00e739962ea91d
This commit is contained in:
Jared Duke 2023-10-27 18:47:10 +00:00
parent 8e586ab8b3
commit efb6d60210

View file

@ -1946,19 +1946,22 @@ func (j *providesTransitiveHeaderJars) collectTransitiveHeaderJars(ctx android.M
}
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
if dep.TransitiveLibsHeaderJars != nil {
transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJars)
}
if dep.TransitiveStaticLibsHeaderJars != nil {
transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJars)
}
tag := ctx.OtherModuleDependencyTag(module)
_, isUsesLibDep := tag.(usesLibraryDependencyTag)
if tag == libTag || tag == r8LibraryJarTag || isUsesLibDep {
directLibs = append(directLibs, dep.HeaderJars...)
} else if tag == staticLibTag {
directStaticLibs = append(directStaticLibs, dep.HeaderJars...)
} else {
// Don't propagate transitive libs for other kinds of dependencies.
return
}
if dep.TransitiveLibsHeaderJars != nil {
transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJars)
}
if dep.TransitiveStaticLibsHeaderJars != nil {
transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJars)
}
})
j.transitiveLibsHeaderJars = android.NewDepSet(android.POSTORDER, directLibs, transitiveLibs)