Loading apex/apex_test.go +26 −28 Original line number Diff line number Diff line Loading @@ -12168,34 +12168,32 @@ func TestApexVerifyNativeImplementationLibs(t *testing.T) { }, dependencyPath: []string{"myapex", "libjni", "libbar", "libplatform"}, }, // TODO: embedded JNI in apps should be checked too, but Soong currently just packages the transitive // JNI libraries even if they came from another apex. //{ // name: "app jni library dependency in other apex", // bpModifier: addToSharedLibs("libembeddedjni", "libotherapex#impl"), // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libotherapex"}, //}, //{ // name: "transitive app jni library dependency in other apex", // bpModifier: func(bp *bpmodify.Blueprint) { // addToSharedLibs("libembeddedjni", "libbar")(bp) // addToSharedLibs("libbar", "libotherapex#impl")(bp) // }, // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libotherapex"}, //}, //{ // name: "app jni library dependency in platform", // bpModifier: addToSharedLibs("libembeddedjni", "libplatform#impl"), // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libplatform"}, //}, //{ // name: "transitive app jni library dependency in platform", // bpModifier: func(bp *bpmodify.Blueprint) { // addToSharedLibs("libembeddedjni", "libbar")(bp) // addToSharedLibs("libbar", "libplatform#impl")(bp) // }, // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libplatform"}, //}, { name: "app jni library dependency in other apex", bpModifier: addToSharedLibs("libembeddedjni", "libotherapex#impl"), dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libotherapex"}, }, { name: "transitive app jni library dependency in other apex", bpModifier: func(bp *bpmodify.Blueprint) { addToSharedLibs("libembeddedjni", "libbar")(bp) addToSharedLibs("libbar", "libotherapex#impl")(bp) }, dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libotherapex"}, }, { name: "app jni library dependency in platform", bpModifier: addToSharedLibs("libembeddedjni", "libplatform#impl"), dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libplatform"}, }, { name: "transitive app jni library dependency in platform", bpModifier: func(bp *bpmodify.Blueprint) { addToSharedLibs("libembeddedjni", "libbar")(bp) addToSharedLibs("libbar", "libplatform#impl")(bp) }, dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libplatform"}, }, { name: "binary dependency in other apex", bpModifier: addToSharedLibs("mybin", "libotherapex#impl"), Loading cc/cc.go +5 −5 Original line number Diff line number Diff line Loading @@ -3345,17 +3345,17 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { return depPaths } func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool { func ShouldUseStubForApex(ctx android.ModuleContext, parent, dep android.Module) bool { inVendorOrProduct := false bootstrap := false if linkable, ok := ctx.Module().(LinkableInterface); !ok { panic(fmt.Errorf("Not a Linkable module: %q", ctx.ModuleName())) if linkable, ok := parent.(LinkableInterface); !ok { ctx.ModuleErrorf("Not a Linkable module: %q", ctx.ModuleName()) } else { inVendorOrProduct = linkable.InVendorOrProduct() bootstrap = linkable.Bootstrap() } apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) apexInfo, _ := android.OtherModuleProvider(ctx, parent, android.ApexInfoProvider) useStubs := false Loading Loading @@ -3402,7 +3402,7 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr if !libDepTag.explicitlyVersioned && len(sharedLibraryStubsInfo.SharedStubLibraries) > 0 { // when to use (unspecified) stubs, use the latest one. if ShouldUseStubForApex(ctx, dep) { if ShouldUseStubForApex(ctx, ctx.Module(), dep) { stubs := sharedLibraryStubsInfo.SharedStubLibraries toUse := stubs[len(stubs)-1] sharedLibraryInfo = toUse.SharedLibraryInfo Loading cc/config/global.go +1 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,7 @@ var ( "-Werror=int-to-pointer-cast", "-Werror=pointer-to-int-cast", "-Werror=xor-used-as-pow", "-Wimplicit-int-float-conversion", // http://b/161386391 for -Wno-void-pointer-to-enum-cast "-Wno-void-pointer-to-enum-cast", // http://b/161386391 for -Wno-void-pointer-to-int-cast Loading cc/linkable.go +4 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,10 @@ type LinkableInterface interface { // IsNdk returns true if the library is in the configs known NDK list. IsNdk(config android.Config) bool // HasStubsVariants true if this module is a stub or has a sibling variant // that is a stub. HasStubsVariants() bool // IsStubs returns true if the this is a stubs library. IsStubs() bool Loading java/app.go +13 −3 Original line number Diff line number Diff line Loading @@ -1082,7 +1082,17 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface, app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx) } jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps, checkNativeSdkVersion, func(dep cc.LinkableInterface) bool { return !dep.IsNdk(ctx.Config()) && !dep.IsStubs() }) checkNativeSdkVersion, func(parent, child android.Module) bool { childLinkable, _ := child.(cc.LinkableInterface) parentLinkable, _ := parent.(cc.LinkableInterface) useStubsOfDep := childLinkable.IsStubs() if parent.(android.ApexModule).NotInPlatform() && parentLinkable != nil { // APK-in-APEX // If the parent is a linkable interface, use stubs if the dependency edge crosses an apex boundary. useStubsOfDep = useStubsOfDep || (childLinkable.HasStubsVariants() && cc.ShouldUseStubForApex(ctx, parent, child)) } return !childLinkable.IsNdk(ctx.Config()) && !useStubsOfDep }) var certificates []Certificate Loading Loading @@ -1117,7 +1127,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface, func collectJniDeps(ctx android.ModuleContext, shouldCollectRecursiveNativeDeps bool, checkNativeSdkVersion bool, filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) { filter func(parent, child android.Module) bool) ([]jniLib, android.Paths) { var jniLibs []jniLib var prebuiltJniPackages android.Paths seenModulePaths := make(map[string]bool) Loading @@ -1128,7 +1138,7 @@ func collectJniDeps(ctx android.ModuleContext, if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) { if dep, ok := module.(cc.LinkableInterface); ok { if filter != nil && !filter(dep) { if filter != nil && !filter(parent, module) { return false } Loading Loading
apex/apex_test.go +26 −28 Original line number Diff line number Diff line Loading @@ -12168,34 +12168,32 @@ func TestApexVerifyNativeImplementationLibs(t *testing.T) { }, dependencyPath: []string{"myapex", "libjni", "libbar", "libplatform"}, }, // TODO: embedded JNI in apps should be checked too, but Soong currently just packages the transitive // JNI libraries even if they came from another apex. //{ // name: "app jni library dependency in other apex", // bpModifier: addToSharedLibs("libembeddedjni", "libotherapex#impl"), // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libotherapex"}, //}, //{ // name: "transitive app jni library dependency in other apex", // bpModifier: func(bp *bpmodify.Blueprint) { // addToSharedLibs("libembeddedjni", "libbar")(bp) // addToSharedLibs("libbar", "libotherapex#impl")(bp) // }, // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libotherapex"}, //}, //{ // name: "app jni library dependency in platform", // bpModifier: addToSharedLibs("libembeddedjni", "libplatform#impl"), // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libplatform"}, //}, //{ // name: "transitive app jni library dependency in platform", // bpModifier: func(bp *bpmodify.Blueprint) { // addToSharedLibs("libembeddedjni", "libbar")(bp) // addToSharedLibs("libbar", "libplatform#impl")(bp) // }, // dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libplatform"}, //}, { name: "app jni library dependency in other apex", bpModifier: addToSharedLibs("libembeddedjni", "libotherapex#impl"), dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libotherapex"}, }, { name: "transitive app jni library dependency in other apex", bpModifier: func(bp *bpmodify.Blueprint) { addToSharedLibs("libembeddedjni", "libbar")(bp) addToSharedLibs("libbar", "libotherapex#impl")(bp) }, dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libotherapex"}, }, { name: "app jni library dependency in platform", bpModifier: addToSharedLibs("libembeddedjni", "libplatform#impl"), dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libplatform"}, }, { name: "transitive app jni library dependency in platform", bpModifier: func(bp *bpmodify.Blueprint) { addToSharedLibs("libembeddedjni", "libbar")(bp) addToSharedLibs("libbar", "libplatform#impl")(bp) }, dependencyPath: []string{"myapex", "myapp", "libembeddedjni", "libbar", "libplatform"}, }, { name: "binary dependency in other apex", bpModifier: addToSharedLibs("mybin", "libotherapex#impl"), Loading
cc/cc.go +5 −5 Original line number Diff line number Diff line Loading @@ -3345,17 +3345,17 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { return depPaths } func ShouldUseStubForApex(ctx android.ModuleContext, dep android.Module) bool { func ShouldUseStubForApex(ctx android.ModuleContext, parent, dep android.Module) bool { inVendorOrProduct := false bootstrap := false if linkable, ok := ctx.Module().(LinkableInterface); !ok { panic(fmt.Errorf("Not a Linkable module: %q", ctx.ModuleName())) if linkable, ok := parent.(LinkableInterface); !ok { ctx.ModuleErrorf("Not a Linkable module: %q", ctx.ModuleName()) } else { inVendorOrProduct = linkable.InVendorOrProduct() bootstrap = linkable.Bootstrap() } apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) apexInfo, _ := android.OtherModuleProvider(ctx, parent, android.ApexInfoProvider) useStubs := false Loading Loading @@ -3402,7 +3402,7 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr if !libDepTag.explicitlyVersioned && len(sharedLibraryStubsInfo.SharedStubLibraries) > 0 { // when to use (unspecified) stubs, use the latest one. if ShouldUseStubForApex(ctx, dep) { if ShouldUseStubForApex(ctx, ctx.Module(), dep) { stubs := sharedLibraryStubsInfo.SharedStubLibraries toUse := stubs[len(stubs)-1] sharedLibraryInfo = toUse.SharedLibraryInfo Loading
cc/config/global.go +1 −0 Original line number Diff line number Diff line Loading @@ -245,6 +245,7 @@ var ( "-Werror=int-to-pointer-cast", "-Werror=pointer-to-int-cast", "-Werror=xor-used-as-pow", "-Wimplicit-int-float-conversion", // http://b/161386391 for -Wno-void-pointer-to-enum-cast "-Wno-void-pointer-to-enum-cast", // http://b/161386391 for -Wno-void-pointer-to-int-cast Loading
cc/linkable.go +4 −0 Original line number Diff line number Diff line Loading @@ -135,6 +135,10 @@ type LinkableInterface interface { // IsNdk returns true if the library is in the configs known NDK list. IsNdk(config android.Config) bool // HasStubsVariants true if this module is a stub or has a sibling variant // that is a stub. HasStubsVariants() bool // IsStubs returns true if the this is a stubs library. IsStubs() bool Loading
java/app.go +13 −3 Original line number Diff line number Diff line Loading @@ -1082,7 +1082,17 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface, app.SdkVersion(ctx).Kind != android.SdkCorePlatform && !app.RequiresStableAPIs(ctx) } jniLib, prebuiltJniPackages := collectJniDeps(ctx, shouldCollectRecursiveNativeDeps, checkNativeSdkVersion, func(dep cc.LinkableInterface) bool { return !dep.IsNdk(ctx.Config()) && !dep.IsStubs() }) checkNativeSdkVersion, func(parent, child android.Module) bool { childLinkable, _ := child.(cc.LinkableInterface) parentLinkable, _ := parent.(cc.LinkableInterface) useStubsOfDep := childLinkable.IsStubs() if parent.(android.ApexModule).NotInPlatform() && parentLinkable != nil { // APK-in-APEX // If the parent is a linkable interface, use stubs if the dependency edge crosses an apex boundary. useStubsOfDep = useStubsOfDep || (childLinkable.HasStubsVariants() && cc.ShouldUseStubForApex(ctx, parent, child)) } return !childLinkable.IsNdk(ctx.Config()) && !useStubsOfDep }) var certificates []Certificate Loading Loading @@ -1117,7 +1127,7 @@ func collectAppDeps(ctx android.ModuleContext, app appDepsInterface, func collectJniDeps(ctx android.ModuleContext, shouldCollectRecursiveNativeDeps bool, checkNativeSdkVersion bool, filter func(cc.LinkableInterface) bool) ([]jniLib, android.Paths) { filter func(parent, child android.Module) bool) ([]jniLib, android.Paths) { var jniLibs []jniLib var prebuiltJniPackages android.Paths seenModulePaths := make(map[string]bool) Loading @@ -1128,7 +1138,7 @@ func collectJniDeps(ctx android.ModuleContext, if IsJniDepTag(tag) || cc.IsSharedDepTag(tag) { if dep, ok := module.(cc.LinkableInterface); ok { if filter != nil && !filter(dep) { if filter != nil && !filter(parent, module) { return false } Loading