diff options
author | 2024-08-12 16:53:42 +0000 | |
---|---|---|
committer | 2024-08-12 16:53:42 +0000 | |
commit | 08b606153943332075a202450162b02f3eea523a (patch) | |
tree | cc5ea4861fa71eb1c12326ae28fbca80bf86cb40 /java/system_modules.go | |
parent | 9dfccb91a5dfc1bf3637a52165081a54c81c159d (diff) | |
parent | b61c2269435276862c927f40915e9888ae7908f4 (diff) |
Merge changes If313580b,I68d50d68 into main
* changes:
Use a provider for systems modules
Add PrepareForTestWithBuildFlag
Diffstat (limited to 'java/system_modules.go')
-rw-r--r-- | java/system_modules.go | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/java/system_modules.go b/java/system_modules.go index 48b33ba57..5b00079f7 100644 --- a/java/system_modules.go +++ b/java/system_modules.go @@ -120,14 +120,16 @@ func SystemModulesFactory() android.Module { return module } -type SystemModulesProvider interface { - HeaderJars() android.Paths - OutputDirAndDeps() (android.Path, android.Paths) -} +type SystemModulesProviderInfo struct { + // The aggregated header jars from all jars specified in the libs property. + // Used when system module is added as a dependency to bootclasspath. + HeaderJars android.Paths -var _ SystemModulesProvider = (*SystemModules)(nil) + OutputDir android.Path + OutputDirDeps android.Paths +} -var _ SystemModulesProvider = (*systemModulesImport)(nil) +var SystemModulesProvider = blueprint.NewProvider[*SystemModulesProviderInfo]() type SystemModules struct { android.ModuleBase @@ -135,9 +137,6 @@ type SystemModules struct { properties SystemModulesProperties - // The aggregated header jars from all jars specified in the libs property. - // Used when system module is added as a dependency to bootclasspath. - headerJars android.Paths outputDir android.Path outputDeps android.Paths } @@ -147,17 +146,6 @@ type SystemModulesProperties struct { Libs []string } -func (system *SystemModules) HeaderJars() android.Paths { - return system.headerJars -} - -func (system *SystemModules) OutputDirAndDeps() (android.Path, android.Paths) { - if system.outputDir == nil || len(system.outputDeps) == 0 { - panic("Missing directory for system module dependency") - } - return system.outputDir, system.outputDeps -} - func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) { var jars android.Paths @@ -167,9 +155,13 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte } }) - system.headerJars = jars - system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, jars) + + android.SetProvider(ctx, SystemModulesProvider, &SystemModulesProviderInfo{ + HeaderJars: jars, + OutputDir: system.outputDir, + OutputDirDeps: system.outputDeps, + }) } // ComponentDepsMutator is called before prebuilt modules without a corresponding source module are |