Merge "Fix resource-apk inclusion" into main am: 1fa2cf0f88
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3270523 Change-Id: I2fce88dccf8c339450a0dc245d71fedaa2ed4e8f 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 ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"}
|
||||||
var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"}
|
var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"}
|
||||||
var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"}
|
var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"}
|
||||||
|
var ravenwoodTestInstResourceApkTag = dependencyTag{name: "ravenwoodtest-inst-res-apk"}
|
||||||
|
|
||||||
const ravenwoodUtilsName = "ravenwood-utils"
|
const ravenwoodUtilsName = "ravenwood-utils"
|
||||||
const ravenwoodRuntimeName = "ravenwood-runtime"
|
const ravenwoodRuntimeName = "ravenwood-runtime"
|
||||||
@@ -56,11 +57,17 @@ type ravenwoodTestProperties struct {
|
|||||||
Jni_libs []string
|
Jni_libs []string
|
||||||
|
|
||||||
// Specify another android_app module here to copy it to the test directory, so that
|
// 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
|
// 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
|
// test directory. Eventually, android_ravenwood_test should support all the resource
|
||||||
// related properties and build resources from the `res/` directory.
|
// related properties and build resources from the `res/` directory.
|
||||||
Resource_apk *string
|
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 {
|
type ravenwoodTest struct {
|
||||||
@@ -127,6 +134,10 @@ func (r *ravenwoodTest) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
if resourceApk := proptools.String(r.ravenwoodTestProperties.Resource_apk); resourceApk != "" {
|
if resourceApk := proptools.String(r.ravenwoodTestProperties.Resource_apk); resourceApk != "" {
|
||||||
ctx.AddVariationDependencies(nil, ravenwoodTestResourceApkTag, 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) {
|
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")
|
resApkInstallPath := installPath.Join(ctx, "ravenwood-res-apks")
|
||||||
if resApk := ctx.GetDirectDepsWithTag(ravenwoodTestResourceApkTag); len(resApk) > 0 {
|
|
||||||
for _, installFile := range android.OtherModuleProviderOrDefault(
|
copyResApk := func(tag blueprint.DependencyTag, toFileName string) {
|
||||||
ctx, resApk[0], android.InstallFilesProvider).InstallFiles {
|
if resApk := ctx.GetDirectDepsWithTag(tag); len(resApk) > 0 {
|
||||||
installResApk := ctx.InstallFile(resApkInstallPath, "ravenwood-res.apk", installFile)
|
installFile := android.OutputFileForModule(ctx, resApk[0], "")
|
||||||
|
installResApk := ctx.InstallFile(resApkInstallPath, toFileName, installFile)
|
||||||
installDeps = append(installDeps, installResApk)
|
installDeps = append(installDeps, installResApk)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
copyResApk(ravenwoodTestResourceApkTag, "ravenwood-res.apk")
|
||||||
|
copyResApk(ravenwoodTestInstResourceApkTag, "ravenwood-inst-res.apk")
|
||||||
|
|
||||||
// Install our JAR with all dependencies
|
// Install our JAR with all dependencies
|
||||||
ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...)
|
ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...)
|
||||||
|
@@ -66,6 +66,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
|
|||||||
name: "app2",
|
name: "app2",
|
||||||
sdk_version: "current",
|
sdk_version: "current",
|
||||||
}
|
}
|
||||||
|
android_app {
|
||||||
|
name: "app3",
|
||||||
|
sdk_version: "current",
|
||||||
|
}
|
||||||
prebuilt_font {
|
prebuilt_font {
|
||||||
name: "Font.ttf",
|
name: "Font.ttf",
|
||||||
src: "Font.ttf",
|
src: "Font.ttf",
|
||||||
@@ -167,6 +171,7 @@ func TestRavenwoodTest(t *testing.T) {
|
|||||||
"ravenwood-runtime-jni2",
|
"ravenwood-runtime-jni2",
|
||||||
],
|
],
|
||||||
resource_apk: "app2",
|
resource_apk: "app2",
|
||||||
|
inst_resource_apk: "app3",
|
||||||
sdk_version: "test_current",
|
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/libblue.so")
|
||||||
module.Output(installPathPrefix + "/ravenwood-test/lib64/libpink.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-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.
|
// ravenwood-runtime*.so are included in the runtime, so it shouldn't be emitted.
|
||||||
for _, o := range module.AllOutputs() {
|
for _, o := range module.AllOutputs() {
|
||||||
|
Reference in New Issue
Block a user