Fix incorrect soong symlink rule
Soong was incorrectly creating symlinks by not making the link target
relative to the link location. This caused symlink_prefered_arch to
not work when run with --skip-make.
Test: ALLOW_MISSING_DEPENDENCIES=true OUT_DIR=out DIST_DIR=out/dist \
./art/tools/dist_linux_bionic.sh -j80 com.android.runtime.host dex2oatd
ls -l out/host/linux_bionic-x86/bin
Change-Id: I0ae5f059d19c0eec53e4d7c8dc68ae890980e6b4
diff --git a/android/module.go b/android/module.go
index aed16b3..551824d 100644
--- a/android/module.go
+++ b/android/module.go
@@ -16,6 +16,7 @@
import (
"fmt"
+ "path"
"path/filepath"
"sort"
"strings"
@@ -1268,6 +1269,10 @@
if !a.skipInstall(fullInstallPath) {
+ relPath, err := filepath.Rel(path.Dir(fullInstallPath.String()), srcPath.String())
+ if err != nil {
+ panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
+ }
a.Build(pctx, BuildParams{
Rule: Symlink,
Description: "install symlink " + fullInstallPath.Base(),
@@ -1275,7 +1280,7 @@
OrderOnly: Paths{srcPath},
Default: !a.Config().EmbeddedInMake(),
Args: map[string]string{
- "fromPath": srcPath.String(),
+ "fromPath": relPath,
},
})