aboutsummaryrefslogtreecommitdiffstats
path: root/cc/androidmk.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-02-01 14:12:44 -0800
committerColin Cross <ccross@android.com>2017-02-02 16:23:30 -0800
commitfaeb7aa1351df6f1d7eae990d0e3d4c68f5c4abf (patch)
treefe410a9a1925ecc8b9492864555cde041d7d9e8d /cc/androidmk.go
parent294941bee9566e76047a230acea451cbc188210b (diff)
downloadbuild_soong-faeb7aa1351df6f1d7eae990d0e3d4c68f5c4abf.tar.gz
build_soong-faeb7aa1351df6f1d7eae990d0e3d4c68f5c4abf.tar.bz2
build_soong-faeb7aa1351df6f1d7eae990d0e3d4c68f5c4abf.zip
Support data properties for test binaries
Allow tests to specify a data property that lists files or filegroup modules that will be packaged alongside the test. Also add a path property to filegroup modules to allow shifting the path of the packaged files, and add ExpandSourcesSubDir to expand the filegroup sources while including a shifted relative path in the Paths objects. Test: soong tests, manually adding data to a module Change-Id: I52a48942660e12755d313ef13279313361b4fc35
Diffstat (limited to 'cc/androidmk.go')
-rw-r--r--cc/androidmk.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index c0be1114..182938c6 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -159,6 +159,23 @@ func (test *testBinary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkDa
if Bool(test.Properties.Test_per_src) {
ret.SubName = "_" + test.binaryDecorator.Properties.Stem
}
+
+ var testFiles []string
+ for _, d := range test.data {
+ rel := d.Rel()
+ path := d.String()
+ if !strings.HasSuffix(path, rel) {
+ panic(fmt.Errorf("path %q does not end with %q", path, rel))
+ }
+ path = strings.TrimSuffix(path, rel)
+ testFiles = append(testFiles, path+":"+rel)
+ }
+ if len(testFiles) > 0 {
+ ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
+ fmt.Fprintln(w, "LOCAL_TEST_DATA := "+strings.Join(testFiles, " "))
+ return nil
+ })
+ }
}
func (test *testLibrary) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {