1apply plugin: 'android-library' 2 3archivesBaseName = 'mediarouter-v7' 4 5dependencies { 6 compile project(':v7:appcompat') 7} 8 9// some of the source requires compiling against a newer API. 10// Right now, use normal Java source sets to compile those into a jar and 11// package it as a local dependencies inside the library aar. 12 13sourceSets { 14 jellybean.java.srcDir 'jellybean' 15 jellybeanmr1.java.srcDir 'jellybean-mr1' 16 jellybeanmr2.java.srcDir 'jellybean-mr2' 17} 18 19// create a jar task for the code above 20tasks.create(name: "jar", type: Jar) { 21 from sourceSets.jellybean.output 22 from sourceSets.jellybeanmr1.output 23 from sourceSets.jellybeanmr2.output 24 baseName "internal_impl" 25} 26 27 28dependencies { 29 jellybeanCompile getAndroidPrebuilt('16') 30 31 jellybeanmr1Compile getAndroidPrebuilt('17') 32 jellybeanmr1Compile sourceSets.jellybean.output 33 34 jellybeanmr2Compile getAndroidPrebuilt('18') 35 jellybeanmr2Compile sourceSets.jellybean.output 36 jellybeanmr2Compile sourceSets.jellybeanmr1.output 37 38 compile files(jar.archivePath) 39} 40 41android { 42 compileSdkVersion "current" 43 buildToolsVersion "17" 44 45 sourceSets { 46 main.manifest.srcFile 'AndroidManifest.xml' 47 main.java.srcDir 'src' 48 main.res.srcDir 'res' 49 main.assets.srcDir 'assets' 50 main.resources.srcDir 'src' 51 instrumentTest.java.srcDir 'tests/src' 52 53 // this moves src/instrumentTest to tests so all folders follow: 54 // tests/java, tests/res, tests/assets, ... 55 // This is a *reset* so it replaces the default paths 56 instrumentTest.setRoot('tests') 57 } 58} 59 60android.libraryVariants.all { variant -> 61 variant.javaCompile.dependsOn jar 62} 63