diff options
Diffstat (limited to 'android/paths.go')
| -rw-r--r-- | android/paths.go | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/android/paths.go b/android/paths.go index bf2c3a097..9cb872d6f 100644 --- a/android/paths.go +++ b/android/paths.go @@ -117,6 +117,9 @@ type ModuleInstallPathContext interface { InstallInOdm() bool InstallInProduct() bool InstallInVendor() bool + InstallInSystemDlkm() bool + InstallInVendorDlkm() bool + InstallInOdmDlkm() bool InstallForceOS() (*OsType, *ArchType) } @@ -170,6 +173,18 @@ func (ctx *baseModuleContextToModuleInstallPathContext) InstallInVendor() bool { return ctx.Module().InstallInVendor() } +func (ctx *baseModuleContextToModuleInstallPathContext) InstallInSystemDlkm() bool { + return ctx.Module().InstallInSystemDlkm() +} + +func (ctx *baseModuleContextToModuleInstallPathContext) InstallInVendorDlkm() bool { + return ctx.Module().InstallInVendorDlkm() +} + +func (ctx *baseModuleContextToModuleInstallPathContext) InstallInOdmDlkm() bool { + return ctx.Module().InstallInOdmDlkm() +} + func (ctx *baseModuleContextToModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) { return ctx.Module().InstallForceOS() } @@ -551,15 +566,35 @@ func PathsRelativeToModuleSourceDir(input SourceInput) Paths { return ret } +type directoryPath struct { + basePath +} + +func (d *directoryPath) String() string { + return d.basePath.String() +} + +func (d *directoryPath) base() basePath { + return d.basePath +} + +// DirectoryPath represents a source path for directories. Incompatible with Path by design. +type DirectoryPath interface { + String() string + base() basePath +} + +var _ DirectoryPath = (*directoryPath)(nil) + +type DirectoryPaths []DirectoryPath + // DirectoryPathsForModuleSrcExcludes returns a Paths{} containing the resolved references in // directory paths. Elements of paths are resolved as: // - filepath, relative to local module directory, resolves as a filepath relative to the local // source directory // - other modules using the ":name" syntax. These modules must implement DirProvider. -// -// TODO(b/358302178): Implement DirectoryPath and change the return type. -func DirectoryPathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string) Paths { - var ret Paths +func DirectoryPathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string) DirectoryPaths { + var ret DirectoryPaths for _, path := range paths { if m, t := SrcIsModuleWithTag(path); m != "" { @@ -588,12 +623,12 @@ func DirectoryPathsForModuleSrc(ctx ModuleMissingDepsPathContext, paths []string } else if !isDir { ReportPathErrorf(ctx, "module directory path %q is not a directory", p) } else { - ret = append(ret, p) + ret = append(ret, &directoryPath{basePath{path: p.path, rel: p.rel}}) } } } - seen := make(map[Path]bool, len(ret)) + seen := make(map[DirectoryPath]bool, len(ret)) for _, path := range ret { if seen[path] { ReportPathErrorf(ctx, "duplicated path %q", path) @@ -2057,6 +2092,10 @@ func PathForMainlineSdksInstall(ctx PathContext, paths ...string) InstallPath { return base.Join(ctx, paths...) } +func PathForSuiteInstall(ctx PathContext, suite string, pathComponents ...string) InstallPath { + return pathForPartitionInstallDir(ctx, "test_suites", "test_suites", false).Join(ctx, suite).Join(ctx, pathComponents...) +} + func InstallPathToOnDevicePath(ctx PathContext, path InstallPath) string { rel := Rel(ctx, strings.TrimSuffix(path.PartitionDir(), path.partition), path.String()) return "/" + rel @@ -2111,6 +2150,12 @@ func modulePartition(ctx ModuleInstallPathContext, device bool) string { partition = ctx.DeviceConfig().SystemExtPath() } else if ctx.InstallInRoot() { partition = "root" + } else if ctx.InstallInSystemDlkm() { + partition = ctx.DeviceConfig().SystemDlkmPath() + } else if ctx.InstallInVendorDlkm() { + partition = ctx.DeviceConfig().VendorDlkmPath() + } else if ctx.InstallInOdmDlkm() { + partition = ctx.DeviceConfig().OdmDlkmPath() } else { partition = "system" } @@ -2314,6 +2359,9 @@ type testModuleInstallPathContext struct { inOdm bool inProduct bool inVendor bool + inSystemDlkm bool + inVendorDlkm bool + inOdmDlkm bool forceOS *OsType forceArch *ArchType } @@ -2368,6 +2416,18 @@ func (m testModuleInstallPathContext) InstallInVendor() bool { return m.inVendor } +func (m testModuleInstallPathContext) InstallInSystemDlkm() bool { + return m.inSystemDlkm +} + +func (m testModuleInstallPathContext) InstallInVendorDlkm() bool { + return m.inVendorDlkm +} + +func (m testModuleInstallPathContext) InstallInOdmDlkm() bool { + return m.inOdmDlkm +} + func (m testModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) { return m.forceOS, m.forceArch } |