Fix builds with absolute OUT_DIR

Test: OUT_DIR=$PWD/out m
Change-Id: I23887110a6ee1228162f9e1a9fc89a97f45ac781
This commit is contained in:
Dan Willemsen 2020-07-23 16:10:51 -07:00
parent 1a4ab20c1a
commit b1d1e0e6bd

View file

@ -59,9 +59,15 @@ func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
installedPath := PathForModuleOut(ctx, t.ModuleBase.Name())
deps := PathsForModuleSrc(ctx, t.properties.Deps)
relPath, err := filepath.Rel(path.Dir(installedPath.String()), sourcePath.String())
if err != nil {
ctx.ModuleErrorf("Unabled to generate symlink between %q and %q: %s", installedPath.String(), sourcePath.String())
var relPath string
if filepath.IsAbs(installedPath.String()) {
relPath = filepath.Join(absSrcDir, sourcePath.String())
} else {
var err error
relPath, err = filepath.Rel(path.Dir(installedPath.String()), sourcePath.String())
if err != nil {
ctx.ModuleErrorf("Unable to generate symlink between %q and %q: %s", installedPath.String(), sourcePath.String(), err)
}
}
ctx.Build(pctx, BuildParams{