Merge "Don't use SDK variant for vendor JNI libraries" am: cb1d161666
am: d75524f322
Change-Id: I5684f17281e31e8d6ffc9d0c7541d55c1bbd0bba
This commit is contained in:
47
java/app.go
47
java/app.go
@@ -252,7 +252,10 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
||||
// If the app builds against an Android SDK use the SDK variant of JNI dependencies
|
||||
// unless jni_uses_platform_apis is set.
|
||||
if (usesSDK && !Bool(a.appProperties.Jni_uses_platform_apis)) ||
|
||||
// Don't require the SDK variant for apps that are shipped on vendor, etc., as they already
|
||||
// have stable APIs through the VNDK.
|
||||
if (usesSDK && !a.RequiresStableAPIs(ctx) &&
|
||||
!Bool(a.appProperties.Jni_uses_platform_apis)) ||
|
||||
Bool(a.appProperties.Jni_uses_sdk_apis) {
|
||||
variation = append(variation, blueprint.Variation{Mutator: "sdk", Variation: "sdk"})
|
||||
}
|
||||
@@ -615,7 +618,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
|
||||
dexJarFile := a.dexBuildActions(ctx)
|
||||
|
||||
jniLibs, certificateDeps := collectAppDeps(ctx, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis))
|
||||
jniLibs, certificateDeps := collectAppDeps(ctx, a, a.shouldEmbedJnis(ctx), !Bool(a.appProperties.Jni_uses_platform_apis))
|
||||
jniJarFile := a.jniBuildActions(jniLibs, ctx)
|
||||
|
||||
if ctx.Failed() {
|
||||
@@ -671,12 +674,25 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
a.buildAppDependencyInfo(ctx)
|
||||
}
|
||||
|
||||
func collectAppDeps(ctx android.ModuleContext, shouldCollectRecursiveNativeDeps bool,
|
||||
type appDepsInterface interface {
|
||||
sdkVersion() sdkSpec
|
||||
minSdkVersion() sdkSpec
|
||||
RequiresStableAPIs(ctx android.BaseModuleContext) bool
|
||||
}
|
||||
|
||||
func collectAppDeps(ctx android.ModuleContext, app appDepsInterface,
|
||||
shouldCollectRecursiveNativeDeps bool,
|
||||
checkNativeSdkVersion bool) ([]jniLib, []Certificate) {
|
||||
|
||||
var jniLibs []jniLib
|
||||
var certificates []Certificate
|
||||
seenModulePaths := make(map[string]bool)
|
||||
|
||||
if checkNativeSdkVersion {
|
||||
checkNativeSdkVersion = app.sdkVersion().specified() &&
|
||||
app.sdkVersion().kind != sdkCorePlatform && !app.RequiresStableAPIs(ctx)
|
||||
}
|
||||
|
||||
ctx.WalkDeps(func(module android.Module, parent android.Module) bool {
|
||||
otherName := ctx.OtherModuleName(module)
|
||||
tag := ctx.OtherModuleDependencyTag(module)
|
||||
@@ -694,16 +710,9 @@ func collectAppDeps(ctx android.ModuleContext, shouldCollectRecursiveNativeDeps
|
||||
}
|
||||
seenModulePaths[path.String()] = true
|
||||
|
||||
if checkNativeSdkVersion {
|
||||
if app, ok := ctx.Module().(interface{ sdkVersion() sdkSpec }); ok {
|
||||
if app.sdkVersion().specified() &&
|
||||
app.sdkVersion().kind != sdkCorePlatform &&
|
||||
dep.SdkVersion() == "" {
|
||||
ctx.PropertyErrorf("jni_libs",
|
||||
"JNI dependency %q uses platform APIs, but this module does not",
|
||||
otherName)
|
||||
}
|
||||
}
|
||||
if checkNativeSdkVersion && dep.SdkVersion() == "" {
|
||||
ctx.PropertyErrorf("jni_libs", "JNI dependency %q uses platform APIs, but this module does not",
|
||||
otherName)
|
||||
}
|
||||
|
||||
if lib.Valid() {
|
||||
@@ -1293,7 +1302,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
|
||||
ctx.ModuleErrorf("One and only one of certficate, presigned, and default_dev_cert properties must be set")
|
||||
}
|
||||
|
||||
_, certificates := collectAppDeps(ctx, false, false)
|
||||
_, certificates := collectAppDeps(ctx, a, false, false)
|
||||
|
||||
// TODO: LOCAL_EXTRACT_APK/LOCAL_EXTRACT_DPI_APK
|
||||
// TODO: LOCAL_PACKAGE_SPLITS
|
||||
@@ -1419,6 +1428,14 @@ func (a *AndroidAppImport) DepIsInSameApex(ctx android.BaseModuleContext, dep an
|
||||
return false
|
||||
}
|
||||
|
||||
func (a *AndroidAppImport) sdkVersion() sdkSpec {
|
||||
return sdkSpecFrom("")
|
||||
}
|
||||
|
||||
func (a *AndroidAppImport) minSdkVersion() sdkSpec {
|
||||
return sdkSpecFrom("")
|
||||
}
|
||||
|
||||
func createVariantGroupType(variants []string, variantGroupName string) reflect.Type {
|
||||
props := reflect.TypeOf((*AndroidAppImportProperties)(nil))
|
||||
|
||||
@@ -1604,7 +1621,7 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
|
||||
r.aapt.buildActions(ctx, r, aaptLinkFlags...)
|
||||
|
||||
// Sign the built package
|
||||
_, certificates := collectAppDeps(ctx, false, false)
|
||||
_, certificates := collectAppDeps(ctx, r, false, false)
|
||||
certificates = processMainCert(r.ModuleBase, String(r.properties.Certificate), certificates, ctx)
|
||||
signed := android.PathForModuleOut(ctx, "signed", r.Name()+".apk")
|
||||
SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, nil)
|
||||
|
Reference in New Issue
Block a user