diff options
Diffstat (limited to 'java/ravenwood.go')
-rw-r--r-- | java/ravenwood.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/java/ravenwood.go b/java/ravenwood.go index 3fa73e64d..9239bbd6b 100644 --- a/java/ravenwood.go +++ b/java/ravenwood.go @@ -34,6 +34,7 @@ var ravenwoodLibContentTag = dependencyTag{name: "ravenwoodlibcontent"} var ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"} var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"} var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"} +var ravenwoodTestInstResourceApkTag = dependencyTag{name: "ravenwoodtest-inst-res-apk"} const ravenwoodUtilsName = "ravenwood-utils" const ravenwoodRuntimeName = "ravenwood-runtime" @@ -56,11 +57,17 @@ type ravenwoodTestProperties struct { Jni_libs []string // Specify another android_app module here to copy it to the test directory, so that - // the ravenwood test can access it. + // the ravenwood test can access it. This APK will be loaded as resources of the test + // target app. // TODO: For now, we simply refer to another android_app module and copy it to the // test directory. Eventually, android_ravenwood_test should support all the resource // related properties and build resources from the `res/` directory. Resource_apk *string + + // Specify another android_app module here to copy it to the test directory, so that + // the ravenwood test can access it. This APK will be loaded as resources of the test + // instrumentation app itself. + Inst_resource_apk *string } type ravenwoodTest struct { @@ -127,6 +134,10 @@ func (r *ravenwoodTest) DepsMutator(ctx android.BottomUpMutatorContext) { if resourceApk := proptools.String(r.ravenwoodTestProperties.Resource_apk); resourceApk != "" { ctx.AddVariationDependencies(nil, ravenwoodTestResourceApkTag, resourceApk) } + + if resourceApk := proptools.String(r.ravenwoodTestProperties.Inst_resource_apk); resourceApk != "" { + ctx.AddVariationDependencies(nil, ravenwoodTestInstResourceApkTag, resourceApk) + } } func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -194,13 +205,16 @@ func (r *ravenwoodTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { } resApkInstallPath := installPath.Join(ctx, "ravenwood-res-apks") - if resApk := ctx.GetDirectDepsWithTag(ravenwoodTestResourceApkTag); len(resApk) > 0 { - for _, installFile := range android.OtherModuleProviderOrDefault( - ctx, resApk[0], android.InstallFilesProvider).InstallFiles { - installResApk := ctx.InstallFile(resApkInstallPath, "ravenwood-res.apk", installFile) + + copyResApk := func(tag blueprint.DependencyTag, toFileName string) { + if resApk := ctx.GetDirectDepsWithTag(tag); len(resApk) > 0 { + installFile := android.OutputFileForModule(ctx, resApk[0], "") + installResApk := ctx.InstallFile(resApkInstallPath, toFileName, installFile) installDeps = append(installDeps, installResApk) } } + copyResApk(ravenwoodTestResourceApkTag, "ravenwood-res.apk") + copyResApk(ravenwoodTestInstResourceApkTag, "ravenwood-inst-res.apk") // Install our JAR with all dependencies ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...) |