Cleanup and update gradle scripts

Use up-to-date gradle plugin and sdk libraries
This commit is contained in:
Daniel Schaal 2015-06-21 13:04:52 +02:00
parent 17afd9de0c
commit 45ed07475d
3 changed files with 12 additions and 99 deletions

View file

@ -1,25 +1,12 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
//apply plugin: 'robolectric'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.robolectric:robolectric-gradle-plugin:0.14.+'
}
}
android { android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
defaultConfig { defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION) minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
} }
buildTypes { buildTypes {
@ -29,27 +16,6 @@ android {
} }
} }
productFlavors {
}
sourceSets {
main {
aidl.srcDirs = ['src/main/java']
}
instrumentTest.setRoot('src/androidTest/java')
androidTest {
java.srcDir file('src/androidTest/java')
setRoot('src/androidTest/')
}
}
lintOptions { lintOptions {
checkReleaseBuilds false checkReleaseBuilds false
@ -58,40 +24,21 @@ android {
abortOnError false abortOnError false
} }
}
configurations { sourceSets {
robolectricTests { main {
extendsFrom compile aidl.srcDirs = ['src/main/java']
}
} }
} }
apply plugin: 'android-unit-test'
sourceSets {
robolectricTests {
java.srcDir file('src/androidTest/java')
resources.srcDir file('src/androidTest/resources')
compileClasspath += configurations.robolectricTests
runtimeClasspath += compileClasspath
}
}
configurations.all { configurations.all {
resolutionStrategy { resolutionStrategy {
force 'com.android.support:support-v4:21.+' force 'com.android.support:support-v4:22.2.0'
force 'com.android.support:appcompat-v7:21.+' force 'com.android.support:appcompat-v7:22.2.0'
} }
} }
afterEvaluate {
tasks.findByName("assembleDebug").dependsOn("testDebugClasses")
}
dependencies { dependencies {
// core android studio module // core android studio module
//compile project(':core') //compile project(':core')
@ -106,8 +53,8 @@ dependencies {
compile project(':ownCloud-Account-Importer') compile project(':ownCloud-Account-Importer')
compile project(':ShowcaseView:library') compile project(':ShowcaseView:library')
compile project(':android-HoloCircularProgressBar:library') compile project(':android-HoloCircularProgressBar:library')
compile 'com.android.support:support-v4:21.+' compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:21.+' compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.jakewharton:butterknife:5.1.+' compile 'com.jakewharton:butterknife:5.1.+'
compile 'com.squareup.picasso:picasso:2.3.1@jar' compile 'com.squareup.picasso:picasso:2.3.1@jar'
compile 'com.sothree.slidinguppanel:library:+' compile 'com.sothree.slidinguppanel:library:+'
@ -116,39 +63,6 @@ dependencies {
compile 'de.greenrobot:greendao-generator:1.3.1@jar' compile 'de.greenrobot:greendao-generator:1.3.1@jar'
compile 'org.freemarker:freemarker:2.3.18@jar' compile 'org.freemarker:freemarker:2.3.18@jar'
testCompile 'org.robolectric:robolectric:2.4' testCompile 'org.robolectric:robolectric:2.4'
testCompile 'junit:junit:4.+' testCompile 'junit:junit:4.+'
// these arent getting used
//androidTestCompile 'some.other.library'
//instrumentTestCompile 'additional.library'
} }
/*
task robolectric(type: Test, dependsOn: assemble) {
workingDir 'src/main'
testClassesDir = sourceSets.robolectricTests.output.classesDir
android.sourceSets.main.java.srcDirs.each { dir ->
def buildDir = dir.getAbsolutePath().split('/')
buildDir = (buildDir[0..(buildDir.length - 4)] + ['build', 'classes', 'debug']).join('/')
project.getPlugins().getPlugin('android').prepareTaskMap.each {
sourceSets.robolectricTests.compileClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
sourceSets.robolectricTests.runtimeClasspath += files(it.value.explodedDir.getAbsolutePath() + '/classes.jar')
}
sourceSets.robolectricTests.compileClasspath += files(buildDir)
sourceSets.robolectricTests.runtimeClasspath += files(buildDir)
}
classpath = sourceSets.robolectricTests.runtimeClasspath
}
*/

View file

@ -5,8 +5,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.0.0-rc2' classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.+'
} }
} }

View file

@ -18,9 +18,9 @@
# org.gradle.parallel=true # org.gradle.parallel=true
ANDROID_BUILD_MIN_SDK_VERSION=8 ANDROID_BUILD_MIN_SDK_VERSION=8
ANDROID_BUILD_TARGET_SDK_VERSION=21 ANDROID_BUILD_TARGET_SDK_VERSION=22
ANDROID_BUILD_TOOLS_VERSION=21.1.1 ANDROID_BUILD_TOOLS_VERSION=22.0.1
ANDROID_BUILD_SDK_VERSION=21 ANDROID_BUILD_SDK_VERSION=22
MIN_SDK=8 MIN_SDK=8