rust modules can be included in apex
We will have some APEXes having rust binaries and libraries. So, adding the support for the types of modules. rust.Module now inherits from android.ApexModuleBase and implements the android.ApexModule interface. Bug: 172414324 Test: m Exempt-From-Owner-Approval: rebased after +2 from the owner Change-Id: I356ef4c45f782a6460f001e83af96d1710642d80
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"android/soong/dexpreopt"
|
||||
prebuilt_etc "android/soong/etc"
|
||||
"android/soong/java"
|
||||
"android/soong/rust"
|
||||
"android/soong/sh"
|
||||
)
|
||||
|
||||
@@ -136,6 +137,8 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||
|
||||
bp = bp + cc.GatherRequiredDepsForTest(android.Android)
|
||||
|
||||
bp = bp + rust.GatherRequiredDepsForTest()
|
||||
|
||||
bp = bp + java.GatherRequiredDepsForTest()
|
||||
|
||||
fs := map[string][]byte{
|
||||
@@ -185,6 +188,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||
"bar/baz": nil,
|
||||
"testdata/baz": nil,
|
||||
"AppSet.apks": nil,
|
||||
"foo.rs": nil,
|
||||
}
|
||||
|
||||
cc.GatherRequiredFilesForTest(fs)
|
||||
@@ -241,6 +245,7 @@ func testApexContext(_ *testing.T, bp string, handlers ...testCustomizer) (*andr
|
||||
ctx.PostDepsMutators(android.RegisterVisibilityRuleEnforcer)
|
||||
|
||||
cc.RegisterRequiredBuildComponentsForTest(ctx)
|
||||
rust.RegisterRequiredBuildComponentsForTest(ctx)
|
||||
|
||||
ctx.RegisterModuleType("cc_test", cc.TestFactory)
|
||||
ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory)
|
||||
@@ -349,10 +354,12 @@ func TestBasicApex(t *testing.T) {
|
||||
manifest: ":myapex.manifest",
|
||||
androidManifest: ":myapex.androidmanifest",
|
||||
key: "myapex.key",
|
||||
binaries: ["foo.rust"],
|
||||
native_shared_libs: ["mylib"],
|
||||
rust_dyn_libs: ["libfoo.dylib.rust"],
|
||||
multilib: {
|
||||
both: {
|
||||
binaries: ["foo",],
|
||||
binaries: ["foo"],
|
||||
}
|
||||
},
|
||||
java_libs: [
|
||||
@@ -415,6 +422,28 @@ func TestBasicApex(t *testing.T) {
|
||||
apex_available: [ "myapex", "com.android.gki.*" ],
|
||||
}
|
||||
|
||||
rust_binary {
|
||||
name: "foo.rust",
|
||||
srcs: ["foo.rs"],
|
||||
rlibs: ["libfoo.rlib.rust"],
|
||||
dylibs: ["libfoo.dylib.rust"],
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
rust_library_rlib {
|
||||
name: "libfoo.rlib.rust",
|
||||
srcs: ["foo.rs"],
|
||||
crate_name: "foo",
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
rust_library_dylib {
|
||||
name: "libfoo.dylib.rust",
|
||||
srcs: ["foo.rs"],
|
||||
crate_name: "foo",
|
||||
apex_available: ["myapex"],
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.gki.fake",
|
||||
binaries: ["foo"],
|
||||
@@ -529,16 +558,20 @@ func TestBasicApex(t *testing.T) {
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("mylib"), "android_arm64_armv8-a_shared_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("myjar"), "android_common_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("myjar_dex"), "android_common_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("foo.rust"), "android_arm64_armv8-a_apex10000")
|
||||
|
||||
// Ensure that apex variant is created for the indirect dep
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("mylib2"), "android_arm64_armv8-a_shared_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("myotherjar"), "android_common_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo.rlib.rust"), "android_arm64_armv8-a_rlib_dylib-std_apex10000")
|
||||
ensureListContains(t, ctx.ModuleVariantsForTests("libfoo.dylib.rust"), "android_arm64_armv8-a_dylib_apex10000")
|
||||
|
||||
// Ensure that both direct and indirect deps are copied into apex
|
||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib.so")
|
||||
ensureContains(t, copyCmds, "image.apex/lib64/mylib2.so")
|
||||
ensureContains(t, copyCmds, "image.apex/javalib/myjar_stem.jar")
|
||||
ensureContains(t, copyCmds, "image.apex/javalib/myjar_dex.jar")
|
||||
ensureContains(t, copyCmds, "image.apex/lib64/libfoo.dylib.rust.dylib.so")
|
||||
// .. but not for java libs
|
||||
ensureNotContains(t, copyCmds, "image.apex/javalib/myotherjar.jar")
|
||||
ensureNotContains(t, copyCmds, "image.apex/javalib/msharedjar.jar")
|
||||
|
Reference in New Issue
Block a user