title: Gradle: how to specify two sourcesets of library and add dependency in project
body: <p>I try to specify two different sourcesets of a gradle library and add a sourceset specific dependency in a project.</p>
  
  <p><a href="https://i.stack.imgur.com/3WAgx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3WAgx.png" alt="enter image description here"></a></p>
  
  <p>The idea is to do something like this:</p>
  
  <p>The library build.gradle file:</p>
  
  <pre><code>apply plugin: 'com.android.library'
  
  android {
     ...
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
  
              java {
                  srcDir 'src'
              }
              res {
                  srcDir 'res'
              }
          }
  
          exclude_fr_it{
              manifest.srcFile 'AndroidManifest.xml'
  
              java {
                  srcDir 'src'
              }
              res {
                  srcDir 'res'
                  exclude 'res/values/values-fr'
                  exclude 'res/values/values-it'
              }
          }
      }
  ...
  }
  ...
  </code></pre>
  
  <p>In the Project A, I want to include the main sourceset:</p>
  
  <pre><code>dependencies {
      compile project(':explore_layout')
  }
  </code></pre>
  
  <p>In the Project B, I want to include the build that use sourceset exclude_fr_it.</p>
  
  <pre><code>dependencies {
      compile project(':explore_layout') library 'exclude_fr_it'
  }
  </code></pre>
  
  <p>I tried to understand the documentation. But I don't see how this can be done...</p>
  
  <p><a href="https://discuss.gradle.org/t/specify-dependencies-for-separate-sourcesets/4556" rel="nofollow noreferrer">Question 1</a></p>
  
  <p><a href="https://docs.gradle.org/3.3/userguide/java_software.html" rel="nofollow noreferrer">Doc</a></p>
  
  <p><a href="https://discuss.gradle.org/t/dependencies-on-source-set-of-different-projects/12906" rel="nofollow noreferrer">Question 2</a></p>