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