diff options
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/java/java.go b/java/java.go index 66550d562..8d10e3bd2 100644 --- a/java/java.go +++ b/java/java.go @@ -363,6 +363,8 @@ type JavaInfo struct { // output file of the module, which may be a classes jar or a dex jar OutputFile android.Path + ExtraOutputFiles android.Paths + AndroidLibraryDependencyInfo *AndroidLibraryDependencyInfo UsesLibraryDependencyInfo *UsesLibraryDependencyInfo @@ -374,6 +376,62 @@ type JavaInfo struct { ModuleWithUsesLibraryInfo *ModuleWithUsesLibraryInfo ModuleWithSdkDepInfo *ModuleWithSdkDepInfo + + // output file containing classes.dex and resources + DexJarFile OptionalDexJarPath + + // installed file for binary dependency + InstallFile android.Path + + // The path to the dex jar that is in the boot class path. If this is unset then the associated + // module is not a boot jar, but could be one of the <x>-hiddenapi modules that provide additional + // annotations for the <x> boot dex jar but which do not actually provide a boot dex jar + // themselves. + // + // This must be the path to the unencoded dex jar as the encoded dex jar indirectly depends on + // this file so using the encoded dex jar here would result in a cycle in the ninja rules. + BootDexJarPath OptionalDexJarPath + + // The compressed state of the dex file being encoded. This is used to ensure that the encoded + // dex file has the same state. + UncompressDexState *bool + + // True if the module containing this structure contributes to the hiddenapi information or has + // that information encoded within it. + Active bool + + BuiltInstalled string + + BuiltInstalledForApex []dexpreopterInstall + + // The config is used for two purposes: + // - Passing dexpreopt information about libraries from Soong to Make. This is needed when + // a <uses-library> is defined in Android.bp, but used in Android.mk (see dex_preopt_config_merger.py). + // Note that dexpreopt.config might be needed even if dexpreopt is disabled for the library itself. + // - Dexpreopt post-processing (using dexpreopt artifacts from a prebuilt system image to incrementally + // dexpreopt another partition). + ConfigPath android.WritablePath + + // The path to the profile on host that dexpreopter generates. This is used as the input for + // dex2oat. + OutputProfilePathOnHost android.Path + + LogtagsSrcs android.Paths + + ProguardDictionary android.OptionalPath + + ProguardUsageZip android.OptionalPath + + LinterReports android.Paths + + // installed file for hostdex copy + HostdexInstallFile android.InstallPath + + // Additional srcJars tacked in by GeneratedJavaLibraryModule + GeneratedSrcjars []android.Path + + // True if profile-guided optimization is actually enabled. + ProfileGuided bool } var JavaInfoProvider = blueprint.NewProvider[*JavaInfo]() @@ -1065,11 +1123,33 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { if javaInfo != nil { setExtraJavaInfo(ctx, j, javaInfo) + javaInfo.ExtraOutputFiles = j.extraOutputFiles + javaInfo.DexJarFile = j.dexJarFile + javaInfo.InstallFile = j.installFile + javaInfo.BootDexJarPath = j.bootDexJarPath + javaInfo.UncompressDexState = j.uncompressDexState + javaInfo.Active = j.active + javaInfo.BuiltInstalledForApex = j.builtInstalledForApex + javaInfo.BuiltInstalled = j.builtInstalled + javaInfo.ConfigPath = j.configPath + javaInfo.OutputProfilePathOnHost = j.outputProfilePathOnHost + javaInfo.LogtagsSrcs = j.logtagsSrcs + javaInfo.ProguardDictionary = j.proguardDictionary + javaInfo.ProguardUsageZip = j.proguardUsageZip + javaInfo.LinterReports = j.reports + javaInfo.HostdexInstallFile = j.hostdexInstallFile + javaInfo.GeneratedSrcjars = j.properties.Generated_srcjars + javaInfo.ProfileGuided = j.dexpreopter.dexpreoptProperties.Dex_preopt_result.Profile_guided + android.SetProvider(ctx, JavaInfoProvider, javaInfo) } setOutputFiles(ctx, j.Module) + j.javaLibraryModuleInfoJSON(ctx) +} + +func (j *Library) javaLibraryModuleInfoJSON(ctx android.ModuleContext) *android.ModuleInfoJSON { moduleInfoJSON := ctx.ModuleInfoJSON() moduleInfoJSON.Class = []string{"JAVA_LIBRARIES"} if j.implementationAndResourcesJar != nil { @@ -1092,6 +1172,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { moduleInfoJSON.Disabled = true j.dexpreopter.ModuleInfoJSONForApex(ctx) } + return moduleInfoJSON } func (j *Library) getJarInstallDir(ctx android.ModuleContext) android.InstallPath { @@ -2258,7 +2339,7 @@ func (al *ApiLibrary) StubsJar() android.Path { func metalavaStubCmd(ctx android.ModuleContext, rule *android.RuleBuilder, srcs android.Paths, homeDir android.WritablePath, - classpath android.Paths, configFiles android.Paths) *android.RuleBuilderCommand { + classpath android.Paths, configFiles android.Paths, apiSurface *string) *android.RuleBuilderCommand { rule.Command().Text("rm -rf").Flag(homeDir.String()) rule.Command().Text("mkdir -p").Flag(homeDir.String()) @@ -2299,6 +2380,8 @@ func metalavaStubCmd(ctx android.ModuleContext, rule *android.RuleBuilder, addMetalavaConfigFilesToCmd(cmd, configFiles) + addOptionalApiSurfaceToCmd(cmd, apiSurface) + if len(classpath) == 0 { // The main purpose of the `--api-class-resolution api` option is to force metalava to ignore // classes on the classpath when an API file contains missing classes. However, as this command @@ -2503,7 +2586,7 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { combinedPaths := append(([]android.Path)(nil), systemModulesPaths...) combinedPaths = append(combinedPaths, classPaths...) combinedPaths = append(combinedPaths, bootclassPaths...) - cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir, combinedPaths, configFiles) + cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir, combinedPaths, configFiles, al.properties.Api_surface) al.stubsFlags(ctx, cmd, stubsDir) |