forked from getodk/javarosa
-
Notifications
You must be signed in to change notification settings - Fork 8
/
android-api-level-checker.gradle
30 lines (26 loc) · 1.11 KB
/
android-api-level-checker.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
task androidClean(type: Delete) {
delete "$buildDir/android-api-level-checker"
}
task androidUnpackBlankProject(dependsOn: [androidClean], type: Copy) {
from zipTree("javarosa-android-api-level-checker.zip")
into "$buildDir/android-api-level-checker"
}
task androidSetMinSdkVersion(dependsOn: [androidUnpackBlankProject]) {
doLast {
def buildFile = new File("$buildDir/android-api-level-checker/app/build.gradle")
def oldBuildContents = buildFile.getText("UTF-8")
def newBuildContents = oldBuildContents.replace(
"minSdkVersion 16", // The minSdkVersion set in javarosa-android-api-level-checker.zip
"minSdkVersion ${getValue("androidMinSdkVersion", "21")}"
)
buildFile.write(newBuildContents)
}
}
task androidCopySources(dependsOn: [androidSetMinSdkVersion], type: Copy) {
from "${sourceSets.main.java.srcDirs[0]}"
into "$buildDir/android-api-level-checker/app/src/main/java"
}
task androidLint(dependsOn: [androidCopySources], type: GradleBuild) {
buildFile = "$buildDir/android-api-level-checker/build.gradle"
tasks = ['lint']
}