From 25f5ae4c88e937cf25931eae3fac2468d341f741 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Tue, 7 Jan 2025 22:27:58 +0900 Subject: Add device_first_data to python modules Bug: 354060773 Test: atest avf_early_vm_test Change-Id: I3c6065598bf4c3e8670e6fa78dfdfeea75e5fd38 --- python/python.go | 6 ++++++ python/test.go | 8 ++++++++ 2 files changed, 14 insertions(+) (limited to 'python') diff --git a/python/python.go b/python/python.go index be9411bbf..914b77e2f 100644 --- a/python/python.go +++ b/python/python.go @@ -95,6 +95,11 @@ type BaseProperties struct { // device. Device_common_data []string `android:"path_device_common"` + // Same as data, but will add dependencies on modules via a device os variation and the + // device's first supported arch's variation. Useful for a host test that wants to embed a + // module built for device. + Device_first_data []string `android:"path_device_first"` + // list of java modules that provide data that should be installed alongside the test. Java_data []string @@ -456,6 +461,7 @@ func (p *PythonLibraryModule) GenerateAndroidBuildActions(ctx android.ModuleCont // expand data files from "data" property. expandedData := android.PathsForModuleSrc(ctx, p.properties.Data) expandedData = append(expandedData, android.PathsForModuleSrc(ctx, p.properties.Device_common_data)...) + expandedData = append(expandedData, android.PathsForModuleSrc(ctx, p.properties.Device_first_data)...) // Emulate the data property for java_data dependencies. for _, javaData := range ctx.GetDirectDepsWithTag(javaDataTag) { diff --git a/python/test.go b/python/test.go index 9f57bea1b..37947dd31 100644 --- a/python/test.go +++ b/python/test.go @@ -68,6 +68,11 @@ type TestProperties struct { // device. Device_common_data []string `android:"path_device_common"` + // Same as data, but will add dependencies on modules via a device os variation and the + // device's first supported arch's variation. Useful for a host test that wants to embed a + // module built for device. + Device_first_data []string `android:"path_device_first"` + // list of java modules that provide data that should be installed alongside the test. Java_data []string @@ -189,6 +194,9 @@ func (p *PythonTestModule) GenerateAndroidBuildActions(ctx android.ModuleContext for _, dataSrcPath := range android.PathsForModuleSrc(ctx, p.testProperties.Device_common_data) { p.data = append(p.data, android.DataPath{SrcPath: dataSrcPath}) } + for _, dataSrcPath := range android.PathsForModuleSrc(ctx, p.testProperties.Device_first_data) { + p.data = append(p.data, android.DataPath{SrcPath: dataSrcPath}) + } if p.isTestHost() && len(p.testProperties.Data_device_bins_both) > 0 { ctx.VisitDirectDepsWithTag(dataDeviceBinsTag, func(dep android.Module) { -- cgit v1.2.3-59-g8ed1b