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

Commit 6c7f9464 authored by Jiakai Zhang's avatar Jiakai Zhang Committed by Automerger Merge Worker
Browse files

Unify installDirOnHost and installDirOnDevice. am: 7ba1ca0a

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


	// Subdirectory where the image files are installed.
	// The relative location where the image files are installed. On host, the location is relative to
	installDirOnHost string
	// $ANDROID_PRODUCT_OUT.

	//
	// Subdirectory where the image files on device are installed.
	// Only the configs that are built by platform_bootclasspath are installable on device. On device,
	installDirOnDevice string
	// 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
	// Install path of the boot image profile if it needs to be installed in the APEX, or empty if not
	// needed.
	// needed.
@@ -668,9 +669,9 @@ func buildBootImageVariant(ctx android.ModuleContext, image *bootImageVariant, p


	arch := image.target.Arch.ArchType
	arch := image.target.Arch.ArchType
	os := image.target.Os.String() // We need to distinguish host-x86 and device-x86.
	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")
	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")
	outputPath := outputDir.Join(ctx, image.stem+".oat")
	oatLocation := dexpreopt.PathToLocation(outputPath, arch)
	oatLocation := dexpreopt.PathToLocation(outputPath, arch)
	imagePath := outputPath.ReplaceExtension(ctx, "art")
	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))
	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 vdexInstalls android.RuleBuilderInstalls
	var unstrippedInstalls android.RuleBuilderInstalls
	var unstrippedInstalls android.RuleBuilderInstalls
