Merge "[Ravenwood] Support fonts files and data files" into main am: e372d287c0 am: 004b8fa8fe

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3268351

Change-Id: Ie4477423aaa9ef38c9995b0fcbc6f3c08b3cb854
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2024-09-14 00:12:13 +00:00
committed by Automerger Merge Worker
2 changed files with 47 additions and 32 deletions

View File

@@ -33,7 +33,6 @@ func RegisterRavenwoodBuildComponents(ctx android.RegistrationContext) {
var ravenwoodLibContentTag = dependencyTag{name: "ravenwoodlibcontent"}
var ravenwoodUtilsTag = dependencyTag{name: "ravenwoodutils"}
var ravenwoodRuntimeTag = dependencyTag{name: "ravenwoodruntime"}
var ravenwoodDataTag = dependencyTag{name: "ravenwooddata"}
var ravenwoodTestResourceApkTag = dependencyTag{name: "ravenwoodtestresapk"}
const ravenwoodUtilsName = "ravenwood-utils"
@@ -228,7 +227,10 @@ type ravenwoodLibgroupProperties struct {
Jni_libs []string
// We use this to copy framework-res.apk to the ravenwood runtime directory.
Data []string
Data []string `android:"path,arch_variant"`
// We use this to copy font files to the ravenwood runtime directory.
Fonts []string `android:"path,arch_variant"`
}
type ravenwoodLibgroup struct {
@@ -267,9 +269,6 @@ func (r *ravenwoodLibgroup) DepsMutator(ctx android.BottomUpMutatorContext) {
for _, lib := range r.ravenwoodLibgroupProperties.Jni_libs {
ctx.AddVariationDependencies(ctx.Config().BuildOSTarget.Variations(), jniLibTag, lib)
}
for _, data := range r.ravenwoodLibgroupProperties.Data {
ctx.AddVariationDependencies(nil, ravenwoodDataTag, data)
}
}
func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -309,12 +308,17 @@ func (r *ravenwoodLibgroup) GenerateAndroidBuildActions(ctx android.ModuleContex
}
dataInstallPath := installPath.Join(ctx, "ravenwood-data")
for _, data := range r.ravenwoodLibgroupProperties.Data {
libModule := ctx.GetDirectDepWithTag(data, ravenwoodDataTag)
file := android.OutputFileForModule(ctx, libModule, "")
data := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Data)
for _, file := range data {
ctx.InstallFile(dataInstallPath, file.Base(), file)
}
fontsInstallPath := installPath.Join(ctx, "fonts")
fonts := android.PathsForModuleSrc(ctx, r.ravenwoodLibgroupProperties.Fonts)
for _, file := range fonts {
ctx.InstallFile(fontsInstallPath, file.Base(), file)
}
// Normal build should perform install steps
ctx.Phony(r.BaseModuleName(), android.PathForPhony(ctx, r.BaseModuleName()+"-install"))
}

View File

@@ -19,6 +19,7 @@ import (
"testing"
"android/soong/android"
"android/soong/etc"
)
var prepareRavenwoodRuntime = android.GroupFixturePreparers(
@@ -65,6 +66,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
name: "app2",
sdk_version: "current",
}
prebuilt_font {
name: "Font.ttf",
src: "Font.ttf",
}
android_ravenwood_libgroup {
name: "ravenwood-runtime",
libs: [
@@ -76,7 +81,10 @@ var prepareRavenwoodRuntime = android.GroupFixturePreparers(
"ravenwood-runtime-jni2",
],
data: [
"app1",
":app1",
],
fonts: [
":Font.ttf"
],
}
android_ravenwood_libgroup {
@@ -97,6 +105,7 @@ func TestRavenwoodRuntime(t *testing.T) {
ctx := android.GroupFixturePreparers(
PrepareForIntegrationTestWithJava,
etc.PrepareForTestWithPrebuiltEtc,
prepareRavenwoodRuntime,
).RunTest(t)
@@ -114,6 +123,7 @@ func TestRavenwoodRuntime(t *testing.T) {
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/libred.so")
runtime.Output(installPathPrefix + "/ravenwood-runtime/lib64/ravenwood-runtime-jni3.so")
runtime.Output(installPathPrefix + "/ravenwood-runtime/ravenwood-data/app1.apk")
runtime.Output(installPathPrefix + "/ravenwood-runtime/fonts/Font.ttf")
utils := ctx.ModuleForTests("ravenwood-utils", "android_common")
utils.Output(installPathPrefix + "/ravenwood-utils/framework-rules.ravenwood.jar")
}
@@ -125,6 +135,7 @@ func TestRavenwoodTest(t *testing.T) {
ctx := android.GroupFixturePreparers(
PrepareForIntegrationTestWithJava,
etc.PrepareForTestWithPrebuiltEtc,
prepareRavenwoodRuntime,
).RunTestWithBp(t, `
cc_library_shared {