aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-07-14 18:55:36 -0700
committerColin Cross <ccross@android.com>2015-08-24 16:19:43 -0700
commit6e18ca49f83c18772299677a4bd949d9dc978a62 (patch)
treecec6aeef53c5235ca63082aa5528c89f0783db1a /common
parentcbac5fbe78bb7162049744e6aad234d572e2cab6 (diff)
downloadbuild_soong-6e18ca49f83c18772299677a4bd949d9dc978a62.tar.gz
build_soong-6e18ca49f83c18772299677a4bd949d9dc978a62.tar.bz2
build_soong-6e18ca49f83c18772299677a4bd949d9dc978a62.zip
Fix java resource glob file list location
The source path was being appended to the module out directory to create the file list file, which was resulting in .. in the source path moving the file list file up the directory tree. Use SrcDirRelPath to convert the globbed resource directories to be relatiave to $srcDir before appending them. Also do the same fix to generated aidl, logtags, yacc, and lex files. Change-Id: I2e636bd30abf03bc1d80a897951a9812cc3e09ef
Diffstat (limited to 'common')
-rw-r--r--common/paths.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/common/paths.go b/common/paths.go
index c4bdfc72..d92dcf91 100644
--- a/common/paths.go
+++ b/common/paths.go
@@ -15,6 +15,7 @@
package common
import (
+ "fmt"
"os"
"path/filepath"
)
@@ -105,3 +106,15 @@ func CheckSrcDirsExist(ctx AndroidModuleContext, dirs []string, prop string) {
}
}
}
+
+// Returns a path relative to the top level source directory. Panics if path is not inside the
+// top level source directory.
+func SrcDirRelPath(ctx AndroidModuleContext, path string) string {
+ srcDir := ctx.AConfig().SrcDir()
+ relPath, err := filepath.Rel(srcDir, path)
+ if err != nil {
+ panic(fmt.Errorf("%q is not inside %q: %s", path, srcDir, err.Error()))
+ }
+
+ return relPath
+}