Merge "Error if vendor apex adds an LLNDK library" into main
This commit is contained in:
11
apex/apex.go
11
apex/apex.go
@@ -2067,8 +2067,15 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
switch depTag {
|
switch depTag {
|
||||||
case sharedLibTag, jniLibTag:
|
case sharedLibTag, jniLibTag:
|
||||||
isJniLib := depTag == jniLibTag
|
isJniLib := depTag == jniLibTag
|
||||||
|
propertyName := "native_shared_libs"
|
||||||
|
if isJniLib {
|
||||||
|
propertyName = "jni_libs"
|
||||||
|
}
|
||||||
switch ch := child.(type) {
|
switch ch := child.(type) {
|
||||||
case *cc.Module:
|
case *cc.Module:
|
||||||
|
if ch.IsStubs() {
|
||||||
|
ctx.PropertyErrorf(propertyName, "%q is a stub. Remove it from the list.", depName)
|
||||||
|
}
|
||||||
fi := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
|
fi := apexFileForNativeLibrary(ctx, ch, vctx.handleSpecialLibs)
|
||||||
fi.isJniLib = isJniLib
|
fi.isJniLib = isJniLib
|
||||||
vctx.filesInfo = append(vctx.filesInfo, fi)
|
vctx.filesInfo = append(vctx.filesInfo, fi)
|
||||||
@@ -2086,10 +2093,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
|
|||||||
vctx.filesInfo = append(vctx.filesInfo, fi)
|
vctx.filesInfo = append(vctx.filesInfo, fi)
|
||||||
return true // track transitive dependencies
|
return true // track transitive dependencies
|
||||||
default:
|
default:
|
||||||
propertyName := "native_shared_libs"
|
|
||||||
if isJniLib {
|
|
||||||
propertyName = "jni_libs"
|
|
||||||
}
|
|
||||||
ctx.PropertyErrorf(propertyName, "%q is not a cc_library or cc_library_shared module", depName)
|
ctx.PropertyErrorf(propertyName, "%q is not a cc_library or cc_library_shared module", depName)
|
||||||
}
|
}
|
||||||
case executableTag:
|
case executableTag:
|
||||||
|
@@ -26,6 +26,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"android/soong/aconfig/codegen"
|
"android/soong/aconfig/codegen"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
"github.com/google/blueprint/proptools"
|
"github.com/google/blueprint/proptools"
|
||||||
|
|
||||||
@@ -960,6 +961,32 @@ func TestApexWithStubs(t *testing.T) {
|
|||||||
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
|
ensureListContains(t, names(apexManifestRule.Args["requireNativeLibs"]), "libfoo.shared_from_rust.so")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestApexShouldNotEmbedStubVariant(t *testing.T) {
|
||||||
|
testApexError(t, `module "myapex" .*: native_shared_libs: "libbar" is a stub`, `
|
||||||
|
apex {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
vendor: true,
|
||||||
|
updatable: false,
|
||||||
|
native_shared_libs: ["libbar"], // should not add an LLNDK stub in a vendor apex
|
||||||
|
}
|
||||||
|
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libbar",
|
||||||
|
srcs: ["mylib.cpp"],
|
||||||
|
llndk: {
|
||||||
|
symbol_file: "libbar.map.txt",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
func TestApexCanUsePrivateApis(t *testing.T) {
|
func TestApexCanUsePrivateApis(t *testing.T) {
|
||||||
ctx := testApex(t, `
|
ctx := testApex(t, `
|
||||||
apex {
|
apex {
|
||||||
|
Reference in New Issue
Block a user