Fix gradle support while keeping ant support

Most of this was done by pserwylo on his branch feature/gradle. The only thing
left is merging the fixes into nanohttpd.
This commit is contained in:
Daniel Martí 2014-05-18 12:54:21 +02:00
parent d68b959856
commit b3107eb6b2
5 changed files with 57 additions and 7 deletions

View File

@ -302,7 +302,9 @@
</activity>
<!--Used for SSL TOFU, supported by extern/MemorizingTrustManager lib -->
<activity android:name="de.duenndns.ssl.MemorizingActivity" />
<activity
android:name="de.duenndns.ssl.MemorizingActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver android:name=".StartupReceiver" >
<intent-filter>

View File

@ -3,7 +3,7 @@
android update lib-project --path extern/UniversalImageLoader/library
android update lib-project --path extern/AndroidPinning
android update lib-project --path extern/MemorizingTrustManager
android update lib-project --path extern/nanohttpd
android update lib-project --path extern/nanohttpd/core
android update lib-project --path extern/libsuperuser/libsuperuser
android update project --path . --name F-Droid

View File

@ -7,14 +7,17 @@ buildscript {
}
}
def toolVersion = "19.1"
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
compile files('libs/core-3.0.1.jar')
compile project(':extern:AndroidPinning')
compile project(':extern:UniversalImageLoader:library')
compile project(':extern:MemorizingTrustManager')
compile project(':extern:libsuperuser:libsuperuser')
compile project(':extern:nanohttpd:core')
}
project(':extern:UniversalImageLoader:library') {
@ -27,11 +30,11 @@ project(':extern:UniversalImageLoader:library') {
}
}
apply plugin: 'android'
apply plugin: 'android-library'
android {
compileSdkVersion 16
buildToolsVersion '19.0.3'
buildToolsVersion toolVersion
sourceSets {
main {
@ -47,7 +50,7 @@ project(':extern:UniversalImageLoader:library') {
android {
compileSdkVersion 19
buildToolsVersion '19.0.3'
buildToolsVersion toolVersion
sourceSets {
main {
@ -70,7 +73,47 @@ android {
}
}
tasks.withType(Compile) {
tasks.withType(Compile) { task ->
options.encoding = "UTF-8"
}
}
// 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.sdkDirectory}/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'
}
}
// This is the hacky way which we force the subprojects to use the same build tools:
// http://stackoverflow.com/a/21032272
subprojects {
afterEvaluate {
android {
// The android build task only lets you configure the buildToolsVersion once, so if
// we execute the closure below to configure our subprojects, it will fail when it
// hits the second subproject. Therefore, we will only do it once, and I guess the
// android plubin will re-use the existing value I set.
// https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/BaseExtension.groovy
try {
buildToolsVersion toolVersion
logger.info("Set buildToolsVersion to $toolVersion")
} catch (GradleException e) {
logger.info("Tried to set the buildToolsVersion, however we were not allowed to: $e.message")
}
}
}
}

View File

@ -6,4 +6,5 @@ android.library.reference.1=extern/UniversalImageLoader/library
android.library.reference.2=extern/MemorizingTrustManager
android.library.reference.3=extern/AndroidPinning
android.library.reference.4=extern/nanohttpd
# Once nanohttpd pull request is merged use android.library.reference.4=extern/nanohttpd/core
android.library.reference.5=extern/libsuperuser/libsuperuser

View File

@ -1 +1,5 @@
include ':extern:AndroidPinning', ':extern:UniversalImageLoader:library', ':extern:MemorizingTrustManager', ':extern:libsuperuser:libsuperuser'
include ':extern:AndroidPinning',
':extern:UniversalImageLoader:library',
':extern:MemorizingTrustManager',
':extern:libsuperuser:libsuperuser',
':extern:nanohttpd:core'