Gradle: make paths relative to allow build with common root

This commit is contained in:
mar-v-in 2015-01-03 13:21:20 +01:00
parent e6e9f8f390
commit 854fdc1572
1 changed files with 4 additions and 4 deletions

View File

@ -20,15 +20,15 @@ dependencies {
* and then configure gradle to change the compile classpath before compiling
*/
tasks.findByPath(':preBuild').dependsOn += ':compatSetup'
tasks.getByName('preBuild').dependsOn += 'compatSetup'
task compatSetup(dependsOn: [':compat:assembleDebug', ':compat:assembleRelease']) << {
task compatSetup(dependsOn: [project('compat').path+':assembleDebug', project('compat').path+':assembleRelease']) << {
final java.util.concurrent.atomic.AtomicBoolean classpathSet = new java.util.concurrent.atomic.AtomicBoolean(false);
tasks.findAll { it.path.startsWith(':compile') && it.path.endsWith('Java') }.each {
tasks.findAll { it.name.startsWith('compile') && it.name.endsWith('Java') }.each {
it.doFirst {
if (!classpathSet.get()) {
android.applicationVariants.all {
variant -> variant.javaCompile.classpath += project(':compat').files('build/intermediates/bundles/' + (variant.name.endsWith('ebug') ? 'debug' : 'release') + '/classes.jar');
variant -> variant.javaCompile.classpath += project('compat').files('build/intermediates/bundles/' + (variant.name.endsWith('ebug') ? 'debug' : 'release') + '/classes.jar');
};
classpathSet.set(true);
}