Add support for JNI libraries to android_app modules
Make android_app modules a MultiTargets module, which means the common variant will have a list of Targets that it needs to handle. Collect JNI libraries for each Target, and package them into or alongside the APK. Bug: 80095087 Test: app_test.go Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
This commit is contained in:
20
java/java.go
20
java/java.go
@@ -95,9 +95,6 @@ type CompilerProperties struct {
|
||||
// list of java libraries that will be compiled into the resulting jar
|
||||
Static_libs []string `android:"arch_variant"`
|
||||
|
||||
// list of native libraries that will be provided in or alongside the resulting jar
|
||||
Jni_libs []string `android:"arch_variant"`
|
||||
|
||||
// manifest file to be included in resulting jar
|
||||
Manifest *string
|
||||
|
||||
@@ -365,6 +362,11 @@ type dependencyTag struct {
|
||||
name string
|
||||
}
|
||||
|
||||
type jniDependencyTag struct {
|
||||
blueprint.BaseDependencyTag
|
||||
target android.Target
|
||||
}
|
||||
|
||||
var (
|
||||
staticLibTag = dependencyTag{name: "staticlib"}
|
||||
libTag = dependencyTag{name: "javalib"}
|
||||
@@ -389,6 +391,12 @@ type sdkDep struct {
|
||||
aidl android.Path
|
||||
}
|
||||
|
||||
type jniLib struct {
|
||||
name string
|
||||
path android.Path
|
||||
target android.Target
|
||||
}
|
||||
|
||||
func (j *Module) shouldInstrument(ctx android.BaseContext) bool {
|
||||
return j.properties.Instrument && ctx.Config().IsEnvTrue("EMMA_INSTRUMENT")
|
||||
}
|
||||
@@ -597,6 +605,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
|
||||
ctx.AddFarVariationDependencies([]blueprint.Variation{
|
||||
{Mutator: "arch", Variation: ctx.Config().BuildOsCommonVariant},
|
||||
}, annoTag, j.properties.Annotation_processors...)
|
||||
|
||||
android.ExtractSourcesDeps(ctx, j.properties.Srcs)
|
||||
android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs)
|
||||
android.ExtractSourcesDeps(ctx, j.properties.Java_resources)
|
||||
@@ -787,6 +796,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
||||
otherName := ctx.OtherModuleName(module)
|
||||
tag := ctx.OtherModuleDependencyTag(module)
|
||||
|
||||
if _, ok := tag.(*jniDependencyTag); ok {
|
||||
// Handled by AndroidApp.collectJniDeps
|
||||
return
|
||||
}
|
||||
|
||||
if to, ok := module.(*Library); ok {
|
||||
switch tag {
|
||||
case bootClasspathTag, libTag, staticLibTag:
|
||||
|
Reference in New Issue
Block a user