Add InstallBypassMake
Allow modules to mark themselves as InstallBypassMake, which will
cause android.PathForModuleInstall to return a path in $OUT_DIR
instead of $OUT_DIR/soong. This can be used for modules that
can handle installation to the final location on their own. The
main blocker for most modules is support for the "required" property,
which requires adding dependencies on the installed location of
other modules.
Bug: 122332855
Test: m checkbuild
Change-Id: I85238d937ff30335167d4b3fec79bbefc734b5e1
diff --git a/android/paths.go b/android/paths.go
index e3f0544..0d99918 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -46,6 +46,7 @@
InstallInData() bool
InstallInSanitizerDir() bool
InstallInRecovery() bool
+ InstallBypassMake() bool
}
var _ ModuleInstallPathContext = ModuleContext(nil)
@@ -818,6 +819,17 @@
return OutputPath{basePath{path, ctx.Config(), ""}}
}
+// pathForInstallInMakeDir is used by PathForModuleInstall when the module returns true
+// for InstallBypassMake to produce an OutputPath that installs to $OUT_DIR instead of
+// $OUT_DIR/soong.
+func pathForInstallInMakeDir(ctx PathContext, pathComponents ...string) OutputPath {
+ path, err := validatePath(pathComponents...)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+ return OutputPath{basePath{"../" + path, ctx.Config(), ""}}
+}
+
// PathsForOutput returns Paths rooted from buildDir
func PathsForOutput(ctx PathContext, paths []string) WritablePaths {
ret := make(WritablePaths, len(paths))
@@ -1123,6 +1135,9 @@
outPaths = append([]string{"debug"}, outPaths...)
}
outPaths = append(outPaths, pathComponents...)
+ if ctx.InstallBypassMake() && ctx.Config().EmbeddedInMake() {
+ return pathForInstallInMakeDir(ctx, outPaths...)
+ }
return PathForOutput(ctx, outPaths...)
}