diff options
| author | 2019-11-07 16:12:13 +0000 | |
|---|---|---|
| committer | 2019-11-07 16:23:47 +0000 | |
| commit | bf0e47648ab6cba10e10d07693bf0c813905396c (patch) | |
| tree | 66b4a36410a0b37a6946fbe909fa27fa00a398fd /java | |
| parent | 66b3e99649bc1ddae670cc9028d7c85e7787078f (diff) | |
Revert^3 "Package dexpreopt artifacts for libcore jars in the ART apex."
Reason for revert: breaks the coverage build.
Exempt-From-Owner-Approval: revert
Change-Id: I4c3db7b085b101738813a7f3da6f0078bbaa587b
Diffstat (limited to 'java')
| -rw-r--r-- | java/dexpreopt_bootjars.go | 53 | ||||
| -rw-r--r-- | java/dexpreopt_bootjars_test.go | 1 | ||||
| -rw-r--r-- | java/dexpreopt_config.go | 48 |
3 files changed, 37 insertions, 65 deletions
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index dbf61151a..74ef6673c 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -51,7 +51,6 @@ func init() { type bootImageConfig struct { name string - stem string modules []string dexLocations []string dexPaths android.WritablePaths @@ -72,7 +71,7 @@ func (image bootImageConfig) moduleFiles(ctx android.PathContext, dir android.Ou // In addition, each .art file has an associated .oat and .vdex file, and an // unstripped .oat file for i, m := range image.modules { - name := image.stem + name := image.name if i != 0 { name += "-" + stemOf(m) } @@ -147,14 +146,6 @@ type dexpreoptBootJars struct { dexpreoptConfigForMake android.WritablePath } -// Accessor function for the apex package. Returns nil if dexpreopt is disabled. -func DexpreoptedArtApexJars(ctx android.BuilderContext) map[android.ArchType]android.Paths { - if skipDexpreoptBootJars(ctx) { - return nil - } - return artBootImageConfig(ctx).imagesDeps -} - // dexpreoptBoot singleton rules func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) { if skipDexpreoptBootJars(ctx) { @@ -178,10 +169,7 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) { // Always create the default boot image first, to get a unique profile rule for all images. d.defaultBootImage = buildBootImage(ctx, defaultBootImageConfig(ctx)) - // Create boot image for the ART apex (build artifacts are accessed via the global boot image config). - buildBootImage(ctx, artBootImageConfig(ctx)) if global.GenerateApexImage { - // Create boot images for the JIT-zygote experiment. d.otherImages = append(d.otherImages, buildBootImage(ctx, apexBootImageConfig(ctx))) } @@ -190,6 +178,8 @@ func (d *dexpreoptBootJars) GenerateBuildActions(ctx android.SingletonContext) { // buildBootImage takes a bootImageConfig, creates rules to build it, and returns a *bootImage. func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootImage { + global := dexpreoptGlobalConfig(ctx) + image := newBootImage(ctx, config) bootDexJars := make(android.Paths, len(image.modules)) @@ -233,9 +223,12 @@ func buildBootImage(ctx android.SingletonContext, config bootImageConfig) *bootI bootFrameworkProfileRule(ctx, image, missingDeps) var allFiles android.Paths - for _, target := range image.targets { - files := buildBootImageRuleForArch(ctx, image, target.Arch.ArchType, profile, missingDeps) - allFiles = append(allFiles, files.Paths()...) + + if !global.DisablePreopt { + for _, target := range image.targets { + files := buildBootImageRuleForArch(ctx, image, target.Arch.ArchType, profile, missingDeps) + allFiles = append(allFiles, files.Paths()...) + } } if image.zip != nil { @@ -258,7 +251,7 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage, global := dexpreoptGlobalConfig(ctx) symbolsDir := image.symbolsDir.Join(ctx, "system/framework", arch.String()) - symbolsFile := symbolsDir.Join(ctx, image.stem+".oat") + symbolsFile := symbolsDir.Join(ctx, image.name+".oat") outputDir := image.dir.Join(ctx, "system/framework", arch.String()) outputPath := image.images[arch] oatLocation := pathtools.ReplaceExtension(dexpreopt.PathToLocation(outputPath, arch), "oat") @@ -388,9 +381,8 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() { return nil } - profile := ctx.Config().Once(bootImageProfileRuleKey, func() interface{} { + return ctx.Config().Once(bootImageProfileRuleKey, func() interface{} { tools := global.Tools - defaultProfile := "frameworks/base/config/boot-image-profile.txt" rule := android.NewRuleBuilder() rule.MissingDeps(missingDeps) @@ -402,13 +394,18 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin bootImageProfile = combinedBootImageProfile } else if len(global.BootImageProfiles) == 1 { bootImageProfile = global.BootImageProfiles[0] - } else if path := android.ExistentPathForSource(ctx, defaultProfile); path.Valid() { - bootImageProfile = path.Path() } else { - // No profile (not even a default one, which is the case on some branches - // like master-art-host that don't have frameworks/base). - // Return nil and continue without profile. - return nil + // If not set, use the default. Some branches like master-art-host don't have frameworks/base, so manually + // handle the case that the default is missing. Those branches won't attempt to build the profile rule, + // and if they do they'll get a missing deps error. + defaultProfile := "frameworks/base/config/boot-image-profile.txt" + path := android.ExistentPathForSource(ctx, defaultProfile) + if path.Valid() { + bootImageProfile = path.Path() + } else { + missingDeps = append(missingDeps, defaultProfile) + bootImageProfile = android.PathForOutput(ctx, "missing") + } } profile := image.dir.Join(ctx, "boot.prof") @@ -428,11 +425,7 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missin image.profileInstalls = rule.Installs() return profile - }) - if profile == nil { - return nil // wrap nil into a typed pointer with value nil - } - return profile.(android.WritablePath) + }).(android.WritablePath) } var bootImageProfileRuleKey = android.NewOnceKey("bootImageProfileRule") diff --git a/java/dexpreopt_bootjars_test.go b/java/dexpreopt_bootjars_test.go index a684ab232..244bd5249 100644 --- a/java/dexpreopt_bootjars_test.go +++ b/java/dexpreopt_bootjars_test.go @@ -62,6 +62,7 @@ func TestDexpreoptBootJars(t *testing.T) { bootArt := dexpreoptBootJars.Output("boot.art") expectedInputs := []string{ + "dex_bootjars/boot.prof", "dex_bootjars_input/foo.jar", "dex_bootjars_input/bar.jar", "dex_bootjars_input/baz.jar", diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go index a6661b33d..b3b1317ca 100644 --- a/java/dexpreopt_config.go +++ b/java/dexpreopt_config.go @@ -106,20 +106,15 @@ func stemOf(moduleName string) string { return moduleName } -// Construct a variant of the global config for dexpreopted bootclasspath jars. The variants differ -// in the list of input jars (libcore, framework, or both), in the naming scheme for the dexpreopt -// files (ART recognizes "apex" names as special), and whether to include a zip archive. -// -// 'name' is a string unique for each profile (used in directory names and ninja rule names) -// 'stem' is the basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}. -func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string, stem string, - needZip bool, artApexJarsOnly bool) bootImageConfig { - +func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name string, + needZip bool) bootImageConfig { return ctx.Config().Once(key, func() interface{} { global := dexpreoptGlobalConfig(ctx) artModules := global.ArtApexJars - imageModules := artModules + nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules) + frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules) + imageModules := concat(artModules, frameworkModules) var bootLocations []string @@ -128,15 +123,9 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin filepath.Join("/apex/com.android.art/javalib", stemOf(m)+".jar")) } - if !artApexJarsOnly { - nonFrameworkModules := concat(artModules, global.ProductUpdatableBootModules) - frameworkModules := android.RemoveListFromList(global.BootJars, nonFrameworkModules) - imageModules = concat(imageModules, frameworkModules) - - for _, m := range frameworkModules { - bootLocations = append(bootLocations, - filepath.Join("/system/framework", stemOf(m)+".jar")) - } + for _, m := range frameworkModules { + bootLocations = append(bootLocations, + filepath.Join("/system/framework", stemOf(m)+".jar")) } // The path to bootclasspath dex files needs to be known at module GenerateAndroidBuildAction time, before @@ -154,14 +143,13 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin var zip android.WritablePath if needZip { - zip = dir.Join(ctx, stem+".zip") + zip = dir.Join(ctx, name+".zip") } targets := dexpreoptTargets(ctx) imageConfig := bootImageConfig{ name: name, - stem: stem, modules: imageModules, dexLocations: bootLocations, dexPaths: bootDexPaths, @@ -175,7 +163,7 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin for _, target := range targets { imageDir := dir.Join(ctx, "system/framework", target.Arch.ArchType.String()) - imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, stem+".art") + imageConfig.images[target.Arch.ArchType] = imageDir.Join(ctx, name+".art") imagesDeps := make([]android.Path, 0, len(imageConfig.modules)*3) for _, dep := range imageConfig.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex") { @@ -188,25 +176,15 @@ func getBootImageConfig(ctx android.PathContext, key android.OnceKey, name strin }).(bootImageConfig) } -// Default config is the one that goes in the system image. It includes both libcore and framework. var defaultBootImageConfigKey = android.NewOnceKey("defaultBootImageConfig") +var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig") func defaultBootImageConfig(ctx android.PathContext) bootImageConfig { - return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", "boot", true, false) + return getBootImageConfig(ctx, defaultBootImageConfigKey, "boot", true) } -// Apex config is used for the JIT-zygote experiment. It includes both libcore and framework, but AOT-compiles only libcore. -var apexBootImageConfigKey = android.NewOnceKey("apexBootImageConfig") - func apexBootImageConfig(ctx android.PathContext) bootImageConfig { - return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", "apex", false, false) -} - -// ART config is the one used for the ART apex. It includes only libcore. -var artBootImageConfigKey = android.NewOnceKey("artBootImageConfig") - -func artBootImageConfig(ctx android.PathContext) bootImageConfig { - return getBootImageConfig(ctx, artBootImageConfigKey, "art", "boot", false, true) + return getBootImageConfig(ctx, apexBootImageConfigKey, "apex", false) } func defaultBootclasspath(ctx android.PathContext) []string { |