Deduplicate gradle code

This commit is contained in:
Daniel Martí 2015-10-13 22:24:54 +02:00
parent bbeef3cd8d
commit 9586c159a3

View File

@ -2,11 +2,32 @@ apply plugin: 'com.android.application'
apply plugin: 'witness' apply plugin: 'witness'
apply plugin: 'checkstyle' apply plugin: 'checkstyle'
repositories {
jcenter()
}
dependencies {
compile project(':privileged-api-lib')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.zxing:core:3.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201510071325'
compile 'cc.mvdan.accesspoint:library:0.1.3'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'commons-net:commons-net:3.3'
compile 'org.openhab.jmdns:jmdns:3.4.2'
androidTestCompile 'commons-io:commons-io:2.2'
}
if (!hasProperty('sourceDeps')) { if (!hasProperty('sourceDeps')) {
repositories { repositories {
jcenter()
// This is here until we sort out all dependencies from mavenCentral/jcenter. Once all of // This is here until we sort out all dependencies from mavenCentral/jcenter. Once all of
// the dependencies below have been sorted out, this can be removed. // the dependencies below have been sorted out, this can be removed.
flatDir { flatDir {
@ -15,23 +36,9 @@ if (!hasProperty('sourceDeps')) {
} }
dependencies { dependencies {
compile project(':privileged-api-lib')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.zxing:core:3.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201510071325'
compile 'cc.mvdan.accesspoint:library:0.1.3'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'com.madgag.spongycastle:pkix:1.51.0.0' compile 'com.madgag.spongycastle:pkix:1.51.0.0'
compile 'com.madgag.spongycastle:prov:1.51.0.0' compile 'com.madgag.spongycastle:prov:1.51.0.0'
compile 'com.madgag.spongycastle:core:1.51.0.0' compile 'com.madgag.spongycastle:core:1.51.0.0'
compile 'commons-net:commons-net:3.3'
compile 'org.openhab.jmdns:jmdns:3.4.2'
// Upstream doesn't have a binary on mavenCentral/jcenter yet: // Upstream doesn't have a binary on mavenCentral/jcenter yet:
// https://github.com/kolavar/android-support-v4-preferencefragment/issues/13 // https://github.com/kolavar/android-support-v4-preferencefragment/issues/13
@ -45,8 +52,6 @@ if (!hasProperty('sourceDeps')) {
// Google Code. We include this code directly in this repo, and have made // Google Code. We include this code directly in this repo, and have made
// modifications that should be pushed to anyone who wants to maintain it. // modifications that should be pushed to anyone who wants to maintain it.
compile(name: 'zipsigner') compile(name: 'zipsigner')
androidTestCompile 'commons-io:commons-io:2.2'
} }
// Only do the libraries imported from maven repositories. Our own libraries // Only do the libraries imported from maven repositories. Our own libraries
@ -75,57 +80,34 @@ if (!hasProperty('sourceDeps')) {
logger.info "Setting up *source* dependencies for F-Droid (because you passed in the -PsourceDeps argument to gradle while building)." logger.info "Setting up *source* dependencies for F-Droid (because you passed in the -PsourceDeps argument to gradle while building)."
repositories {
jcenter()
}
dependencies { dependencies {
compile project(':privileged-api-lib')
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-annotations:22.2.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.google.zxing:core:3.2.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201510071325'
compile 'cc.mvdan.accesspoint:library:0.1.3'
compile 'info.guardianproject.netcipher:netcipher:1.2'
compile 'commons-net:commons-net:3.3'
compile 'org.openhab.jmdns:jmdns:3.4.2'
compile(project(':extern:support-v4-preferencefragment')) { compile(project(':extern:support-v4-preferencefragment')) {
exclude module: 'support-v4' exclude module: 'support-v4'
} }
compile project(':extern:nanohttpd:core') compile project(':extern:nanohttpd:core')
compile project(':extern:zipsigner') compile project(':extern:zipsigner')
androidTestCompile 'commons-io:commons-io:2.2'
} }
} task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') {
task binaryDeps(type: Copy, dependsOn: ':F-Droid:prepareReleaseDependencies') { enabled = project.hasProperty('sourceDeps')
description = "Copies .jar and .aar files from subproject dependencies in extern/ to F-Droid/libs. Requires the sourceDeps property to be set (\"gradle -PsourceDeps binaryDeps\")"
enabled = project.hasProperty('sourceDeps') from('../extern/') {
description = "Copies .jar and .aar files from subproject dependencies in extern/ to F-Droid/libs. Requires the sourceDeps property to be set (\"gradle -PsourceDeps binaryDeps\")" include 'support-v4-preferencefragment/build/outputs/aar/support-v4-preferencefragment-release.aar'
include 'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar'
include 'zipsigner/build/libs/zipsigner.jar'
}
from('../extern/') { into 'libs/binaryDeps'
include 'support-v4-preferencefragment/build/outputs/aar/support-v4-preferencefragment-release.aar' includeEmptyDirs false
include 'nanohttpd/core/build/libs/nanohttpd-2.1.0.jar'
include 'zipsigner/build/libs/zipsigner.jar' eachFile { FileCopyDetails details ->
// Don't copy to a sub folder such as libs/binaryDeps/Project/build/outputs/aar/project.aar, but
// rather libs/binaryDeps/project.aar.
details.path = details.name
}
} }
into 'libs/binaryDeps'
includeEmptyDirs false
eachFile { FileCopyDetails details ->
// Don't copy to a sub folder such as libs/binaryDeps/Project/build/outputs/aar/project.aar, but
// rather libs/binaryDeps/project.aar.
details.path = details.name
}
} }
android { android {
@ -188,7 +170,6 @@ android {
// since some devices ship deprecated locale codes // since some devices ship deprecated locale codes
disable 'LocaleFolder' disable 'LocaleFolder'
} }
} }
task checkstyle(type: Checkstyle) { task checkstyle(type: Checkstyle) {