lukas
lukas

Reputation: 495

gradle: modify build of library from project

I have a simple question. Is it possible to modify the gradle library build project specific and how?

Following example, I have a library that I use in multiple projects. Now I want to exclude some files in the library when I build Project_A.

But I want them included when I build Project_B.

enter image description here

I wonder if its possible to add parameters to the dependencies in the build.gradle file of Projekt_A. Something like:

dependencies {
    compile project(':explore_layout', 
        //specify the exclude inside the lib
        sourceSets {
           main {
               java {
                   exclude '**/uncompilable/**'
               }
           }
        }
    )
}

Upvotes: 1

Views: 194

Answers (1)

Vampire
Vampire

Reputation: 38619

Make two source sets in your library project and then depend on the the according configurations that are added for the source sets. This way you can get only one source set for A but both for B.

Upvotes: 3

Related Questions