Remove InstallBypassMake and ToMakePath

InstallBypassMake and ToMakePath are obsolete, remove them.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie5a6f7254b3d317ed6039e114ed6aec35e1ce273
This commit is contained in:
Colin Cross
2021-11-11 18:59:15 -08:00
parent e23a32bdc5
commit c68db4b305
38 changed files with 72 additions and 129 deletions

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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.

View File

@@ -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")
}

View File

@@ -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
}

View File

@@ -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",
}

View File

@@ -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())
}

View File

@@ -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)

View File

@@ -149,7 +149,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
var modulePath string
if apexType == flattenedApex {
// /system/apex/<name>/{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

View File

@@ -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

View File

@@ -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")
}

View File

@@ -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.
//

View File

@@ -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)

View File

@@ -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

View File

@@ -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...)

View File

@@ -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())
},
},

View File

@@ -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())
},
},

View File

@@ -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())
},
},

View File

@@ -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())
},
},

View File

@@ -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())
},
},

View File

@@ -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...)
},
},

View File

@@ -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() {

View File

@@ -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()

View File

@@ -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())
},
},

View File

@@ -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")
},

View File

@@ -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) {

View File

@@ -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

View File

@@ -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())
},
},

View File

@@ -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

View File

@@ -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) {

View File

@@ -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())
},
},

View File

@@ -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())

View File

@@ -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))

View File

@@ -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)

View File

@@ -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]
}

View File

@@ -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)

View File

@@ -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"]

View File

@@ -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())
},
},