Generate the ART boot image for host as well (used by ART tests).

This will allow us to remove the core.art image compiled in make.

Test: lunch aosp_x86_64 && m test-art-host-gtest
Bug: 147817558
Bug: 147819342
Bug: 156649984
Change-Id: I864f72198d875dc1421c9c029a683bafbe7b71ac
Merged-In: I864f72198d875dc1421c9c029a683bafbe7b71ac
(cherry picked from commit 7f8dac1254615ba8122bc0d46c17e8258a722803)
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index f8356d1..ffce2a9 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -61,6 +61,10 @@
 			targets = append(targets, target)
 		}
 	}
+	// We may also need the images on host in order to run host-based tests.
+	for _, target := range ctx.Config().Targets[android.BuildOs] {
+		targets = append(targets, target)
+	}
 
 	return targets
 }
@@ -145,7 +149,7 @@
 			// expands to <stem>.art for primary image and <stem>-<1st module>.art for extension
 			imageName := c.firstModuleNameOrStem() + ".art"
 
-			c.imageLocations = []string{c.dir.Join(ctx, c.installSubdir, imageName).String()}
+			c.imageLocations = []string{c.dir.Join(ctx, "android", c.installSubdir, imageName).String()}
 
 			// The path to bootclasspath dex files needs to be known at module
 			// GenerateAndroidBuildAction time, before the bootclasspath modules have been compiled.
@@ -160,7 +164,7 @@
 			// Create target-specific variants.
 			for _, target := range targets {
 				arch := target.Arch.ArchType
-				imageDir := c.dir.Join(ctx, c.installSubdir, arch.String())
+				imageDir := c.dir.Join(ctx, target.Os.String(), c.installSubdir, arch.String())
 				variant := &bootImageVariant{
 					bootImageConfig: c,
 					target:          target,