Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b879620c authored by Jiakai Zhang's avatar Jiakai Zhang
Browse files

Revert^2 "Generate a boot image extension for mainline BCP...

Revert submission 2465993-boot-image-mainline-revert

Reason for revert: Relanding the changes

Reverted changes: /q/submissionid:2465993-boot-image-mainline-revert

Change-Id: Ie611cf3a1ff4be7a7beab164f69b4186c474be5c
parent da4a78bf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -293,6 +293,12 @@ func (d *dexpreopter) dexpreopt(ctx android.ModuleContext, dexJarFile android.Wr
	isSystemServerJar := global.AllSystemServerJars(ctx).ContainsJar(moduleName(ctx))

	bootImage := defaultBootImageConfig(ctx)
	// When `global.PreoptWithUpdatableBcp` is true, `bcpForDexpreopt` below includes the mainline
	// boot jars into bootclasspath, so we should include the mainline boot image as well because it's
	// generated from those jars.
	if global.PreoptWithUpdatableBcp {
		bootImage = mainlineBootImageConfig(ctx)
	}
	dexFiles, dexLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp)

	targets := ctx.MultiTargets()
+10 −0
Original line number Diff line number Diff line
@@ -291,6 +291,9 @@ type bootImageConfig struct {

	// The "--compiler-filter" argument.
	compilerFilter string

	// The "--single-image" argument.
	singleImage bool
}

// Target-dependent description of a boot image.
@@ -398,6 +401,9 @@ func (image bootImageConfig) moduleFiles(ctx android.PathContext, dir android.Ou
		for _, ext := range exts {
			ret = append(ret, dir.Join(ctx, name+ext))
		}
		if image.singleImage {
			break
		}
	}
	return ret
}
@@ -768,6 +774,10 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p
		cmd.FlagWithArg("--compiler-filter=", image.compilerFilter)
	}

	if image.singleImage {
		cmd.Flag("--single-image")
	}

	// Use the default variant/features for host builds.
	// The map below contains only device CPU info (which might be x86 on some devices).
	if image.target.Os == android.Android {
+25 −4
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ var (
	bootImageConfigRawKey  = android.NewOnceKey("bootImageConfigRaw")
	artBootImageName       = "art"
	frameworkBootImageName = "boot"
	mainlineBootImageName  = "mainline"
	bootImageStem          = "boot"
)

func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig {
@@ -52,37 +54,52 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig

		artModules := global.ArtApexJars
		frameworkModules := global.BootJars.RemoveList(artModules)
		mainlineBcpModules := global.ApexBootJars
		frameworkSubdir := "system/framework"

		// ART config for the primary boot image in the ART apex.
		// It includes the Core Libraries.
		artCfg := bootImageConfig{
			name:                     artBootImageName,
			stem:                     "boot",
			stem:                     bootImageStem,
			installDirOnHost:         "apex/art_boot_images/javalib",
			installDirOnDevice:       "system/framework",
			installDirOnDevice:       frameworkSubdir,
			profileInstallPathInApex: "etc/boot-image.prof",
			modules:                  artModules,
			preloadedClassesFile:     "art/build/boot/preloaded-classes",
			compilerFilter:           "speed-profile",
			singleImage:              false,
		}

		// Framework config for the boot image extension.
		// It includes framework libraries and depends on the ART config.
		frameworkSubdir := "system/framework"
		frameworkCfg := bootImageConfig{
			extends:              &artCfg,
			name:                 frameworkBootImageName,
			stem:                 "boot",
			stem:                 bootImageStem,
			installDirOnHost:     frameworkSubdir,
			installDirOnDevice:   frameworkSubdir,
			modules:              frameworkModules,
			preloadedClassesFile: "frameworks/base/config/preloaded-classes",
			compilerFilter:       "speed-profile",
			singleImage:          false,
		}

		mainlineCfg := bootImageConfig{
			extends:            &frameworkCfg,
			name:               mainlineBootImageName,
			stem:               bootImageStem,
			installDirOnHost:   frameworkSubdir,
			installDirOnDevice: frameworkSubdir,
			modules:            mainlineBcpModules,
			compilerFilter:     "verify",
			singleImage:        true,
		}

		return map[string]*bootImageConfig{
			artBootImageName:       &artCfg,
			frameworkBootImageName: &frameworkCfg,
			mainlineBootImageName:  &mainlineCfg,
		}
	}).(map[string]*bootImageConfig)
}
@@ -174,6 +191,10 @@ func defaultBootImageConfig(ctx android.PathContext) *bootImageConfig {
	return genBootImageConfigs(ctx)[frameworkBootImageName]
}

func mainlineBootImageConfig(ctx android.PathContext) *bootImageConfig {
	return genBootImageConfigs(ctx)[mainlineBootImageName]
}

// Apex boot config allows to access build/install paths of apex boot jars without going
// through the usual trouble of registering dependencies on those modules and extracting build paths
// from those dependencies.
+2 −0
Original line number Diff line number Diff line
@@ -28,8 +28,10 @@ func TestBootImageConfig(t *testing.T) {

	result := android.GroupFixturePreparers(
		PrepareForBootImageConfigTest,
		PrepareApexBootJarConfigs,
	).RunTest(t)

	CheckArtBootImageConfig(t, result)
	CheckFrameworkBootImageConfig(t, result)
	CheckMainlineBootImageConfig(t, result)
}
+384 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading