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

Commit a6c4ff2c authored by Mathieu Chartier's avatar Mathieu Chartier Committed by Gerrit Code Review
Browse files

Merge "Revert "Remove option to create boot image based on preloaded classes""

parents e2a8e7f0 d3f688b5
Loading
Loading
Loading
Loading
+11 −5
Original line number Original line Diff line number Diff line
@@ -80,7 +80,9 @@ type GlobalConfig struct {


	// Only used for boot image
	// Only used for boot image
	DirtyImageObjects      android.OptionalPath // path to a dirty-image-objects file
	DirtyImageObjects      android.OptionalPath // path to a dirty-image-objects file
	PreloadedClasses       android.OptionalPath // path to a preloaded-classes file
	BootImageProfiles      android.Paths        // path to a boot-image-profile.txt file
	BootImageProfiles      android.Paths        // path to a boot-image-profile.txt file
	UseProfileForBootImage bool                 // whether a profile should be used to compile the boot image
	BootFlags              string               // extra flags to pass to dex2oat for the boot image
	BootFlags              string               // extra flags to pass to dex2oat for the boot image
	Dex2oatImageXmx        string               // max heap size for dex2oat for the boot image
	Dex2oatImageXmx        string               // max heap size for dex2oat for the boot image
	Dex2oatImageXms        string               // initial heap size for dex2oat for the boot image
	Dex2oatImageXms        string               // initial heap size for dex2oat for the boot image
@@ -181,6 +183,7 @@ func LoadGlobalConfig(ctx android.PathContext, path string) (GlobalConfig, []byt
		// Copies of entries in GlobalConfig that are not constructable without extra parameters.  They will be
		// Copies of entries in GlobalConfig that are not constructable without extra parameters.  They will be
		// used to construct the real value manually below.
		// used to construct the real value manually below.
		DirtyImageObjects string
		DirtyImageObjects string
		PreloadedClasses  string
		BootImageProfiles []string
		BootImageProfiles []string


		Tools struct {
		Tools struct {
@@ -203,6 +206,7 @@ func LoadGlobalConfig(ctx android.PathContext, path string) (GlobalConfig, []byt


	// Construct paths that require a PathContext.
	// Construct paths that require a PathContext.
	config.GlobalConfig.DirtyImageObjects = android.OptionalPathForPath(constructPath(ctx, config.DirtyImageObjects))
	config.GlobalConfig.DirtyImageObjects = android.OptionalPathForPath(constructPath(ctx, config.DirtyImageObjects))
	config.GlobalConfig.PreloadedClasses = android.OptionalPathForPath(constructPath(ctx, config.PreloadedClasses))
	config.GlobalConfig.BootImageProfiles = constructPaths(ctx, config.BootImageProfiles)
	config.GlobalConfig.BootImageProfiles = constructPaths(ctx, config.BootImageProfiles)


	config.GlobalConfig.Tools.Profman = constructPath(ctx, config.Tools.Profman)
	config.GlobalConfig.Tools.Profman = constructPath(ctx, config.Tools.Profman)
@@ -317,7 +321,9 @@ func GlobalConfigForTests(ctx android.PathContext) GlobalConfig {
		CpuVariant:                         nil,
		CpuVariant:                         nil,
		InstructionSetFeatures:             nil,
		InstructionSetFeatures:             nil,
		DirtyImageObjects:                  android.OptionalPath{},
		DirtyImageObjects:                  android.OptionalPath{},
		PreloadedClasses:                   android.OptionalPath{},
		BootImageProfiles:                  nil,
		BootImageProfiles:                  nil,
		UseProfileForBootImage:             false,
		BootFlags:                          "",
		BootFlags:                          "",
		Dex2oatImageXmx:                    "",
		Dex2oatImageXmx:                    "",
		Dex2oatImageXms:                    "",
		Dex2oatImageXms:                    "",
+3 −1
Original line number Original line Diff line number Diff line
@@ -286,6 +286,8 @@ func buildBootImageRuleForArch(ctx android.SingletonContext, image *bootImage,
	if profile != nil {
	if profile != nil {
		cmd.FlagWithArg("--compiler-filter=", "speed-profile")
		cmd.FlagWithArg("--compiler-filter=", "speed-profile")
		cmd.FlagWithInput("--profile-file=", profile)
		cmd.FlagWithInput("--profile-file=", profile)
	} else if global.PreloadedClasses.Valid() {
		cmd.FlagWithInput("--image-classes=", global.PreloadedClasses.Path())
	}
	}


	if global.DirtyImageObjects.Valid() {
	if global.DirtyImageObjects.Valid() {
@@ -372,7 +374,7 @@ Rebuild with ART_BOOT_IMAGE_EXTRA_ARGS="--runtime-arg -verbose:verifier" to see
func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missingDeps []string) android.WritablePath {
func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missingDeps []string) android.WritablePath {
	global := dexpreoptGlobalConfig(ctx)
	global := dexpreoptGlobalConfig(ctx)


	if ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
	if !global.UseProfileForBootImage || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
		return nil
		return nil
	}
	}
	return ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
	return ctx.Config().Once(bootImageProfileRuleKey, func() interface{} {
+0 −1
Original line number Original line Diff line number Diff line
@@ -62,7 +62,6 @@ func TestDexpreoptBootJars(t *testing.T) {
	bootArt := dexpreoptBootJars.Output("boot.art")
	bootArt := dexpreoptBootJars.Output("boot.art")


	expectedInputs := []string{
	expectedInputs := []string{
		"dex_bootjars/boot.prof",
		"dex_bootjars_input/foo.jar",
		"dex_bootjars_input/foo.jar",
		"dex_bootjars_input/bar.jar",
		"dex_bootjars_input/bar.jar",
		"dex_bootjars_input/baz.jar",
		"dex_bootjars_input/baz.jar",