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

Commit 30c6f178 authored by Jiakai Zhang's avatar Jiakai Zhang Committed by Automerger Merge Worker
Browse files

Unify installDirOnHost and installDirOnDevice. am: 7ba1ca0a am: 6c7f9464

parents 62bbcfe1 6c7f9464
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -250,11 +250,12 @@ type bootImageConfig struct {
	// Output directory for the image files with debug symbols.
	symbolsDir android.OutputPath

	// Subdirectory where the image files are installed.
	installDirOnHost string

	// Subdirectory where the image files on device are installed.
	installDirOnDevice string
	// The relative location where the image files are installed. On host, the location is relative to
	// $ANDROID_PRODUCT_OUT.
	//
	// Only the configs that are built by platform_bootclasspath are installable on device. On device,
	// the location is relative to "/".
	installDir string

	// Install path of the boot image profile if it needs to be installed in the APEX, or empty if not
	// needed.
@@ -668,9 +669,9 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p

	arch := image.target.Arch.ArchType
	os := image.target.Os.String() // We need to distinguish host-x86 and device-x86.
	symbolsDir := image.symbolsDir.Join(ctx, os, image.installDirOnHost, arch.String())
	symbolsDir := image.symbolsDir.Join(ctx, os, image.installDir, arch.String())
	symbolsFile := symbolsDir.Join(ctx, image.stem+".oat")
	outputDir := image.dir.Join(ctx, os, image.installDirOnHost, arch.String())
	outputDir := image.dir.Join(ctx, os, image.installDir, arch.String())
	outputPath := outputDir.Join(ctx, image.stem+".oat")
	oatLocation := dexpreopt.PathToLocation(outputPath, arch)
	imagePath := outputPath.ReplaceExtension(ctx, "art")
@@ -796,7 +797,7 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p

	cmd.Textf(`|| ( echo %s ; false )`, proptools.ShellEscape(failureMessage))

	installDir := filepath.Join("/", image.installDirOnHost, arch.String())
	installDir := filepath.Dir(image.imagePathOnDevice)

	var vdexInstalls android.RuleBuilderInstalls
	var unstrippedInstalls android.RuleBuilderInstalls
+11 −14
Original line number Diff line number Diff line
@@ -62,8 +62,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
		artCfg := bootImageConfig{
			name:                     artBootImageName,
			stem:                     bootImageStem,
			installDirOnHost:         "apex/art_boot_images/javalib",
			installDirOnDevice:       frameworkSubdir,
			installDir:               "apex/art_boot_images/javalib",
			profileInstallPathInApex: "etc/boot-image.prof",
			modules:                  artModules,
			preloadedClassesFile:     "art/build/boot/preloaded-classes",
@@ -77,8 +76,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
			extends:              &artCfg,
			name:                 frameworkBootImageName,
			stem:                 bootImageStem,
			installDirOnHost:     frameworkSubdir,
			installDirOnDevice:   frameworkSubdir,
			installDir:           frameworkSubdir,
			modules:              frameworkModules,
			preloadedClassesFile: "frameworks/base/config/preloaded-classes",
			compilerFilter:       "speed-profile",
@@ -89,8 +87,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
			extends:        &frameworkCfg,
			name:           mainlineBootImageName,
			stem:           bootImageStem,
			installDirOnHost:   frameworkSubdir,
			installDirOnDevice: frameworkSubdir,
			installDir:     frameworkSubdir,
			modules:        mainlineBcpModules,
			compilerFilter: "verify",
			singleImage:    true,
@@ -132,12 +129,12 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
			// Create target-specific variants.
			for _, target := range targets {
				arch := target.Arch.ArchType
				imageDir := c.dir.Join(ctx, target.Os.String(), c.installDirOnHost, arch.String())
				imageDir := c.dir.Join(ctx, target.Os.String(), c.installDir, arch.String())
				variant := &bootImageVariant{
					bootImageConfig:   c,
					target:            target,
					imagePathOnHost:   imageDir.Join(ctx, imageName),
					imagePathOnDevice: filepath.Join("/", c.installDirOnDevice, arch.String(), imageName),
					imagePathOnDevice: filepath.Join("/", c.installDir, arch.String(), imageName),
					imagesDeps:        c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"),
					dexLocations:      c.modules.DevicePaths(ctx.Config(), target.Os),
				}
+12 −17
Original line number Diff line number Diff line
@@ -147,8 +147,7 @@ type expectedConfig struct {
	stem                     string
	dir                      string
	symbolsDir               string
	installDirOnDevice       string
	installDirOnHost         string
	installDir               string
	profileInstallPathInApex string
	modules                  android.ConfiguredJarList
	dexPaths                 []string
@@ -209,8 +208,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_artjars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_artjars_unstripped",
		installDirOnDevice:       "system/framework",
		installDirOnHost:         "apex/art_boot_images/javalib",
		installDir:               "apex/art_boot_images/javalib",
		profileInstallPathInApex: "etc/boot-image.prof",
		modules:                  android.CreateTestConfiguredJarList([]string{"com.android.art:core1", "com.android.art:core2"}),
		dexPaths:                 []string{"out/soong/dexpreopt_arm64/dex_artjars_input/core1.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/core2.jar"},
@@ -222,7 +220,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
				dexLocations:      []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
				dexLocationsDeps:  []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
				imagePathOnHost:   "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art",
				imagePathOnDevice: "/system/framework/arm64/boot.art",
				imagePathOnDevice: "/apex/art_boot_images/javalib/arm64/boot.art",
				imagesDeps: []string{
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art",
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat",
@@ -276,7 +274,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
				dexLocations:      []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
				dexLocationsDeps:  []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
				imagePathOnHost:   "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art",
				imagePathOnDevice: "/system/framework/arm/boot.art",
				imagePathOnDevice: "/apex/art_boot_images/javalib/arm/boot.art",
				imagesDeps: []string{
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art",
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat",
@@ -330,7 +328,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
				dexLocations:      []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
				dexLocationsDeps:  []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
				imagePathOnHost:   "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art",
				imagePathOnDevice: "/system/framework/x86_64/boot.art",
				imagePathOnDevice: "/apex/art_boot_images/javalib/x86_64/boot.art",
				imagesDeps: []string{
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art",
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat",
@@ -382,7 +380,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
				dexLocations:      []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
				dexLocationsDeps:  []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
				imagePathOnHost:   "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art",
				imagePathOnDevice: "/system/framework/x86/boot.art",
				imagePathOnDevice: "/apex/art_boot_images/javalib/x86/boot.art",
				imagesDeps: []string{
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art",
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat",
@@ -462,8 +460,7 @@ func checkFrameworkBootImageConfig(t *testing.T, result *android.TestResult, mut
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_bootjars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_bootjars_unstripped",
		installDirOnDevice:       "system/framework",
		installDirOnHost:         "system/framework",
		installDir:               "system/framework",
		profileInstallPathInApex: "",
		modules:                  android.CreateTestConfiguredJarList([]string{"platform:framework"}),
		dexPaths:                 []string{"out/soong/dexpreopt_arm64/dex_bootjars_input/framework.jar"},
@@ -693,8 +690,7 @@ func CheckMainlineBootImageConfig(t *testing.T, result *android.TestResult) {
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_mainlinejars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped",
		installDirOnDevice:       "system/framework",
		installDirOnHost:         "system/framework",
		installDir:               "system/framework",
		profileInstallPathInApex: "",
		modules: android.CreateTestConfiguredJarList([]string{
			"com.android.foo:framework-foo",
@@ -999,8 +995,7 @@ func nestedCheckBootImageConfig(t *testing.T, imageConfig *bootImageConfig, expe
	android.AssertStringEquals(t, "stem", expected.stem, imageConfig.stem)
	android.AssertPathRelativeToTopEquals(t, "dir", expected.dir, imageConfig.dir)
	android.AssertPathRelativeToTopEquals(t, "symbolsDir", expected.symbolsDir, imageConfig.symbolsDir)
	android.AssertStringEquals(t, "installDirOnDevice", expected.installDirOnDevice, imageConfig.installDirOnDevice)
	android.AssertStringEquals(t, "installDirOnHost", expected.installDirOnHost, imageConfig.installDirOnHost)
	android.AssertStringEquals(t, "installDir", expected.installDir, imageConfig.installDir)
	android.AssertStringEquals(t, "profileInstallPathInApex", expected.profileInstallPathInApex, imageConfig.profileInstallPathInApex)
	android.AssertDeepEquals(t, "modules", expected.modules, imageConfig.modules)
	android.AssertPathsRelativeToTopEquals(t, "dexPaths", expected.dexPaths, imageConfig.dexPaths.Paths())
@@ -1096,9 +1091,9 @@ DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm=out/soong/.intermediates/framework
DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86_64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEart=/system/framework/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEboot=/system/framework/boot.art:/system/framework/boot-framework.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEmainline=/system/framework/boot.art:/system/framework/boot-framework.art:/system/framework/boot-framework-foo.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEart=/apex/art_boot_images/javalib/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEboot=/apex/art_boot_images/javalib/boot.art:/system/framework/boot-framework.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEmainline=/apex/art_boot_images/javalib/boot.art:/system/framework/boot-framework.art:/system/framework/boot-framework-foo.art
DEXPREOPT_IMAGE_LOCATIONS_ON_HOSTart=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_HOSTboot=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/boot.art:out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/boot-framework.art
DEXPREOPT_IMAGE_LOCATIONS_ON_HOSTmainline=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/boot.art:out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/boot-framework.art:out/soong/dexpreopt_arm64/dex_mainlinejars/android/system/framework/boot-framework-foo.art
+2 −2
Original line number Diff line number Diff line
@@ -610,9 +610,9 @@ func FixtureModifyBootImageConfig(name string, configModifier func(*bootImageCon
	})
}

// Sets the value of `installDirOnDevice` of the boot image config with the given name.
// Sets the value of `installDir` of the boot image config with the given name.
func FixtureSetBootImageInstallDirOnDevice(name string, installDir string) android.FixturePreparer {
	return FixtureModifyBootImageConfig(name, func(config *bootImageConfig) {
		config.installDirOnDevice = installDir
		config.installDir = installDir
	})
}