Move dexpreopting of boot jars into Soong

Implement the dexpreopting of boot jars in singleton rules in
Soong.

Test: m checkbuild
Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index c7f0638..0eb162d 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -34,11 +34,12 @@
 
 	DisableGenerateProfile bool // don't generate profiles
 
-	PreoptBootClassPathDexFiles     []string // file paths of boot class path files
-	PreoptBootClassPathDexLocations []string // virtual locations of boot class path files
+	BootJars []string // modules for jars that form the boot class path
 
-	BootJars         []string // modules for jars that form the boot class path
-	PreoptBootJars   []string // modules for jars that form the boot image
+	TargetCoreJars                []string // modules for jars that are in the runtime apex
+	ProductUpdatableBootModules   []string
+	ProductUpdatableBootLocations []string
+
 	SystemServerJars []string // jars that form the system server
 	SystemServerApps []string // apps that are loaded into system server
 	SpeedApps        []string // apps that should be speed optimized
@@ -64,15 +65,22 @@
 
 	DefaultAppImages bool // build app images (TODO: .art files?) by default
 
-	Dex2oatXmx string // max heap size
-	Dex2oatXms string // initial heap size
+	Dex2oatXmx string // max heap size for dex2oat
+	Dex2oatXms string // initial heap size for dex2oat
 
 	EmptyDirectory string // path to an empty directory
 
-	DefaultDexPreoptImage  map[android.ArchType]string // default boot image location for each architecture
 	CpuVariant             map[android.ArchType]string // cpu variant for each architecture
 	InstructionSetFeatures map[android.ArchType]string // instruction set for each architecture
 
+	// Only used for boot image
+	DirtyImageObjects string   // path to a dirty-image-objects file
+	PreloadedClasses  string   // path to a preloaded-classes file
+	BootImageProfiles []string // path to a boot-image-profile.txt file
+	BootFlags         string   // extra flags to pass to 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
+
 	Tools Tools // paths to tools possibly used by the generated commands
 }
 
@@ -109,6 +117,9 @@
 	Archs           []android.ArchType
 	DexPreoptImages []string
 
+	PreoptBootClassPathDexFiles     []string // file paths of boot class path files
+	PreoptBootClassPathDexLocations []string // virtual locations of boot class path files
+
 	PreoptExtractedApk bool // Overrides OnlyPreoptModules
 
 	NoCreateAppImage    bool
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 68bd3ea..eacb86a 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -199,9 +199,6 @@
 			pathtools.ReplaceExtension(filepath.Base(path), "odex"))
 	}
 
-	bcp := strings.Join(global.PreoptBootClassPathDexFiles, ":")
-	bcp_locations := strings.Join(global.PreoptBootClassPathDexLocations, ":")
-
 	odexPath := toOdexPath(filepath.Join(filepath.Dir(module.BuildPath), base))
 	odexInstallPath := toOdexPath(module.DexLocation)
 	if odexOnSystemOther(module, global) {
@@ -320,9 +317,8 @@
 		FlagWithOutput("--write-invocation-to=", invocationPath).ImplicitOutput(invocationPath).
 		Flag("--runtime-arg").FlagWithArg("-Xms", global.Dex2oatXms).
 		Flag("--runtime-arg").FlagWithArg("-Xmx", global.Dex2oatXmx).
-		Flag("--runtime-arg").FlagWithArg("-Xbootclasspath:", bcp).
-		Implicits(global.PreoptBootClassPathDexFiles).
-		Flag("--runtime-arg").FlagWithArg("-Xbootclasspath-locations:", bcp_locations).
+		Flag("--runtime-arg").FlagWithInputList("-Xbootclasspath:", module.PreoptBootClassPathDexFiles, ":").
+		Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
 		Flag("${class_loader_context_arg}").
 		Flag("${stored_class_loader_context_arg}").
 		FlagWithArg("--boot-image=", bootImageLocation).Implicit(bootImage).
diff --git a/dexpreopt/dexpreopt_test.go b/dexpreopt/dexpreopt_test.go
index 40c694f..a2c6f77 100644
--- a/dexpreopt/dexpreopt_test.go
+++ b/dexpreopt/dexpreopt_test.go
@@ -29,6 +29,9 @@
 	PatternsOnSystemOther:              nil,
 	DisableGenerateProfile:             false,
 	BootJars:                           nil,
+	TargetCoreJars:                     nil,
+	ProductUpdatableBootModules:        nil,
+	ProductUpdatableBootLocations:      nil,
 	SystemServerJars:                   nil,
 	SystemServerApps:                   nil,
 	SpeedApps:                          nil,
@@ -49,9 +52,14 @@
 	Dex2oatXmx:                         "",
 	Dex2oatXms:                         "",
 	EmptyDirectory:                     "",
-	DefaultDexPreoptImage:              nil,
 	CpuVariant:                         nil,
 	InstructionSetFeatures:             nil,
+	DirtyImageObjects:                  "",
+	PreloadedClasses:                   "",
+	BootImageProfiles:                  nil,
+	BootFlags:                          "",
+	Dex2oatImageXmx:                    "",
+	Dex2oatImageXms:                    "",
 	Tools: Tools{
 		Profman:             "profman",
 		Dex2oat:             "dex2oat",
@@ -64,28 +72,30 @@
 }
 
 var testModuleConfig = ModuleConfig{
-	Name:                  "",
-	DexLocation:           "",
-	BuildPath:             "",
-	DexPath:               "",
-	UncompressedDex:       false,
-	HasApkLibraries:       false,
-	PreoptFlags:           nil,
-	ProfileClassListing:   "",
-	ProfileIsTextListing:  false,
-	EnforceUsesLibraries:  false,
-	OptionalUsesLibraries: nil,
-	UsesLibraries:         nil,
-	LibraryPaths:          nil,
-	Archs:                 []android.ArchType{android.Arm},
-	DexPreoptImages:       []string{"system/framework/arm/boot.art"},
-	PreoptExtractedApk:    false,
-	NoCreateAppImage:      false,
-	ForceCreateAppImage:   false,
-	PresignedPrebuilt:     false,
-	NoStripping:           false,
-	StripInputPath:        "",
-	StripOutputPath:       "",
+	Name:                            "",
+	DexLocation:                     "",
+	BuildPath:                       "",
+	DexPath:                         "",
+	UncompressedDex:                 false,
+	HasApkLibraries:                 false,
+	PreoptFlags:                     nil,
+	ProfileClassListing:             "",
+	ProfileIsTextListing:            false,
+	EnforceUsesLibraries:            false,
+	OptionalUsesLibraries:           nil,
+	UsesLibraries:                   nil,
+	LibraryPaths:                    nil,
+	Archs:                           []android.ArchType{android.Arm},
+	DexPreoptImages:                 []string{"system/framework/arm/boot.art"},
+	PreoptBootClassPathDexFiles:     nil,
+	PreoptBootClassPathDexLocations: nil,
+	PreoptExtractedApk:              false,
+	NoCreateAppImage:                false,
+	ForceCreateAppImage:             false,
+	PresignedPrebuilt:               false,
+	NoStripping:                     false,
+	StripInputPath:                  "",
+	StripOutputPath:                 "",
 }
 
 func TestDexPreopt(t *testing.T) {