Loading android/androidmk.go +18 −0 Original line number Diff line number Diff line Loading @@ -639,3 +639,21 @@ func shouldSkipAndroidMkProcessing(module *ModuleBase) bool { // Make does not understand LinuxBionic module.Os() == LinuxBionic } func AndroidMkDataPaths(data []DataPath) []string { var testFiles []string for _, d := range data { rel := d.SrcPath.Rel() path := d.SrcPath.String() if !strings.HasSuffix(path, rel) { panic(fmt.Errorf("path %q does not end with %q", path, rel)) } path = strings.TrimSuffix(path, rel) testFileString := path + ":" + rel if len(d.RelativeInstallPath) > 0 { testFileString += ":" + d.RelativeInstallPath } testFiles = append(testFiles, testFileString) } return testFiles } apex/androidmk.go +1 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo } } if len(newDataPaths) > 0 { fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(cc.AndroidMkDataPaths(newDataPaths), " ")) fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(android.AndroidMkDataPaths(newDataPaths), " ")) } if fi.module != nil && len(fi.module.NoticeFiles()) > 0 { Loading cc/androidmk.go +1 −19 Original line number Diff line number Diff line Loading @@ -156,24 +156,6 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{entries} } func AndroidMkDataPaths(data []android.DataPath) []string { var testFiles []string for _, d := range data { rel := d.SrcPath.Rel() path := d.SrcPath.String() if !strings.HasSuffix(path, rel) { panic(fmt.Errorf("path %q does not end with %q", path, rel)) } path = strings.TrimSuffix(path, rel) testFileString := path + ":" + rel if len(d.RelativeInstallPath) > 0 { testFileString += ":" + d.RelativeInstallPath } testFiles = append(testFiles, testFileString) } return testFiles } func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) { if len(extraTestConfigs) > 0 { entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { Loading @@ -183,7 +165,7 @@ func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *and } func androidMkWriteTestData(data []android.DataPath, ctx AndroidMkContext, entries *android.AndroidMkEntries) { testFiles := AndroidMkDataPaths(data) testFiles := android.AndroidMkDataPaths(data) if len(testFiles) > 0 { entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.AddStrings("LOCAL_TEST_DATA", testFiles...) Loading python/androidmk.go +7 −1 Original line number Diff line number Diff line Loading @@ -15,11 +15,12 @@ package python import ( "android/soong/android" "fmt" "io" "path/filepath" "strings" "android/soong/android" ) type subAndroidMkProvider interface { Loading Loading @@ -74,6 +75,11 @@ func (p *testDecorator) AndroidMk(base *Module, ret *android.AndroidMkData) { if !BoolDefault(p.binaryProperties.Auto_gen_config, true) { fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true") } if len(p.data) > 0 { fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(android.AndroidMkDataPaths(p.data), " ")) } }) base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller) } Loading python/test.go +12 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ type TestProperties struct { // the name of the test configuration template (for example "AndroidTestTemplate.xml") that // should be installed with the module. Test_config_template *string `android:"path,arch_variant"` // list of files or filegroup modules that provide data that should be installed alongside // the test Data []string `android:"path,arch_variant"` } type testDecorator struct { Loading @@ -42,6 +46,8 @@ type testDecorator struct { testProperties TestProperties testConfig android.Path data []android.DataPath } func (test *testDecorator) bootstrapperProps() []interface{} { Loading @@ -59,6 +65,12 @@ func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) test.binaryDecorator.pythonInstaller.relative = ctx.ModuleName() test.binaryDecorator.pythonInstaller.install(ctx, file) dataSrcPaths := android.PathsForModuleSrc(ctx, test.testProperties.Data) for _, dataSrcPath := range dataSrcPaths { test.data = append(test.data, android.DataPath{SrcPath: dataSrcPath}) } } func NewTest(hod android.HostOrDeviceSupported) *Module { Loading Loading
android/androidmk.go +18 −0 Original line number Diff line number Diff line Loading @@ -639,3 +639,21 @@ func shouldSkipAndroidMkProcessing(module *ModuleBase) bool { // Make does not understand LinuxBionic module.Os() == LinuxBionic } func AndroidMkDataPaths(data []DataPath) []string { var testFiles []string for _, d := range data { rel := d.SrcPath.Rel() path := d.SrcPath.String() if !strings.HasSuffix(path, rel) { panic(fmt.Errorf("path %q does not end with %q", path, rel)) } path = strings.TrimSuffix(path, rel) testFileString := path + ":" + rel if len(d.RelativeInstallPath) > 0 { testFileString += ":" + d.RelativeInstallPath } testFiles = append(testFiles, testFileString) } return testFiles }
apex/androidmk.go +1 −1 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo } } if len(newDataPaths) > 0 { fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(cc.AndroidMkDataPaths(newDataPaths), " ")) fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(android.AndroidMkDataPaths(newDataPaths), " ")) } if fi.module != nil && len(fi.module.NoticeFiles()) > 0 { Loading
cc/androidmk.go +1 −19 Original line number Diff line number Diff line Loading @@ -156,24 +156,6 @@ func (c *Module) AndroidMkEntries() []android.AndroidMkEntries { return []android.AndroidMkEntries{entries} } func AndroidMkDataPaths(data []android.DataPath) []string { var testFiles []string for _, d := range data { rel := d.SrcPath.Rel() path := d.SrcPath.String() if !strings.HasSuffix(path, rel) { panic(fmt.Errorf("path %q does not end with %q", path, rel)) } path = strings.TrimSuffix(path, rel) testFileString := path + ":" + rel if len(d.RelativeInstallPath) > 0 { testFileString += ":" + d.RelativeInstallPath } testFiles = append(testFiles, testFileString) } return testFiles } func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *android.AndroidMkEntries) { if len(extraTestConfigs) > 0 { entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { Loading @@ -183,7 +165,7 @@ func androidMkWriteExtraTestConfigs(extraTestConfigs android.Paths, entries *and } func androidMkWriteTestData(data []android.DataPath, ctx AndroidMkContext, entries *android.AndroidMkEntries) { testFiles := AndroidMkDataPaths(data) testFiles := android.AndroidMkDataPaths(data) if len(testFiles) > 0 { entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) { entries.AddStrings("LOCAL_TEST_DATA", testFiles...) Loading
python/androidmk.go +7 −1 Original line number Diff line number Diff line Loading @@ -15,11 +15,12 @@ package python import ( "android/soong/android" "fmt" "io" "path/filepath" "strings" "android/soong/android" ) type subAndroidMkProvider interface { Loading Loading @@ -74,6 +75,11 @@ func (p *testDecorator) AndroidMk(base *Module, ret *android.AndroidMkData) { if !BoolDefault(p.binaryProperties.Auto_gen_config, true) { fmt.Fprintln(w, "LOCAL_DISABLE_AUTO_GENERATE_TEST_CONFIG := true") } if len(p.data) > 0 { fmt.Fprintln(w, "LOCAL_TEST_DATA :=", strings.Join(android.AndroidMkDataPaths(p.data), " ")) } }) base.subAndroidMk(ret, p.binaryDecorator.pythonInstaller) } Loading
python/test.go +12 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ type TestProperties struct { // the name of the test configuration template (for example "AndroidTestTemplate.xml") that // should be installed with the module. Test_config_template *string `android:"path,arch_variant"` // list of files or filegroup modules that provide data that should be installed alongside // the test Data []string `android:"path,arch_variant"` } type testDecorator struct { Loading @@ -42,6 +46,8 @@ type testDecorator struct { testProperties TestProperties testConfig android.Path data []android.DataPath } func (test *testDecorator) bootstrapperProps() []interface{} { Loading @@ -59,6 +65,12 @@ func (test *testDecorator) install(ctx android.ModuleContext, file android.Path) test.binaryDecorator.pythonInstaller.relative = ctx.ModuleName() test.binaryDecorator.pythonInstaller.install(ctx, file) dataSrcPaths := android.PathsForModuleSrc(ctx, test.testProperties.Data) for _, dataSrcPath := range dataSrcPaths { test.data = append(test.data, android.DataPath{SrcPath: dataSrcPath}) } } func NewTest(hod android.HostOrDeviceSupported) *Module { Loading