diff options
author | 2024-07-26 15:25:46 -0700 | |
---|---|---|
committer | 2024-09-04 16:13:46 -0700 | |
commit | c9b4f6b502ec2029196d658d06eabdf1dc555770 (patch) | |
tree | 88c12fa95c37d7e06b9cedc93418c5079ac949ac /java/system_modules.go | |
parent | fdaa672ad1faacf0fb279adf876841dc2ffb404e (diff) |
Use transitive header jars in classpaths
Skip combining jars into turbine-combined, combined, and withres jars
and instead collect transitive jars to use in the classpath and to
produce the final dexed jar.
This reduces the size of a `m checkbuild` in git_main by 11%, from
1300 KiB to 1154 KiB. It may also improve caching and reduce uplink
network bandwidth when building with RBE, as now the classpath inputs
to rules are themselves outputs of previous rules and so already in
the RBE CAS.
The downside is that the classpath inputs to each rule are now much
longer, increasing the Soong ninja file size 11%, from 4.6 GiB to
5.1 GiB. This could be mitigated in the future by supporting something
like depsets in the generated ninja file to reduce duplication.
Bug: 308016794
Test: TestSimple, TestKotlin, TestClasspath
Flag: build.RELEASE_USE_TRANSITIVE_JARS_IN_CLASSPATH
Change-Id: I2b7b4261375494370da70f98597c8719f1d561cf
Diffstat (limited to 'java/system_modules.go')
-rw-r--r-- | java/system_modules.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/java/system_modules.go b/java/system_modules.go index f89bf9ea6..d9430b25e 100644 --- a/java/system_modules.go +++ b/java/system_modules.go @@ -127,6 +127,9 @@ type SystemModulesProviderInfo struct { OutputDir android.Path OutputDirDeps android.Paths + + // depset of header jars for this module and all transitive static dependencies + TransitiveStaticLibsHeaderJars *android.DepSet[android.Path] } var SystemModulesProvider = blueprint.NewProvider[*SystemModulesProviderInfo]() @@ -149,18 +152,23 @@ type SystemModulesProperties struct { func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) { var jars android.Paths + var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path] ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) { if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok { jars = append(jars, dep.HeaderJars...) + if dep.TransitiveStaticLibsHeaderJars != nil { + transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) + } } }) system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars) android.SetProvider(ctx, SystemModulesProvider, &SystemModulesProviderInfo{ - HeaderJars: jars, - OutputDir: system.outputDir, - OutputDirDeps: system.outputDeps, + HeaderJars: jars, + OutputDir: system.outputDir, + OutputDirDeps: system.outputDeps, + TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsHeaderJars), }) } |