From 8304a1330e592f53fb3f3043848f25088f747804 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Mon, 20 Sep 2021 17:49:47 -0700 Subject: [PATCH] Add phony name for robolectric tests Robolectric tests are installed by Soong, which means Make doesn't know about the install location to create the phony rules. Add a phony rule in Soong for now until Soong's installation rules are fleshed out. Bug: 184946827 Test: m SettingsRoboTests Change-Id: I60d76474949800e1a737714d86df84eff9a92214 --- java/robolectric.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/java/robolectric.go b/java/robolectric.go index a0c9c7fcd..35239f805 100644 --- a/java/robolectric.go +++ b/java/robolectric.go @@ -212,7 +212,13 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext) installDeps = append(installDeps, installedData) } - ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.combinedJar, installDeps...) + installed := ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.combinedJar, installDeps...) + + if r.ExportedToMake() { + // Soong handles installation here, but Make is usually what creates the phony rule that atest + // uses to build the module. Create it here for now. + ctx.Phony(ctx.ModuleName(), installed) + } } func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,