Merge "Fix resource-apk inclusion" into main am: 1fa2cf0f88
am: 9b00bf3ecf
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3270523 Change-Id: I14207bcca8e2bd45fcd77f09fa04175eff54eb04 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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...)
|
||||
|
@@ -66,6 +66,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
|
||||
name: "app2",
|
||||
sdk_version: "current",
|
||||
}
|
||||
android_app {
|
||||
name: "app3",
|
||||
sdk_version: "current",
|
||||
}
|
||||
prebuilt_font {
|
||||
name: "Font.ttf",
|
||||
src: "Font.ttf",
|
||||
@@ -167,6 +171,7 @@ func TestRavenwoodTest(t *testing.T) {
|
||||
"ravenwood-runtime-jni2",
|
||||
],
|
||||
resource_apk: "app2",
|
||||
inst_resource_apk: "app3",
|
||||
sdk_version: "test_current",
|
||||
}
|
||||
`)
|
||||
@@ -194,6 +199,7 @@ func TestRavenwoodTest(t *testing.T) {
|
||||
module.Output(installPathPrefix + "/ravenwood-test/lib64/libblue.so")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/lib64/libpink.so")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-res.apk")
|
||||
module.Output(installPathPrefix + "/ravenwood-test/ravenwood-res-apks/ravenwood-inst-res.apk")
|
||||
|
||||
// ravenwood-runtime*.so are included in the runtime, so it shouldn't be emitted.
|
||||
for _, o := range module.AllOutputs() {
|
||||
|
Reference in New Issue
Block a user