
* Don't apply android plugin in root project This results in the root project being treated like and Android project. That is, gradle will expect an AndroidManifest, a targetSdk property, and all sorts of stuff that is not relevant to the root project. Perhaps more importantly, this breaks integration with Android Studio, which is the tool that many potential contributors will be using. Finally, it also allows runing gradle tasks in the root project, rather than having to cd into the F-Droid directory, which is a minor nicety. The reason it was there in the first place was to make it so that we could find the location of the Android SDK using the same mechanism that the plugin used. To deal with this, this commit adapts the SDK finding code from the gradle plugin. * Make gradle error out when missing depenencies. The support v4 library requires some obsolte SDKs that are likely not installed. It caused non-intuitive errors to come up for me, so I've made gradle tell the user when this occurs. * Documented the main build.gradle file This is primarily to explain the hacks we use in order to build the Android support libraries.
80 lines
2.3 KiB
Groovy
80 lines
2.3 KiB
Groovy
apply plugin: 'com.android.application'
|
|
|
|
dependencies {
|
|
compile project(':support-v4')
|
|
compile project(':support-appcompat-v7')
|
|
compile project(':extern:AndroidPinning')
|
|
compile project(':extern:UniversalImageLoader:library')
|
|
compile project(':extern:MemorizingTrustManager')
|
|
compile project(':extern:libsuperuser:libsuperuser')
|
|
compile project(':extern:nanohttpd:core')
|
|
compile project(':extern:jmdns')
|
|
compile project(':extern:zipsigner')
|
|
compile project(':extern:zxing-core')
|
|
compile( project(':extern:android-support-v4-preferencefragment') ) {
|
|
exclude module: 'support-v4'
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 21
|
|
buildToolsVersion '21.1.2'
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_7
|
|
targetCompatibility JavaVersion.VERSION_1_7
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
manifest.srcFile 'AndroidManifest.xml'
|
|
java.srcDirs = ['src']
|
|
resources.srcDirs = ['src']
|
|
aidl.srcDirs = ['src']
|
|
renderscript.srcDirs = ['src']
|
|
res.srcDirs = ['res']
|
|
assets.srcDirs = ['assets']
|
|
}
|
|
|
|
instrumentTest.setRoot('test')
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
}
|
|
}
|
|
|
|
compileOptions.encoding = "UTF-8"
|
|
|
|
// Enable all Android lint warnings
|
|
gradle.projectsEvaluated {
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs << "-Xlint:all"
|
|
}
|
|
}
|
|
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
|
|
}
|
|
|
|
// TODO: This person took the example code below from another blogpost online, however
|
|
// I lost the reference to it:
|
|
// http://stackoverflow.com/questions/23297562/gradle-javadoc-and-android-documentation
|
|
android.applicationVariants.all { variant ->
|
|
|
|
task("generate${variant.name}Javadoc", type: Javadoc) {
|
|
title = "$name $version API"
|
|
description "Generates Javadoc for F-Droid."
|
|
source = variant.javaCompile.source
|
|
ext.androidJar = "${android.plugin.sdkFolder}/platforms/${android.compileSdkVersion}/android.jar"
|
|
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
|
|
options.links("http://docs.oracle.com/javase/7/docs/api/");
|
|
options.links("http://d.android.com/reference/");
|
|
exclude '**/BuildConfig.java'
|
|
exclude '**/R.java'
|
|
}
|
|
}
|