+11 −14
Original line number Original line Diff line number Diff line
@@ -62,8 +62,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
		artCfg := bootImageConfig{
		artCfg := bootImageConfig{
			name:                     artBootImageName,
			name:                     artBootImageName,
			stem:                     bootImageStem,
			stem:                     bootImageStem,
			installDirOnHost:         "apex/art_boot_images/javalib",
			installDir:               "apex/art_boot_images/javalib",
			installDirOnDevice:       frameworkSubdir,
			profileInstallPathInApex: "etc/boot-image.prof",
			profileInstallPathInApex: "etc/boot-image.prof",
			modules:                  artModules,
			modules:                  artModules,
			preloadedClassesFile:     "art/build/boot/preloaded-classes",
			preloadedClassesFile:     "art/build/boot/preloaded-classes",
@@ -77,8 +76,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
			extends:              &artCfg,
			extends:              &artCfg,
			name:                 frameworkBootImageName,
			name:                 frameworkBootImageName,
			stem:                 bootImageStem,
			stem:                 bootImageStem,
			installDirOnHost:     frameworkSubdir,
			installDir:           frameworkSubdir,
			installDirOnDevice:   frameworkSubdir,
			modules:              frameworkModules,
			modules:              frameworkModules,
			preloadedClassesFile: "frameworks/base/config/preloaded-classes",
			preloadedClassesFile: "frameworks/base/config/preloaded-classes",
			compilerFilter:       "speed-profile",
			compilerFilter:       "speed-profile",
@@ -89,8 +87,7 @@ func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig
			extends:        &frameworkCfg,
			extends:        &frameworkCfg,
			name:           mainlineBootImageName,
			name:           mainlineBootImageName,
			stem:           bootImageStem,
			stem:           bootImageStem,
			installDirOnHost:   frameworkSubdir,
			installDir:     frameworkSubdir,
			installDirOnDevice: frameworkSubdir,
			modules:        mainlineBcpModules,
			modules:        mainlineBcpModules,
			compilerFilter: "verify",
			compilerFilter: "verify",
			singleImage:    true,
			singleImage:    true,
@@ -132,12 +129,12 @@ func genBootImageConfigs(ctx android.PathContext) map[string]*bootImageConfig {
			// Create target-specific variants.
			// Create target-specific variants.
			for _, target := range targets {
			for _, target := range targets {
				arch := target.Arch.ArchType
				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{
				variant := &bootImageVariant{
					bootImageConfig:   c,
					bootImageConfig:   c,
					target:            target,
					target:            target,
					imagePathOnHost:   imageDir.Join(ctx, imageName),
					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"),
					imagesDeps:        c.moduleFiles(ctx, imageDir, ".art", ".oat", ".vdex"),
					dexLocations:      c.modules.DevicePaths(ctx.Config(), target.Os),
					dexLocations:      c.modules.DevicePaths(ctx.Config(), target.Os),
				}
				}
+12 −17
Original line number Original line Diff line number Diff line
@@ -147,8 +147,7 @@ type expectedConfig struct {
	stem                     string
	stem                     string
	dir                      string
	dir                      string
	symbolsDir               string
	symbolsDir               string
	installDirOnDevice       string
	installDir               string
	installDirOnHost         string
	profileInstallPathInApex string
	profileInstallPathInApex string
	modules                  android.ConfiguredJarList
	modules                  android.ConfiguredJarList
	dexPaths                 []string
	dexPaths                 []string
@@ -209,8 +208,7 @@ func checkArtBootImageConfig(t *testing.T, result *android.TestResult, mutated b
		stem:                     "boot",
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_artjars",
		dir:                      "out/soong/dexpreopt_arm64/dex_artjars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_artjars_unstripped",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_artjars_unstripped",
		installDirOnDevice:       "system/framework",
		installDir:               "apex/art_boot_images/javalib",
		installDirOnHost:         "apex/art_boot_images/javalib",
		profileInstallPathInApex: "etc/boot-image.prof",
		profileInstallPathInApex: "etc/boot-image.prof",
		modules:                  android.CreateTestConfiguredJarList([]string{"com.android.art:core1", "com.android.art:core2"}),
		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"},
		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"},
				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"},
				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",
				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{
				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.art",
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat",
					"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"},
				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"},
				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",
				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{
				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.art",
					"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat",
					"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"},
				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"},
				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",
				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{
				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.art",
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat",
					"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"},
				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"},
				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",
				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{
				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.art",
					"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat",
					"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",
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_bootjars",
		dir:                      "out/soong/dexpreopt_arm64/dex_bootjars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_bootjars_unstripped",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_bootjars_unstripped",
		installDirOnDevice:       "system/framework",
		installDir:               "system/framework",
		installDirOnHost:         "system/framework",
		profileInstallPathInApex: "",
		profileInstallPathInApex: "",
		modules:                  android.CreateTestConfiguredJarList([]string{"platform:framework"}),
		modules:                  android.CreateTestConfiguredJarList([]string{"platform:framework"}),
		dexPaths:                 []string{"out/soong/dexpreopt_arm64/dex_bootjars_input/framework.jar"},
		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",
		stem:                     "boot",
		dir:                      "out/soong/dexpreopt_arm64/dex_mainlinejars",
		dir:                      "out/soong/dexpreopt_arm64/dex_mainlinejars",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped",
		symbolsDir:               "out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped",
		installDirOnDevice:       "system/framework",
		installDir:               "system/framework",
		installDirOnHost:         "system/framework",
		profileInstallPathInApex: "",
		profileInstallPathInApex: "",
		modules: android.CreateTestConfiguredJarList([]string{
		modules: android.CreateTestConfiguredJarList([]string{
			"com.android.foo:framework-foo",
			"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.AssertStringEquals(t, "stem", expected.stem, imageConfig.stem)
	android.AssertPathRelativeToTopEquals(t, "dir", expected.dir, imageConfig.dir)
	android.AssertPathRelativeToTopEquals(t, "dir", expected.dir, imageConfig.dir)
	android.AssertPathRelativeToTopEquals(t, "symbolsDir", expected.symbolsDir, imageConfig.symbolsDir)
	android.AssertPathRelativeToTopEquals(t, "symbolsDir", expected.symbolsDir, imageConfig.symbolsDir)
	android.AssertStringEquals(t, "installDirOnDevice", expected.installDirOnDevice, imageConfig.installDirOnDevice)
	android.AssertStringEquals(t, "installDir", expected.installDir, imageConfig.installDir)
	android.AssertStringEquals(t, "installDirOnHost", expected.installDirOnHost, imageConfig.installDirOnHost)
	android.AssertStringEquals(t, "profileInstallPathInApex", expected.profileInstallPathInApex, imageConfig.profileInstallPathInApex)
	android.AssertStringEquals(t, "profileInstallPathInApex", expected.profileInstallPathInApex, imageConfig.profileInstallPathInApex)
	android.AssertDeepEquals(t, "modules", expected.modules, imageConfig.modules)
	android.AssertDeepEquals(t, "modules", expected.modules, imageConfig.modules)
	android.AssertPathsRelativeToTopEquals(t, "dexPaths", expected.dexPaths, imageConfig.dexPaths.Paths())
	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_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=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_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_DEVICEart=/apex/art_boot_images/javalib/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEboot=/system/framework/boot.art:/system/framework/boot-framework.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEboot=/apex/art_boot_images/javalib/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_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_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_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
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 Original line 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 {
func FixtureSetBootImageInstallDirOnDevice(name string, installDir string) android.FixturePreparer {
	return FixtureModifyBootImageConfig(name, func(config *bootImageConfig) {
	return FixtureModifyBootImageConfig(name, func(config *bootImageConfig) {
		config.installDirOnDevice = installDir
		config.installDir = installDir
	})
	})
}
}