From c68db4b305b9186d8d9b4e83b298a33fa810d06b Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 11 Nov 2021 18:59:15 -0800 Subject: [PATCH] Remove InstallBypassMake and ToMakePath InstallBypassMake and ToMakePath are obsolete, remove them. Bug: 204136549 Test: m checkbuild Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273 --- android/androidmk.go | 2 +- android/config.go | 9 --------- android/module.go | 22 +++------------------- android/module_test.go | 6 +----- android/paths.go | 20 ++++++-------------- android/paths_test.go | 5 ++--- android/rule_builder.go | 8 -------- android/test_suites.go | 2 +- apex/androidmk.go | 4 ++-- apex/apex.go | 4 ---- apex/apex_test.go | 15 +++++++++------ apex/prebuilt.go | 8 ++------ cc/androidmk.go | 4 ++-- cc/cc.go | 2 -- etc/prebuilt_etc.go | 2 +- etc/snapshot_etc.go | 2 +- filesystem/bootimg.go | 2 +- filesystem/filesystem.go | 2 +- filesystem/logical_partition.go | 2 +- filesystem/vbmeta.go | 2 +- java/androidmk.go | 2 +- java/app.go | 2 +- java/app_import.go | 2 -- java/classpath_fragment.go | 2 +- java/dexpreopt.go | 2 +- java/dexpreopt_check.go | 2 +- java/java.go | 2 -- java/platform_compat_config.go | 2 +- java/robolectric.go | 2 -- java/rro_test.go | 18 +++++++++++------- java/sdk_library.go | 2 +- linkerconfig/linkerconfig.go | 2 +- python/androidmk.go | 2 +- rust/androidmk.go | 2 +- rust/rust.go | 4 ---- sh/sh_binary.go | 6 +----- sh/sh_binary_test.go | 22 ++++++++++++++-------- snapshot/host_snapshot.go | 2 +- 38 files changed, 72 insertions(+), 129 deletions(-) diff --git a/android/androidmk.go b/android/androidmk.go index 4f6e24c18..72b6584ab 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -518,7 +518,7 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint a.AddStrings("LOCAL_TARGET_REQUIRED_MODULES", a.Target_required...) // If the install rule was generated by Soong tell Make about it. - if amod.InstallBypassMake() && len(base.katiInstalls) > 0 { + if len(base.katiInstalls) > 0 { // Assume the primary install file is last since it probably needs to depend on any other // installed files. If that is not the case we can add a method to specify the primary // installed file. diff --git a/android/config.go b/android/config.go index 5d90fd21d..bf79a03c9 100644 --- a/android/config.go +++ b/android/config.go @@ -569,9 +569,6 @@ func (c *config) HostToolDir() string { func (c *config) HostToolPath(ctx PathContext, tool string) Path { path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool) - if ctx.Config().KatiEnabled() { - path = path.ToMakePath() - } return path } @@ -581,17 +578,11 @@ func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path { ext = ".dylib" } path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext) - if ctx.Config().KatiEnabled() { - path = path.ToMakePath() - } return path } func (c *config) HostJavaToolPath(ctx PathContext, tool string) Path { path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "framework", false, tool) - if ctx.Config().KatiEnabled() { - path = path.ToMakePath() - } return path } diff --git a/android/module.go b/android/module.go index c479b596b..6de416535 100644 --- a/android/module.go +++ b/android/module.go @@ -429,7 +429,6 @@ type ModuleContext interface { InstallInRecovery() bool InstallInRoot() bool InstallInVendor() bool - InstallBypassMake() bool InstallForceOS() (*OsType, *ArchType) RequiredModuleNames() []string @@ -496,7 +495,6 @@ type Module interface { InstallInRecovery() bool InstallInRoot() bool InstallInVendor() bool - InstallBypassMake() bool InstallForceOS() (*OsType, *ArchType) HideFromMake() IsHideFromMake() bool @@ -1704,10 +1702,6 @@ func (m *ModuleBase) InstallInRoot() bool { return false } -func (m *ModuleBase) InstallBypassMake() bool { - return true -} - func (m *ModuleBase) InstallForceOS() (*OsType, *ArchType) { return nil, nil } @@ -2829,10 +2823,6 @@ func (m *moduleContext) InstallInRoot() bool { return m.module.InstallInRoot() } -func (m *moduleContext) InstallBypassMake() bool { - return m.module.InstallBypassMake() -} - func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) { return m.module.InstallForceOS() } @@ -2857,12 +2847,6 @@ func (m *moduleContext) skipInstall() bool { return true } - if m.Device() { - if m.Config().KatiEnabled() && !m.InstallBypassMake() { - return true - } - } - return false } @@ -2921,7 +2905,7 @@ func (m *moduleContext) installFile(installPath InstallPath, name string, srcPat orderOnlyDeps = deps } - if m.Config().KatiEnabled() && m.InstallBypassMake() { + if m.Config().KatiEnabled() { // When creating the install rule in Soong but embedding in Make, write the rule to a // makefile instead of directly to the ninja file so that main.mk can add the // dependencies from the `required` property that are hard to resolve in Soong. @@ -2980,7 +2964,7 @@ func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, src } if !m.skipInstall() { - if m.Config().KatiEnabled() && m.InstallBypassMake() { + if m.Config().KatiEnabled() { // When creating the symlink rule in Soong but embedding in Make, write the rule to a // makefile instead of directly to the ninja file so that main.mk can add the // dependencies from the `required` property that are hard to resolve in Soong. @@ -3026,7 +3010,7 @@ func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name str m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true) if !m.skipInstall() { - if m.Config().KatiEnabled() && m.InstallBypassMake() { + if m.Config().KatiEnabled() { // When creating the symlink rule in Soong but embedding in Make, write the rule to a // makefile instead of directly to the ninja file so that main.mk can add the // dependencies from the `required` property that are hard to resolve in Soong. diff --git a/android/module_test.go b/android/module_test.go index 8607a8d34..d9e2c87a4 100644 --- a/android/module_test.go +++ b/android/module_test.go @@ -204,10 +204,6 @@ type depsModule struct { } } -func (m *depsModule) InstallBypassMake() bool { - return true -} - func (m *depsModule) GenerateAndroidBuildActions(ctx ModuleContext) { outputFile := PathForModuleOut(ctx, ctx.ModuleName()) ctx.Build(pctx, BuildParams{ @@ -450,7 +446,7 @@ func TestInstall(t *testing.T) { assertOrderOnlys(symlinkRule("foo")) } -func TestInstallBypassMake(t *testing.T) { +func TestInstallKatiEnabled(t *testing.T) { if runtime.GOOS != "linux" { t.Skip("requires linux") } diff --git a/android/paths.go b/android/paths.go index e68106ce9..70e427b2a 100644 --- a/android/paths.go +++ b/android/paths.go @@ -112,7 +112,6 @@ type ModuleInstallPathContext interface { InstallInDebugRamdisk() bool InstallInRecovery() bool InstallInRoot() bool - InstallBypassMake() bool InstallForceOS() (*OsType, *ArchType) } @@ -465,9 +464,6 @@ func (p OutputPaths) Strings() []string { // PathForGoBinary returns the path to the installed location of a bootstrap_go_binary module. func PathForGoBinary(ctx PathContext, goBinary bootstrap.GoBinaryTool) Path { goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false) - if ctx.Config().KatiEnabled() { - goBinaryInstallDir = goBinaryInstallDir.ToMakePath() - } rel := Rel(ctx, goBinaryInstallDir.String(), goBinary.InstallPath()) return goBinaryInstallDir.Join(ctx, rel) } @@ -1646,8 +1642,8 @@ func (p InstallPath) withRel(rel string) InstallPath { return p } -// ToMakePath returns a new InstallPath that points to Make's install directory instead of Soong's, -// i.e. out/ instead of out/soong/. +// Deprecated: ToMakePath is a noop, PathForModuleInstall always returns Make paths when building +// embedded in Make. func (p InstallPath) ToMakePath() InstallPath { p.makePath = true return p @@ -1688,9 +1684,6 @@ func osAndArch(ctx ModuleInstallPathContext) (OsType, ArchType) { func makePathForInstall(ctx ModuleInstallPathContext, os OsType, arch ArchType, partition string, debug bool, pathComponents ...string) InstallPath { ret := pathForInstall(ctx, os, arch, partition, debug, pathComponents...) - if ctx.InstallBypassMake() && ctx.Config().KatiEnabled() { - ret = ret.ToMakePath() - } return ret } @@ -1732,7 +1725,10 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, soongOutDir: ctx.Config().soongOutDir, partitionDir: partionPath, partition: partition, - makePath: false, + } + + if ctx.Config().KatiEnabled() { + base.makePath = true } return base.Join(ctx, pathComponents...) @@ -2008,10 +2004,6 @@ func (m testModuleInstallPathContext) InstallInRoot() bool { return m.inRoot } -func (m testModuleInstallPathContext) InstallBypassMake() bool { - return false -} - func (m testModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) { return m.forceOS, m.forceArch } diff --git a/android/paths_test.go b/android/paths_test.go index 3cad8529d..2f87977a9 100644 --- a/android/paths_test.go +++ b/android/paths_test.go @@ -1486,7 +1486,8 @@ func TestPathRelativeToTop(t *testing.T) { AssertPathRelativeToTopEquals(t, "install path for soong", "out/soong/target/product/test_device/system/install/path", p) }) t.Run("install for make", func(t *testing.T) { - p := PathForModuleInstall(ctx, "install/path").ToMakePath() + p := PathForModuleInstall(ctx, "install/path") + p.makePath = true AssertPathRelativeToTopEquals(t, "install path for make", "out/target/product/test_device/system/install/path", p) }) t.Run("output", func(t *testing.T) { @@ -1500,14 +1501,12 @@ func TestPathRelativeToTop(t *testing.T) { t.Run("mixture", func(t *testing.T) { paths := Paths{ PathForModuleInstall(ctx, "install/path"), - PathForModuleInstall(ctx, "install/path").ToMakePath(), PathForOutput(ctx, "output/path"), PathForSource(ctx, "source/path"), } expected := []string{ "out/soong/target/product/test_device/system/install/path", - "out/target/product/test_device/system/install/path", "out/soong/output/path", "source/path", } diff --git a/android/rule_builder.go b/android/rule_builder.go index f8de5fb96..1c6b1c086 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -839,14 +839,6 @@ func sboxPathForToolRel(ctx BuilderContext, path Path) string { // The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out return filepath.Join(sboxToolsSubDir, "out", relOutSoong) } - if ctx.Config().KatiEnabled() { - toolDir = toolDir.ToMakePath() - relOut, isRelOut, _ := maybeRelErr(toolDir.String(), path.String()) - if isRelOut { - // The tool is in the Make output directory, it will be copied to __SBOX_OUT_DIR__/tools/out - return filepath.Join(sboxToolsSubDir, "out", relOut) - } - } // The tool is in the source directory, it will be copied to __SBOX_OUT_DIR__/tools/src return filepath.Join(sboxToolsSubDir, "src", path.String()) } diff --git a/android/test_suites.go b/android/test_suites.go index 22f6cf229..55e1da79c 100644 --- a/android/test_suites.go +++ b/android/test_suites.go @@ -60,7 +60,7 @@ func robolectricTestSuite(ctx SingletonContext, files map[string]InstallPaths) W for _, module := range SortedStringKeys(files) { installedPaths = append(installedPaths, files[module]...) } - testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases", false).ToMakePath() + testCasesDir := pathForInstall(ctx, ctx.Config().BuildOS, X86, "testcases", false) outputFile := PathForOutput(ctx, "packaging", "robolectric-tests.zip") rule := NewRuleBuilder(pctx, ctx) diff --git a/apex/androidmk.go b/apex/androidmk.go index f001fa265..8cca137a0 100644 --- a/apex/androidmk.go +++ b/apex/androidmk.go @@ -149,7 +149,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo var modulePath string if apexType == flattenedApex { // /system/apex//{lib|framework|...} - modulePath = filepath.Join(a.installDir.ToMakePath().String(), apexBundleName, fi.installDir) + modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir) fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath) if a.primaryApexType && !symbolFilesNotNeeded { fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated) @@ -362,7 +362,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData { data.Entries.WriteLicenseVariables(w) fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC") // do we need a new class? fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", a.outputFile.String()) - fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.ToMakePath().String()) + fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", a.installDir.String()) stemSuffix := apexType.suffix() if a.isCompressed { stemSuffix = imageCapexSuffix diff --git a/apex/apex.go b/apex/apex.go index b7faa5b98..09b6daabd 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -458,10 +458,6 @@ type apexBundle struct { modulePaths []string } -func (*apexBundle) InstallBypassMake() bool { - return true -} - // apexFileClass represents a type of file that can be included in APEX. type apexFileClass int diff --git a/apex/apex_test.go b/apex/apex_test.go index a749ea161..d580d7fd9 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -2657,7 +2657,10 @@ func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) { } func TestVendorApex(t *testing.T) { - ctx := testApex(t, ` + result := android.GroupFixturePreparers( + prepareForApexTest, + android.FixtureModifyConfig(android.SetKatiEnabledForTests), + ).RunTestWithBp(t, ` apex { name: "myapex", key: "myapex.key", @@ -2681,24 +2684,24 @@ func TestVendorApex(t *testing.T) { } `) - ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{ + ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{ "bin/mybin", "lib64/libfoo.so", // TODO(b/159195575): Add an option to use VNDK libs from VNDK APEX "lib64/libc++.so", }) - apexBundle := ctx.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) - data := android.AndroidMkDataForTest(t, ctx, apexBundle) + apexBundle := result.ModuleForTests("myapex", "android_common_myapex_image").Module().(*apexBundle) + data := android.AndroidMkDataForTest(t, result.TestContext, apexBundle) name := apexBundle.BaseModuleName() prefix := "TARGET_" var builder strings.Builder data.Custom(&builder, name, prefix, "", data) - androidMk := android.StringRelativeToTop(ctx.Config(), builder.String()) + androidMk := android.StringRelativeToTop(result.Config, builder.String()) installPath := "out/target/product/test_device/vendor/apex" ensureContains(t, androidMk, "LOCAL_MODULE_PATH := "+installPath) - apexManifestRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule") + apexManifestRule := result.ModuleForTests("myapex", "android_common_myapex_image").Rule("apexManifestRule") requireNativeLibs := names(apexManifestRule.Args["requireNativeLibs"]) ensureListNotContains(t, requireNativeLibs, ":vndk") } diff --git a/apex/prebuilt.go b/apex/prebuilt.go index 254c90ec0..02d807516 100644 --- a/apex/prebuilt.go +++ b/apex/prebuilt.go @@ -222,7 +222,7 @@ func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries { Host_required: p.hostRequired, ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", p.installDir.String()) entries.SetString("LOCAL_MODULE_STEM", p.installFilename) entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", p.installedFile) entries.SetString("LOCAL_SOONG_INSTALL_PAIRS", p.outputApex.String()+":"+p.installedFile.String()) @@ -256,7 +256,7 @@ func (p *prebuiltCommon) createEntriesForApexFile(fi apexFile, apexName string) Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", p.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", p.installDir.String()) entries.SetString("LOCAL_SOONG_INSTALLED_MODULE", filepath.Join(p.installDir.String(), fi.stem())) entries.SetString("LOCAL_SOONG_INSTALL_PAIRS", fi.builtFile.String()+":"+filepath.Join(p.installDir.String(), fi.stem())) @@ -472,10 +472,6 @@ type Prebuilt struct { inputApex android.Path } -func (p *Prebuilt) InstallBypassMake() bool { - return true -} - type ApexFileProperties struct { // the path to the prebuilt .apex file to import. // diff --git a/cc/androidmk.go b/cc/androidmk.go index 636bab81e..800b58f33 100644 --- a/cc/androidmk.go +++ b/cc/androidmk.go @@ -453,7 +453,7 @@ func (installer *baseInstaller) AndroidMkEntries(ctx AndroidMkContext, entries * } entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - path, file := filepath.Split(installer.path.ToMakePath().String()) + path, file := filepath.Split(installer.path.String()) stem, suffix, _ := android.SplitFileExt(file) entries.SetString("LOCAL_MODULE_SUFFIX", suffix) entries.SetString("LOCAL_MODULE_PATH", path) @@ -532,7 +532,7 @@ func (c *snapshotLibraryDecorator) AndroidMkEntries(ctx AndroidMkContext, entrie c.libraryDecorator.androidMkWriteExportedFlags(entries) if c.shared() || c.static() { - path, file := filepath.Split(c.path.ToMakePath().String()) + path, file := filepath.Split(c.path.String()) stem, suffix, ext := android.SplitFileExt(file) entries.SetString("LOCAL_BUILT_MODULE_STEM", "$(LOCAL_MODULE)"+ext) entries.SetString("LOCAL_MODULE_SUFFIX", suffix) diff --git a/cc/cc.go b/cc/cc.go index 5c4edb94d..730041c0a 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -1385,8 +1385,6 @@ func (c *Module) InstallInRoot() bool { return c.installer != nil && c.installer.installInRoot() } -func (c *Module) InstallBypassMake() bool { return true } - type baseModuleContext struct { android.BaseModuleContext moduleContextImpl diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go index 80ab41be6..c2866abfa 100644 --- a/etc/prebuilt_etc.go +++ b/etc/prebuilt_etc.go @@ -376,7 +376,7 @@ func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetString("LOCAL_MODULE_TAGS", "optional") - entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base()) if len(p.properties.Symlinks) > 0 { entries.AddStrings("LOCAL_MODULE_SYMLINKS", p.properties.Symlinks...) diff --git a/etc/snapshot_etc.go b/etc/snapshot_etc.go index 9a25d5a72..b54a8a6ec 100644 --- a/etc/snapshot_etc.go +++ b/etc/snapshot_etc.go @@ -128,7 +128,7 @@ func (p *SnapshotEtc) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetString("LOCAL_MODULE_TAGS", "optional") - entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base()) }, }, diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index 73d807dbf..fc973a4dc 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -267,7 +267,7 @@ func (b *bootimg) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(b.output), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", b.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", b.installDir.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", b.installFileName()) }, }, diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index b2caa51d2..079625895 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -394,7 +394,7 @@ func (f *filesystem) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(f.output), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", f.installDir.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName()) }, }, diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go index 739e609ed..e2f7d7bdf 100644 --- a/filesystem/logical_partition.go +++ b/filesystem/logical_partition.go @@ -215,7 +215,7 @@ func (l *logicalPartition) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(l.output), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", l.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", l.installDir.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.installFileName()) }, }, diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index 3f16c0d71..63e0abaac 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -247,7 +247,7 @@ func (v *vbmeta) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(v.output), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", v.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", v.installDir.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", v.installFileName()) }, }, diff --git a/java/androidmk.go b/java/androidmk.go index 272a4fd36..2284e4849 100644 --- a/java/androidmk.go +++ b/java/androidmk.go @@ -685,7 +685,7 @@ func (r *RuntimeResourceOverlay) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString()) - entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath()) + entries.SetPath("LOCAL_MODULE_PATH", r.installDir) entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...) }, }, diff --git a/java/app.go b/java/app.go index b753c0cb8..1c69aeb7a 100755 --- a/java/app.go +++ b/java/app.go @@ -485,7 +485,7 @@ func (a *AndroidApp) jniBuildActions(jniLibs []jniLib, ctx android.ModuleContext a.jniLibs = jniLibs if a.shouldEmbedJnis(ctx) { jniJarFile = android.PathForModuleOut(ctx, "jnilibs.zip") - a.installPathForJNISymbols = a.installPath(ctx).ToMakePath() + a.installPathForJNISymbols = a.installPath(ctx) TransformJniLibsToJar(ctx, jniJarFile, jniLibs, a.useEmbeddedNativeLibs(ctx)) for _, jni := range jniLibs { if jni.coverageFile.Valid() { diff --git a/java/app_import.go b/java/app_import.go index 4d1969ebb..3e5f972a4 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -108,8 +108,6 @@ func (a *AndroidAppImport) IsInstallable() bool { return true } -func (a *AndroidAppImport) InstallBypassMake() bool { return true } - // Updates properties with variant-specific values. func (a *AndroidAppImport) processVariants(ctx android.LoadHookContext) { config := ctx.Config() diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go index e77971b13..ca2752877 100644 --- a/java/classpath_fragment.go +++ b/java/classpath_fragment.go @@ -204,7 +204,7 @@ func (c *ClasspathFragmentBase) androidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(c.outputFilepath), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", c.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", c.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", c.outputFilepath.Base()) }, }, diff --git a/java/dexpreopt.go b/java/dexpreopt.go index f3a53eed9..a715aadd7 100644 --- a/java/dexpreopt.go +++ b/java/dexpreopt.go @@ -381,7 +381,7 @@ func (d *dexpreopter) AndroidMkEntriesForApex() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(install.outputPathOnHost), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", install.installDirOnDevice.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", install.installDirOnDevice.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", install.installFileOnDevice) entries.SetString("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", "false") }, diff --git a/java/dexpreopt_check.go b/java/dexpreopt_check.go index 565901d35..4d0bc5997 100644 --- a/java/dexpreopt_check.go +++ b/java/dexpreopt_check.go @@ -59,7 +59,7 @@ func dexpreoptSystemserverCheckFactory() android.SingletonModule { func getInstallPath(ctx android.ModuleContext, location string) android.InstallPath { return android.PathForModuleInPartitionInstall( - ctx, "", strings.TrimPrefix(location, "/")).ToMakePath() + ctx, "", strings.TrimPrefix(location, "/")) } func (m *dexpreoptSystemserverCheck) GenerateAndroidBuildActions(ctx android.ModuleContext) { diff --git a/java/java.go b/java/java.go index f77c694ba..35b5ec31b 100644 --- a/java/java.go +++ b/java/java.go @@ -267,8 +267,6 @@ func (j *Module) XrefJavaFiles() android.Paths { return j.kytheFiles } -func (j *Module) InstallBypassMake() bool { return true } - type dependencyTag struct { blueprint.BaseDependencyTag name string diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go index 0d8ebac02..f442ddfd4 100644 --- a/java/platform_compat_config.go +++ b/java/platform_compat_config.go @@ -115,7 +115,7 @@ func (p *platformCompatConfig) AndroidMkEntries() []android.AndroidMkEntries { Include: "$(BUILD_PREBUILT)", ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.configFile.Base()) }, }, diff --git a/java/robolectric.go b/java/robolectric.go index 16af546ba..f71952172 100644 --- a/java/robolectric.go +++ b/java/robolectric.go @@ -352,7 +352,6 @@ func RobolectricTestFactory() android.Module { return module } -func (r *robolectricTest) InstallBypassMake() bool { return true } func (r *robolectricTest) InstallInTestcases() bool { return true } func (r *robolectricTest) InstallForceOS() (*android.OsType, *android.ArchType) { return &r.forceOSType, &r.forceArchType @@ -430,7 +429,6 @@ func (r *robolectricRuntimes) GenerateAndroidBuildActions(ctx android.ModuleCont } } -func (r *robolectricRuntimes) InstallBypassMake() bool { return true } func (r *robolectricRuntimes) InstallInTestcases() bool { return true } func (r *robolectricRuntimes) InstallForceOS() (*android.OsType, *android.ArchType) { return &r.forceOSType, &r.forceArchType diff --git a/java/rro_test.go b/java/rro_test.go index 27abbe4f3..be0d7ba47 100644 --- a/java/rro_test.go +++ b/java/rro_test.go @@ -62,6 +62,7 @@ func TestRuntimeResourceOverlay(t *testing.T) { result := android.GroupFixturePreparers( PrepareForTestWithJavaDefaultModules, PrepareForTestWithOverlayBuildComponents, + android.FixtureModifyConfig(android.SetKatiEnabledForTests), fs.AddToFixture(), ).RunTestWithBp(t, bp) @@ -127,7 +128,10 @@ func TestRuntimeResourceOverlay(t *testing.T) { } func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { - ctx, config := testJava(t, ` + result := android.GroupFixturePreparers( + PrepareForTestWithJavaDefaultModules, + android.FixtureModifyConfig(android.SetKatiEnabledForTests), + ).RunTestWithBp(t, ` java_defaults { name: "rro_defaults", theme: "default_theme", @@ -148,7 +152,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { // // RRO module with defaults // - m := ctx.ModuleForTests("foo_with_defaults", "android_common") + m := result.ModuleForTests("foo_with_defaults", "android_common") // Check AAPT2 link flags. aapt2Flags := strings.Split(m.Output("package-res.apk").Args["flags"], " ") @@ -159,14 +163,14 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { } // Check device location. - path := android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] + path := android.AndroidMkEntriesForTest(t, result.TestContext, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] expectedPath := []string{shared.JoinPath("out/target/product/test_device/product/overlay/default_theme")} - android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path) + android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", result.Config, expectedPath, path) // // RRO module without defaults // - m = ctx.ModuleForTests("foo_barebones", "android_common") + m = result.ModuleForTests("foo_barebones", "android_common") // Check AAPT2 link flags. aapt2Flags = strings.Split(m.Output("package-res.apk").Args["flags"], " ") @@ -176,9 +180,9 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { } // Check device location. - path = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] + path = android.AndroidMkEntriesForTest(t, result.TestContext, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] expectedPath = []string{shared.JoinPath("out/target/product/test_device/product/overlay")} - android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path) + android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", result.Config, expectedPath, path) } func TestOverrideRuntimeResourceOverlay(t *testing.T) { diff --git a/java/sdk_library.go b/java/sdk_library.go index de0d796cc..b8ab69abb 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -2641,7 +2641,7 @@ func (module *sdkLibraryXml) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetString("LOCAL_MODULE_TAGS", "optional") - entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", module.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", module.outputFilePath.Base()) }, }, diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go index 8d0ad7cf2..dbc112e5a 100644 --- a/linkerconfig/linkerconfig.go +++ b/linkerconfig/linkerconfig.go @@ -155,7 +155,7 @@ func (l *linkerConfig) AndroidMkEntries() []android.AndroidMkEntries { OutputFile: android.OptionalPathForPath(l.outputFilePath), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", l.installDirPath.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", l.outputFilePath.Base()) entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !installable) entries.SetString("LINKER_CONFIG_PATH_"+l.Name(), l.OutputFile().String()) diff --git a/python/androidmk.go b/python/androidmk.go index ccc85ec6a..233d8679f 100644 --- a/python/androidmk.go +++ b/python/androidmk.go @@ -78,7 +78,7 @@ func (installer *pythonInstaller) AndroidMk(base *Module, entries *android.Andro entries.Required = append(entries.Required, "libc++") entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - path, file := filepath.Split(installer.path.ToMakePath().String()) + path, file := filepath.Split(installer.path.String()) stem := strings.TrimSuffix(file, filepath.Ext(file)) entries.SetString("LOCAL_MODULE_SUFFIX", filepath.Ext(file)) diff --git a/rust/androidmk.go b/rust/androidmk.go index 1f18b4a12..4e5863215 100644 --- a/rust/androidmk.go +++ b/rust/androidmk.go @@ -193,7 +193,7 @@ func (compiler *baseCompiler) AndroidMk(ctx AndroidMkContext, ret *android.Andro ret.ExtraEntries = append(ret.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { entries.SetPath("LOCAL_SOONG_UNSTRIPPED_BINARY", compiler.unstrippedOutputFile) - path, file := filepath.Split(compiler.path.ToMakePath().String()) + path, file := filepath.Split(compiler.path.String()) stem, suffix, _ := android.SplitFileExt(file) entries.SetString("LOCAL_MODULE_SUFFIX", suffix) entries.SetString("LOCAL_MODULE_PATH", path) diff --git a/rust/rust.go b/rust/rust.go index 300c0f57a..c2585f2a7 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -1312,10 +1312,6 @@ func (mod *Module) InstallInRecovery() bool { return mod.InRecovery() } -func (mod *Module) InstallBypassMake() bool { - return true -} - func linkPathFromFilePath(filepath android.Path) string { return strings.Split(filepath.String(), filepath.Base())[0] } diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 2d98e8be0..e1df8ac59 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -166,10 +166,6 @@ type ShBinary struct { var _ android.HostToolProvider = (*ShBinary)(nil) -func (s *ShBinary) InstallBypassMake() bool { - return true -} - type ShTest struct { ShBinary @@ -435,7 +431,7 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries { ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { s.customAndroidMkEntries(entries) - entries.SetPath("LOCAL_MODULE_PATH", s.installDir.ToMakePath()) + entries.SetPath("LOCAL_MODULE_PATH", s.installDir) entries.AddCompatibilityTestSuites(s.testProperties.Test_suites...) if s.testConfig != nil { entries.SetPath("LOCAL_FULL_TEST_CONFIG", s.testConfig) diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go index 865d5f3d1..28b6fb93a 100644 --- a/sh/sh_binary_test.go +++ b/sh/sh_binary_test.go @@ -42,7 +42,10 @@ func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config } func TestShTestSubDir(t *testing.T) { - ctx, config := testShBinary(t, ` + result := android.GroupFixturePreparers( + prepareForShTest, + android.FixtureModifyConfig(android.SetKatiEnabledForTests), + ).RunTestWithBp(t, ` sh_test { name: "foo", src: "test.sh", @@ -50,17 +53,20 @@ func TestShTestSubDir(t *testing.T) { } `) - mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) + mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) - entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] + entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0] expectedPath := "out/target/product/test_device/data/nativetest64/foo_test" actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] - android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", config, expectedPath, actualPath) + android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", result.Config, expectedPath, actualPath) } func TestShTest(t *testing.T) { - ctx, config := testShBinary(t, ` + result := android.GroupFixturePreparers( + prepareForShTest, + android.FixtureModifyConfig(android.SetKatiEnabledForTests), + ).RunTestWithBp(t, ` sh_test { name: "foo", src: "test.sh", @@ -72,13 +78,13 @@ func TestShTest(t *testing.T) { } `) - mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) + mod := result.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest) - entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] + entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0] expectedPath := "out/target/product/test_device/data/nativetest64/foo" actualPath := entries.EntryMap["LOCAL_MODULE_PATH"][0] - android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", config, expectedPath, actualPath) + android.AssertStringPathRelativeToTopEquals(t, "LOCAL_MODULE_PATH[0]", result.Config, expectedPath, actualPath) expectedData := []string{":testdata/data1", ":testdata/sub/data2"} actualData := entries.EntryMap["LOCAL_TEST_DATA"] diff --git a/snapshot/host_snapshot.go b/snapshot/host_snapshot.go index 2a25a00e5..252cef816 100644 --- a/snapshot/host_snapshot.go +++ b/snapshot/host_snapshot.go @@ -180,7 +180,7 @@ func (f *hostSnapshot) AndroidMkEntries() []android.AndroidMkEntries { DistFiles: android.MakeDefaultDistFiles(f.zipFile.Path()), ExtraEntries: []android.AndroidMkExtraEntriesFunc{ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { - entries.SetString("LOCAL_MODULE_PATH", f.installDir.ToMakePath().String()) + entries.SetString("LOCAL_MODULE_PATH", f.installDir.String()) entries.SetString("LOCAL_INSTALLED_MODULE_STEM", f.installFileName()) }, },