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

Commit c92be6e9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add device_first_prefer32_data to java modules" into main

parents 23e817f0 18f03f1c
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -51,11 +51,13 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
	// tagged with `android:"path"` or one of the variant-specifying tags.
	var pathProperties []string
	var pathDeviceFirstProperties []string
	var pathDeviceFirstPrefer32Properties []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")...)
		pathDeviceCommonProperties = append(pathDeviceCommonProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_device_common")...)
		pathCommonOsProperties = append(pathCommonOsProperties, taggedPropertiesForPropertyStruct(ctx, ps, "path_common_os")...)
	}
@@ -63,6 +65,7 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
	// Remove duplicates to avoid multiple dependencies.
	pathProperties = FirstUniqueStrings(pathProperties)
	pathDeviceFirstProperties = FirstUniqueStrings(pathDeviceFirstProperties)
	pathDeviceFirstPrefer32Properties = FirstUniqueStrings(pathDeviceFirstPrefer32Properties)
	pathDeviceCommonProperties = FirstUniqueStrings(pathDeviceCommonProperties)
	pathCommonOsProperties = FirstUniqueStrings(pathCommonOsProperties)

@@ -80,13 +83,27 @@ func addPathDepsForProps(ctx BottomUpMutatorContext, props []interface{}) {
			ctx.AddVariationDependencies(ctx.Config().AndroidFirstDeviceTarget.Variations(), sourceOrOutputDepTag(m, t), m)
		}
	}
	// properties tagged path_device_first_prefer32 get the first 32 bit target if one is available,
	// otherwise they use the first 64 bit target
	if len(pathDeviceFirstPrefer32Properties) > 0 {
		firstPrefer32Target := FirstTarget(ctx.Config().Targets[Android], "lib32", "lib64")
		if len(firstPrefer32Target) == 0 {
			ctx.ModuleErrorf("Could not find a first_prefer32 target")
		} else {
			for _, s := range pathDeviceFirstPrefer32Properties {
				if m, t := SrcIsModuleWithTag(s); m != "" {
					ctx.AddVariationDependencies(firstPrefer32Target[0].Variations(), sourceOrOutputDepTag(m, t), m)
				}
			}
		}
	}
	// properties tagged "path_device_common" get the device common variant
	for _, s := range pathDeviceCommonProperties {
		if m, t := SrcIsModuleWithTag(s); m != "" {
			ctx.AddVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), sourceOrOutputDepTag(m, t), m)
		}
	}
	// properties tagged "path_device_common" get the device common variant
	// properties tagged "path_common_os" get the CommonOs variant
	for _, s := range pathCommonOsProperties {
		if m, t := SrcIsModuleWithTag(s); m != "" {
			ctx.AddVariationDependencies([]blueprint.Variation{
+1 −0
Original line number Diff line number Diff line
@@ -1442,6 +1442,7 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
	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)...)
	android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
	android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
		InstalledFiles:          a.data,
+7 −0
Original line number Diff line number Diff line
@@ -1301,6 +1301,12 @@ 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 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
	// host test.
	Device_first_prefer32_data []string `android:"path_device_first_prefer32"`

	// Flag to indicate whether or not to create test config automatically. If AndroidTest.xml
	// doesn't exist next to the Android.bp, this attribute doesn't need to be set to true
	// explicitly.
@@ -1593,6 +1599,7 @@ func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext,
	j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data)
	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.extraTestConfigs = android.PathsForModuleSrc(ctx, j.testProperties.Test_options.Extra_test_configs)

+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
	r.data = android.PathsForModuleSrc(ctx, r.testProperties.Data)
	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)...)

	var ok bool
	var instrumentedApp *AndroidApp