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

Commit e323f3cc authored by Colin Cross's avatar Colin Cross
Browse files

Fix robolectric tests with sdk_version and prebuilt dependencies

Add deviceProperties to robolectric tests so they can set
sdk_version.  Use Dependency.BaseModuleName() instead of
ctx.OtherModuleName() to get the dependency name to pass to Make
to support prebuilts in libs, which may have a "prebuilt_" prefix
in ctx.OtherModuleName().

Test: m RunLauncherRoboTests
Change-Id: I59a889bd6107b989f336b147d0eaccabef611894
parent 9c27df7d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -398,6 +398,7 @@ type Dependency interface {
	AidlIncludeDirs() android.Paths
	ExportedSdkLibs() []string
	SrcJarArgs() ([]string, android.Paths)
	BaseModuleName() string
}

type SdkLibraryDependency interface {
+2 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
	r.roboSrcJar = roboSrcJar

	for _, dep := range ctx.GetDirectDepsWithTag(libTag) {
		r.libs = append(r.libs, ctx.OtherModuleName(dep))
		r.libs = append(r.libs, dep.(Dependency).BaseModuleName())
	}

	// TODO: this could all be removed if tradefed was used as the test runner, it will find everything
@@ -233,6 +233,7 @@ func RobolectricTestFactory() android.Module {

	module.AddProperties(
		&module.Module.properties,
		&module.Module.deviceProperties,
		&module.Module.protoProperties,
		&module.robolectricProperties)