apex: respect relative_install_path of rust modules

Bug: 295453836
Test: m
Change-Id: I0637d13f6f87fead3cf53a093d9ce84dea681a08
This commit is contained in:
Jooyung Han 2023-08-11 16:30:04 +09:00
parent 83a740e888
commit 4ed512b3c7
2 changed files with 11 additions and 1 deletions

View file

@ -1685,6 +1685,7 @@ func apexFileForRustExecutable(ctx android.BaseModuleContext, rustm *rust.Module
if rustm.Target().NativeBridge == android.NativeBridgeEnabled {
dirInApex = filepath.Join(dirInApex, rustm.Target().NativeBridgeRelativePath)
}
dirInApex = filepath.Join(dirInApex, rustm.RelativeInstallPath())
fileToCopy := android.OutputFileForModule(ctx, rustm, "")
androidMkModuleName := rustm.BaseModuleName() + rustm.Properties.SubName
af := newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeExecutable, rustm)
@ -1704,6 +1705,7 @@ func apexFileForRustLibrary(ctx android.BaseModuleContext, rustm *rust.Module) a
if rustm.Target().NativeBridge == android.NativeBridgeEnabled {
dirInApex = filepath.Join(dirInApex, rustm.Target().NativeBridgeRelativePath)
}
dirInApex = filepath.Join(dirInApex, rustm.RelativeInstallPath())
fileToCopy := android.OutputFileForModule(ctx, rustm, "")
androidMkModuleName := rustm.BaseModuleName() + rustm.Properties.SubName
return newApexFile(ctx, fileToCopy, androidMkModuleName, dirInApex, nativeSharedLib, rustm)

View file

@ -2794,7 +2794,7 @@ func TestFilesInSubDir(t *testing.T) {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
binaries: ["mybin"],
binaries: ["mybin", "mybin.rust"],
prebuilts: ["myetc"],
compile_multilib: "both",
updatable: false,
@ -2829,6 +2829,13 @@ func TestFilesInSubDir(t *testing.T) {
stl: "none",
apex_available: [ "myapex" ],
}
rust_binary {
name: "mybin.rust",
srcs: ["foo.rs"],
relative_install_path: "rust_subdir",
apex_available: [ "myapex" ],
}
`)
generateFsRule := ctx.ModuleForTests("myapex", "android_common_myapex_image").Rule("generateFsConfig")
@ -2847,6 +2854,7 @@ func TestFilesInSubDir(t *testing.T) {
ensureContains(t, cmd, "/bin ")
ensureContains(t, cmd, "/bin/foo ")
ensureContains(t, cmd, "/bin/foo/bar ")
ensureContains(t, cmd, "/bin/rust_subdir ")
}
func TestFilesInSubDirWhenNativeBridgeEnabled(t *testing.T) {