1

I currently have a series of components with java, aidl, assets, resources, jni, and manifests and proguard files to support the components.

I would like to deliver AAR files with a number of different combinations of these components.

I would like to be able to debug the code in each component when assembled (which I think means making a project that includes all the components source files, as AAR explosion doesn't do release/debug variants.)

I want to use the experimental gradle plug in for the NDK part.

My first hack looks like:

model {
    android {
         // ... stuff
         sources {
             main {
                 def mySourceSet = ["../../sourceTree/client",
                                   "../../sourceTree/instrumentation",
                                   "../../sourceTree/engine"]
                 java {
                     source {
                         srcDirs = mySourceSet } } }
                 aidl {
                     source {
                         srcDirs = mySourceSet } } }
                 resources {
                     source {
                         srcDirs = mySourceSet } } }
                 assets {
                     source {
                         srcDirs = mySourceSet } } }
                 manifest {
                     source {
                         srcDirs = mySourceSet } } }
                 jniLibs {
                     source {
                         srcDirs = mySourceSet } } }
                 jni {
                     source {
                         srcDirs = mySourceSet } } }
                 }
            }
        }
    }

The java classes get combined as I would like. The aidl files get combined as I would like.

Everything else is not quite there (manifests aren't merged, resources/assets pick up java classes, and still using old .so from previous build system.)

Going into the different rules, it looks like mySourceSet is going to need repetition to do the right thing for the non java/aidl files to get the format right to pick things up (or exclude them.) I've been trying (with little success) to see what I can do with += notation and if I can move those to a gradle settings/config fragment in the sourceTree, include it, and have it modify the srcDirs.

I'd like something like one of these to work:

 model { android { sources { main { aidl { source { srcDirs += "../../sourceTree/instrumentation" } } } } } } 
 model.android.sources.main.aidl.source <<  { srcDirs += "../../sourceTree/instrumentation" }
 model.android << { sources { main { aidl { source { srcDirs += "../../sourceTree/instrumentation" } } } } } 

but they fail with various "you can't do that" errors.

Is there a way to set the srcDirs outside the android { model {}} block?

Any hints on how to make the assets/resources/manifest merge correctly given a list of top level directories it should look through?

Dan Schmitt
  • 126
  • 1
  • 4

0 Answers0