Loading dexpreopt/class_loader_context.go +23 −0 Original line number Diff line number Diff line Loading @@ -534,3 +534,26 @@ func fromJsonClassLoaderContextRec(ctx android.PathContext, jClcs map[string]*js } return clcs } // Convert Soong CLC map to JSON representation for Make. func toJsonClassLoaderContext(clcMap ClassLoaderContextMap) jsonClassLoaderContextMap { jClcMap := make(jsonClassLoaderContextMap) for sdkVer, clcs := range clcMap { sdkVerStr := fmt.Sprintf("%d", sdkVer) jClcMap[sdkVerStr] = toJsonClassLoaderContextRec(clcs) } return jClcMap } // Recursive helper for toJsonClassLoaderContext. func toJsonClassLoaderContextRec(clcs []*ClassLoaderContext) map[string]*jsonClassLoaderContext { jClcs := make(map[string]*jsonClassLoaderContext, len(clcs)) for _, clc := range clcs { jClcs[clc.Name] = &jsonClassLoaderContext{ Host: clc.Host.String(), Device: clc.Device, Subcontexts: toJsonClassLoaderContextRec(clc.Subcontexts), } } return jClcs } dexpreopt/config.go +37 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ type ModuleConfig struct { ProfileBootListing android.OptionalPath EnforceUsesLibraries bool ProvidesUsesLibrary string // the name of the <uses-library> (usually the same as its module) ClassLoaderContexts ClassLoaderContextMap Archs []android.ArchType Loading Loading @@ -290,6 +291,42 @@ func ParseModuleConfig(ctx android.PathContext, data []byte) (*ModuleConfig, err return config.ModuleConfig, nil } // WriteSlimModuleConfigForMake serializes a subset of ModuleConfig into a per-module // dexpreopt.config JSON file. It is a way to pass dexpreopt information about Soong modules to // Make, which is needed when a Make module has a <uses-library> dependency on a Soong module. func WriteSlimModuleConfigForMake(ctx android.ModuleContext, config *ModuleConfig, path android.WritablePath) { if path == nil { return } // JSON representation of the slim module dexpreopt.config. type slimModuleJSONConfig struct { Name string DexLocation string BuildPath string EnforceUsesLibraries bool ProvidesUsesLibrary string ClassLoaderContexts jsonClassLoaderContextMap } jsonConfig := &slimModuleJSONConfig{ Name: config.Name, DexLocation: config.DexLocation, BuildPath: config.BuildPath.String(), EnforceUsesLibraries: config.EnforceUsesLibraries, ProvidesUsesLibrary: config.ProvidesUsesLibrary, ClassLoaderContexts: toJsonClassLoaderContext(config.ClassLoaderContexts), } data, err := json.MarshalIndent(jsonConfig, "", " ") if err != nil { ctx.ModuleErrorf("failed to JSON marshal module dexpreopt.config: %v", err) return } android.WriteFileRule(ctx, path, string(data)) } // dex2oatModuleName returns the name of the module to use for the dex2oat host // tool. It should be a binary module with public visibility that is compiled // and installed for host. Loading java/androidmk.go +4 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,10 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries { entries.SetString("LOCAL_MODULE_STEM", library.Stem()) entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports) if library.dexpreopter.configPath != nil { entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath) } }, }, }) Loading java/app.go +1 −0 Original line number Diff line number Diff line Loading @@ -455,6 +455,7 @@ func (a *AndroidApp) installPath(ctx android.ModuleContext) android.InstallPath func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path { a.dexpreopter.installPath = a.installPath(ctx) a.dexpreopter.isApp = true if a.dexProperties.Uncompress_dex == nil { // If the value was not force-set by the user, use reasonable default based on the module. a.dexProperties.Uncompress_dex = proptools.BoolPtr(a.shouldUncompressDex(ctx)) Loading java/app_import.go +1 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext installDir = android.PathForModuleInstall(ctx, "app", a.BaseModuleName()) } a.dexpreopter.isApp = true a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk") a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned) a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx) Loading Loading
dexpreopt/class_loader_context.go +23 −0 Original line number Diff line number Diff line Loading @@ -534,3 +534,26 @@ func fromJsonClassLoaderContextRec(ctx android.PathContext, jClcs map[string]*js } return clcs } // Convert Soong CLC map to JSON representation for Make. func toJsonClassLoaderContext(clcMap ClassLoaderContextMap) jsonClassLoaderContextMap { jClcMap := make(jsonClassLoaderContextMap) for sdkVer, clcs := range clcMap { sdkVerStr := fmt.Sprintf("%d", sdkVer) jClcMap[sdkVerStr] = toJsonClassLoaderContextRec(clcs) } return jClcMap } // Recursive helper for toJsonClassLoaderContext. func toJsonClassLoaderContextRec(clcs []*ClassLoaderContext) map[string]*jsonClassLoaderContext { jClcs := make(map[string]*jsonClassLoaderContext, len(clcs)) for _, clc := range clcs { jClcs[clc.Name] = &jsonClassLoaderContext{ Host: clc.Host.String(), Device: clc.Device, Subcontexts: toJsonClassLoaderContextRec(clc.Subcontexts), } } return jClcs }
dexpreopt/config.go +37 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ type ModuleConfig struct { ProfileBootListing android.OptionalPath EnforceUsesLibraries bool ProvidesUsesLibrary string // the name of the <uses-library> (usually the same as its module) ClassLoaderContexts ClassLoaderContextMap Archs []android.ArchType Loading Loading @@ -290,6 +291,42 @@ func ParseModuleConfig(ctx android.PathContext, data []byte) (*ModuleConfig, err return config.ModuleConfig, nil } // WriteSlimModuleConfigForMake serializes a subset of ModuleConfig into a per-module // dexpreopt.config JSON file. It is a way to pass dexpreopt information about Soong modules to // Make, which is needed when a Make module has a <uses-library> dependency on a Soong module. func WriteSlimModuleConfigForMake(ctx android.ModuleContext, config *ModuleConfig, path android.WritablePath) { if path == nil { return } // JSON representation of the slim module dexpreopt.config. type slimModuleJSONConfig struct { Name string DexLocation string BuildPath string EnforceUsesLibraries bool ProvidesUsesLibrary string ClassLoaderContexts jsonClassLoaderContextMap } jsonConfig := &slimModuleJSONConfig{ Name: config.Name, DexLocation: config.DexLocation, BuildPath: config.BuildPath.String(), EnforceUsesLibraries: config.EnforceUsesLibraries, ProvidesUsesLibrary: config.ProvidesUsesLibrary, ClassLoaderContexts: toJsonClassLoaderContext(config.ClassLoaderContexts), } data, err := json.MarshalIndent(jsonConfig, "", " ") if err != nil { ctx.ModuleErrorf("failed to JSON marshal module dexpreopt.config: %v", err) return } android.WriteFileRule(ctx, path, string(data)) } // dex2oatModuleName returns the name of the module to use for the dex2oat host // tool. It should be a binary module with public visibility that is compiled // and installed for host. Loading
java/androidmk.go +4 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,10 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries { entries.SetString("LOCAL_MODULE_STEM", library.Stem()) entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", library.linter.reports) if library.dexpreopter.configPath != nil { entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath) } }, }, }) Loading
java/app.go +1 −0 Original line number Diff line number Diff line Loading @@ -455,6 +455,7 @@ func (a *AndroidApp) installPath(ctx android.ModuleContext) android.InstallPath func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) android.Path { a.dexpreopter.installPath = a.installPath(ctx) a.dexpreopter.isApp = true if a.dexProperties.Uncompress_dex == nil { // If the value was not force-set by the user, use reasonable default based on the module. a.dexProperties.Uncompress_dex = proptools.BoolPtr(a.shouldUncompressDex(ctx)) Loading
java/app_import.go +1 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext installDir = android.PathForModuleInstall(ctx, "app", a.BaseModuleName()) } a.dexpreopter.isApp = true a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk") a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned) a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx) Loading