diff options
author | Colin Cross <ccross@android.com> | 2018-10-02 22:03:40 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-10-08 15:20:56 -0700 |
commit | a4f08813a34418a07aa0ebd8b3e704f3a82081ef (patch) | |
tree | f1956fe9c05bf91f87f8efd3aafe8daff09e1c67 /java/java.go | |
parent | b1a5e9cadfdd0765f763883fd7410add24486ef6 (diff) |
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
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go index b4b8feb23..7ef3626d6 100644 --- a/java/java.go +++ b/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: |