diff options
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 101 |
1 files changed, 65 insertions, 36 deletions
diff --git a/java/java.go b/java/java.go index c5dee0c97..b9109ee94 100644 --- a/java/java.go +++ b/java/java.go @@ -259,7 +259,6 @@ type AndroidLibraryDependencyInfo struct { } type UsesLibraryDependencyInfo struct { - DexJarBuildPath OptionalDexJarPath DexJarInstallPath android.Path ClassLoaderContexts dexpreopt.ClassLoaderContextMap } @@ -403,13 +402,6 @@ type JavaInfo struct { BuiltInstalled string - // ApexSystemServerDexpreoptInstalls stores the list of dexpreopt artifacts if this is a system server - // jar in an apex. - ApexSystemServerDexpreoptInstalls []DexpreopterInstall - - // ApexSystemServerDexJars stores the list of dex jars if this is a system server jar in an apex. - ApexSystemServerDexJars android.Paths - // 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). @@ -418,10 +410,6 @@ type JavaInfo struct { // 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 @@ -438,14 +426,39 @@ type JavaInfo struct { // True if profile-guided optimization is actually enabled. ProfileGuided bool + + Stem string + + DexJarBuildPath OptionalDexJarPath + + DexpreopterInfo *DexpreopterInfo } var JavaInfoProvider = blueprint.NewProvider[*JavaInfo]() -type JavaLibraryInfo struct{} +type DexpreopterInfo struct { + // The path to the profile on host that dexpreopter generates. This is used as the input for + // dex2oat. + OutputProfilePathOnHost android.Path + // If the java module is to be installed into an APEX, this list contains information about the + // dexpreopt outputs to be installed on devices. Note that these dexpreopt outputs are installed + // outside of the APEX. + ApexSystemServerDexpreoptInstalls []DexpreopterInstall + + // ApexSystemServerDexJars returns the list of dex jars if this is an apex system server jar. + ApexSystemServerDexJars android.Paths +} + +type JavaLibraryInfo struct { + Prebuilt bool +} var JavaLibraryInfoProvider = blueprint.NewProvider[JavaLibraryInfo]() +type JavaDexImportInfo struct{} + +var JavaDexImportInfoProvider = blueprint.NewProvider[JavaDexImportInfo]() + // SyspropPublicStubInfo contains info about the sysprop public stub library that corresponds to // the sysprop implementation library. type SyspropPublicStubInfo struct { @@ -1127,7 +1140,9 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { TopLevelTarget: j.sourceProperties.Top_level_test_target, }) - android.SetProvider(ctx, JavaLibraryInfoProvider, JavaLibraryInfo{}) + android.SetProvider(ctx, JavaLibraryInfoProvider, JavaLibraryInfo{ + Prebuilt: false, + }) if javaInfo != nil { setExtraJavaInfo(ctx, j, javaInfo) @@ -1137,11 +1152,8 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { javaInfo.BootDexJarPath = j.bootDexJarPath javaInfo.UncompressDexState = j.uncompressDexState javaInfo.Active = j.active - javaInfo.ApexSystemServerDexpreoptInstalls = j.apexSystemServerDexpreoptInstalls - javaInfo.ApexSystemServerDexJars = j.apexSystemServerDexJars javaInfo.BuiltInstalled = j.builtInstalled javaInfo.ConfigPath = j.configPath - javaInfo.OutputProfilePathOnHost = j.outputProfilePathOnHost javaInfo.LogtagsSrcs = j.logtagsSrcs javaInfo.ProguardDictionary = j.proguardDictionary javaInfo.ProguardUsageZip = j.proguardUsageZip @@ -1910,6 +1922,10 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, if j.testConfig != nil { ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".config", j.testConfig) } + dynamicConfig := android.ExistentPathForSource(ctx, ctx.ModuleDir(), "DynamicConfig.xml") + if dynamicConfig.Valid() { + ctx.InstallFile(pathInTestCases, ctx.ModuleName()+".dynamic", dynamicConfig.Path()) + } testDeps := append(j.data, j.extraTestConfigs...) for _, data := range android.SortedUniquePaths(testDeps) { dataPath := android.DataPath{SrcPath: data} @@ -3056,12 +3072,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { // file of the module to be named jarName. var outputFile android.Path combinedImplementationJar := android.PathForModuleOut(ctx, "combined", jarName) - var implementationJars android.Paths - if ctx.Config().UseTransitiveJarsInClasspath() { - implementationJars = completeStaticLibsImplementationJars.ToList() - } else { - implementationJars = append(slices.Clone(localJars), staticJars...) - } + implementationJars := completeStaticLibsImplementationJars.ToList() TransformJarsToJar(ctx, combinedImplementationJar, "combine prebuilt implementation jars", implementationJars, android.OptionalPath{}, false, j.properties.Exclude_files, j.properties.Exclude_dirs) outputFile = combinedImplementationJar @@ -3084,12 +3095,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { if reuseImplementationJarAsHeaderJar { headerJar = outputFile } else { - var headerJars android.Paths - if ctx.Config().UseTransitiveJarsInClasspath() { - headerJars = completeStaticLibsHeaderJars.ToList() - } else { - headerJars = append(slices.Clone(localJars), staticHeaderJars...) - } + headerJars := completeStaticLibsHeaderJars.ToList() headerOutputFile := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, headerOutputFile, "combine prebuilt header jars", headerJars, android.OptionalPath{}, false, j.properties.Exclude_files, j.properties.Exclude_dirs) @@ -3153,11 +3159,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs) - if ctx.Config().UseTransitiveJarsInClasspath() { - ctx.CheckbuildFile(localJars...) - } else { - ctx.CheckbuildFile(outputFile) - } + ctx.CheckbuildFile(localJars...) if ctx.Device() { // Shared libraries deapexed from prebuilt apexes are no longer supported. @@ -3229,6 +3231,10 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { setExtraJavaInfo(ctx, j, javaInfo) android.SetProvider(ctx, JavaInfoProvider, javaInfo) + android.SetProvider(ctx, JavaLibraryInfoProvider, JavaLibraryInfo{ + Prebuilt: true, + }) + ctx.SetOutputFiles(android.Paths{j.combinedImplementationFile}, "") ctx.SetOutputFiles(android.Paths{j.combinedImplementationFile}, ".jar") @@ -3508,6 +3514,12 @@ func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"), j.Stem()+".jar", dexOutputFile) } + + javaInfo := &JavaInfo{} + setExtraJavaInfo(ctx, j, javaInfo) + android.SetProvider(ctx, JavaInfoProvider, javaInfo) + + android.SetProvider(ctx, JavaDexImportInfoProvider, JavaDexImportInfo{}) } func (j *DexImport) DexJarBuildPath(ctx android.ModuleErrorfContext) OptionalDexJarPath { @@ -3695,7 +3707,7 @@ func addCLCFromDep(ctx android.ModuleContext, depModule android.ModuleProxy, } } clcMap.AddContext(ctx, dexpreopt.AnySdkVersion, *sdkLib, optional, - dep.UsesLibraryDependencyInfo.DexJarBuildPath.PathOrNil(), + dep.DexJarBuildPath.PathOrNil(), dep.UsesLibraryDependencyInfo.DexJarInstallPath, dep.UsesLibraryDependencyInfo.ClassLoaderContexts) } else { clcMap.AddContextMap(dep.UsesLibraryDependencyInfo.ClassLoaderContexts, depName) @@ -3779,7 +3791,6 @@ func setExtraJavaInfo(ctx android.ModuleContext, module android.Module, javaInfo if ulDep, ok := module.(UsesLibraryDependency); ok { javaInfo.UsesLibraryDependencyInfo = &UsesLibraryDependencyInfo{ - DexJarBuildPath: ulDep.DexJarBuildPath(ctx), DexJarInstallPath: ulDep.DexJarInstallPath(), ClassLoaderContexts: ulDep.ClassLoaderContexts(), } @@ -3808,4 +3819,22 @@ func setExtraJavaInfo(ctx android.ModuleContext, module android.Module, javaInfo Stubs: stubs, } } + + if st, ok := module.(ModuleWithStem); ok { + javaInfo.Stem = st.Stem() + } + + if mm, ok := module.(interface { + DexJarBuildPath(ctx android.ModuleErrorfContext) OptionalDexJarPath + }); ok { + javaInfo.DexJarBuildPath = mm.DexJarBuildPath(ctx) + } + + if di, ok := module.(DexpreopterInterface); ok { + javaInfo.DexpreopterInfo = &DexpreopterInfo{ + OutputProfilePathOnHost: di.OutputProfilePathOnHost(), + ApexSystemServerDexpreoptInstalls: di.ApexSystemServerDexpreoptInstalls(), + ApexSystemServerDexJars: di.ApexSystemServerDexJars(), + } + } } |