Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8bf946a authored by Cole Faust's avatar Cole Faust
Browse files

Add device_first_vendor(_shared)_data

There are some host tests in internal that rely on the vendor variation
of other modules, that they include in their `data` property.

Add explicit properties for these dependencies so that they don't rely
on the 1-variant fallback.

Bug: 372091092
Test: m nothing
Change-Id: I51a50db2a06fdd3f885ac21f3ad3ce15386feb53
parent 17d5d891
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -52,12 +52,16 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
	var pathProperties []string
	var pathDeviceFirstProperties []string
	var pathDeviceFirstPrefer32Properties []string
	var pathDeviceFirstVendorProperties []string
	var pathDeviceFirstVendorSharedProperties []string
	var pathDeviceCommonProperties []string
	var pathCommonOsProperties []string
	for _, ps := range props {
		pathProperties = append(pathProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path")...)
		pathDeviceFirstProperties = append(pathDeviceFirstProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_first")...)
		pathDeviceFirstPrefer32Properties = append(pathDeviceFirstPrefer32Properties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_first_prefer32")...)
		pathDeviceFirstVendorProperties = append(pathDeviceFirstVendorProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_first_vendor")...)
		pathDeviceFirstVendorSharedProperties = append(pathDeviceFirstVendorSharedProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_first_vendor_shared")...)
		pathDeviceCommonProperties = append(pathDeviceCommonProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_common")...)
		pathCommonOsProperties = append(pathCommonOsProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_common_os")...)
	}
@@ -66,6 +70,8 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
	pathProperties = FirstUniqueStrings(pathProperties)
	pathDeviceFirstProperties = FirstUniqueStrings(pathDeviceFirstProperties)
	pathDeviceFirstPrefer32Properties = FirstUniqueStrings(pathDeviceFirstPrefer32Properties)
	pathDeviceFirstVendorProperties = FirstUniqueStrings(pathDeviceFirstVendorProperties)
	pathDeviceFirstVendorSharedProperties = FirstUniqueStrings(pathDeviceFirstVendorSharedProperties)
	pathDeviceCommonProperties = FirstUniqueStrings(pathDeviceCommonProperties)
	pathCommonOsProperties = FirstUniqueStrings(pathCommonOsProperties)

@@ -97,6 +103,23 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
			}
		}
	}
	// path_device_first_vendor is path_device_first + vendor variation
	deviceFirstVendorVariations := ctx.Config().AndroidFirstDeviceTarget.Variations()
	deviceFirstVendorVariations = append(deviceFirstVendorVariations,
		blueprint.Variation{Mutator: "image", Variation: "vendor"})
	for _, s := range pathDeviceFirstVendorProperties {
		if m, t := SrcIsModuleWithTag(s); m != "" {
			ctx.AddVariationDependencies(deviceFirstVendorVariations, sourceOrOutputDepTag(m, t), m)
		}
	}
	// path_device_first_vendor_shared is path_device_first_vendor + shared linkage variation
	deviceFirstVendorSharedVariations := append(deviceFirstVendorVariations,
		blueprint.Variation{Mutator: "link", Variation: "shared"})
	for _, s := range pathDeviceFirstVendorSharedProperties {
		if m, t := SrcIsModuleWithTag(s); m != "" {
			ctx.AddVariationDependencies(deviceFirstVendorSharedVariations, sourceOrOutputDepTag(m, t), m)
		}
	}
	// properties tagged "path_device_common" get the device common variant
	for _, s := range pathDeviceCommonProperties {
		if m, t := SrcIsModuleWithTag(s); m != "" {
+2 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,8 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_common_data)...)
	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...)
	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...)
	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_vendor_data)...)
	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_vendor_shared_data)...)
	android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
		InstalledFiles:          a.data,
		OutputFile:              a.OutputFile(),
+12 −0
Original line number Diff line number Diff line
@@ -1301,6 +1301,16 @@ type testProperties struct {
	// host test.
	Device_first_data []string `android:"path_device_first"`

	// same as data, but adds dependencies using the device's os variation, the device's first
	// architecture's variation, and the vendor image variation. Can be used to add a module built
	// for device to the data of a host test.
	Device_first_vendor_data []string `android:"path_device_first_vendor"`

	// same as data, but adds dependencies using the device's os variation, the device's first
	// architecture's variation, the vendor image variation, and the shared linkage variation. Can
	// be used to add a module built for device to the data of a host test.
	Device_first_vendor_shared_data []string `android:"path_device_first_vendor_shared"`

	// same as data, but adds dependencies using the device's os variation and the device's first
	// 32-bit architecture's variation. If a 32-bit arch doesn't exist for this device, it will use
	// a 64 bit arch instead. Can be used to add a module built for device to the data of a
@@ -1598,6 +1608,8 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
	j.data = append(j.data, android.PathsForModuleSrc(ctx, j.testProperties.Device_common_data)...)
	j.data = append(j.data, android.PathsForModuleSrc(ctx, j.testProperties.Device_first_data)...)
	j.data = append(j.data, android.PathsForModuleSrc(ctx, j.testProperties.Device_first_prefer32_data)...)
	j.data = append(j.data, android.PathsForModuleSrc(ctx, j.testProperties.Device_first_vendor_data)...)
	j.data = append(j.data, android.PathsForModuleSrc(ctx, j.testProperties.Device_first_vendor_shared_data)...)

	j.extraTestConfigs = android.PathsForModuleSrc(ctx, j.testProperties.Test_options.Extra_test_configs)

+2 −0
Original line number Diff line number Diff line
@@ -151,6 +151,8 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
	r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_common_data)...)
	r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_data)...)
	r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_prefer32_data)...)
	r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_vendor_data)...)
	r.data = append(r.data, android.PathsForModuleSrc(ctx, r.testProperties.Device_first_vendor_shared_data)...)

	var ok bool
	var instrumentedApp *AndroidApp