From fa79a31911cc9ffe97e3928383e5961ff242ef77 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 1 Dec 2017 16:32:02 -0200 Subject: [PATCH] Define common library version centrally in top-level build.gradle file This should make it easier to upgrade libraries in the future and provide an overview over which versions we are using as well as keep them consistent throughout the project. --- bramble-android/build.gradle | 4 +--- bramble-api/build.gradle | 14 +++++++------- bramble-core/build.gradle | 16 ++++++++-------- bramble-j2se/build.gradle | 14 +++++++------- briar-android/build.gradle | 15 +++++++-------- briar-core/build.gradle | 16 ++++++++-------- build.gradle | 36 ++++++++++++++++++++++++------------ 7 files changed, 62 insertions(+), 53 deletions(-) diff --git a/bramble-android/build.gradle b/bramble-android/build.gradle index 1a4036e00..fc436845d 100644 --- a/bramble-android/build.gradle +++ b/bramble-android/build.gradle @@ -27,7 +27,7 @@ dependencies { implementation project(path: ':bramble-core', configuration: 'default') implementation fileTree(dir: 'libs', include: '*.jar') - annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2' + annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" compileOnly 'javax.annotation:jsr250-api:1.0' } @@ -55,8 +55,6 @@ dependencyVerification { } ext.torBinaryDir = 'src/main/res/raw' -ext.torVersion = '0.2.9.12' -ext.geoipVersion = '2017-09-06' ext.torDownloadUrl = 'https://briarproject.org/build/' def torBinaries = [ diff --git a/bramble-api/build.gradle b/bramble-api/build.gradle index 76bc23409..ffc74dfc6 100644 --- a/bramble-api/build.gradle +++ b/bramble-api/build.gradle @@ -5,15 +5,15 @@ targetCompatibility = 1.8 apply plugin: 'witness' dependencies { - implementation "com.google.dagger:dagger:2.0.2" + implementation "com.google.dagger:dagger:$daggerVersion" implementation 'com.google.code.findbugs:jsr305:3.0.2' - testImplementation 'junit:junit:4.12' - testImplementation "org.jmock:jmock:2.8.2" - testImplementation "org.jmock:jmock-junit4:2.8.2" - testImplementation "org.jmock:jmock-legacy:2.8.2" - testImplementation "org.hamcrest:hamcrest-library:1.3" - testImplementation "org.hamcrest:hamcrest-core:1.3" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.jmock:jmock:$jmockVersion" + testImplementation "org.jmock:jmock-junit4:$jmockVersion" + testImplementation "org.jmock:jmock-legacy:$jmockVersion" + testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" } dependencyVerification { diff --git a/bramble-core/build.gradle b/bramble-core/build.gradle index 59361dc93..20afce2b6 100644 --- a/bramble-core/build.gradle +++ b/bramble-core/build.gradle @@ -13,17 +13,17 @@ dependencies { implementation 'org.bitlet:weupnp:0.1.4' implementation 'net.i2p.crypto:eddsa:0.2.0' - apt 'com.google.dagger:dagger-compiler:2.0.2' + apt "com.google.dagger:dagger-compiler:$daggerVersion" testImplementation project(path: ':bramble-api', configuration: 'testOutput') - testImplementation 'junit:junit:4.12' - testImplementation "org.jmock:jmock:2.8.2" - testImplementation "org.jmock:jmock-junit4:2.8.2" - testImplementation "org.jmock:jmock-legacy:2.8.2" - testImplementation "org.hamcrest:hamcrest-library:1.3" - testImplementation "org.hamcrest:hamcrest-core:1.3" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.jmock:jmock:$jmockVersion" + testImplementation "org.jmock:jmock-junit4:$jmockVersion" + testImplementation "org.jmock:jmock-legacy:$jmockVersion" + testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testApt 'com.google.dagger:dagger-compiler:2.0.2' + testApt "com.google.dagger:dagger-compiler:$daggerVersion" } dependencyVerification { diff --git a/bramble-j2se/build.gradle b/bramble-j2se/build.gradle index 2ba13659e..dc36caa43 100644 --- a/bramble-j2se/build.gradle +++ b/bramble-j2se/build.gradle @@ -12,16 +12,16 @@ dependencies { implementation 'net.java.dev.jna:jna:4.4.0' implementation 'net.java.dev.jna:jna-platform:4.4.0' - apt 'com.google.dagger:dagger-compiler:2.0.2' + apt "com.google.dagger:dagger-compiler:$daggerVersion" testImplementation project(path: ':bramble-api', configuration: 'testOutput') testImplementation project(path: ':bramble-core', configuration: 'testOutput') - testImplementation 'junit:junit:4.12' - testImplementation "org.jmock:jmock:2.8.2" - testImplementation "org.jmock:jmock-junit4:2.8.2" - testImplementation "org.jmock:jmock-legacy:2.8.2" - testImplementation "org.hamcrest:hamcrest-library:1.3" - testImplementation "org.hamcrest:hamcrest-core:1.3" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.jmock:jmock:$jmockVersion" + testImplementation "org.jmock:jmock-junit4:$jmockVersion" + testImplementation "org.jmock:jmock-legacy:$jmockVersion" + testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" } dependencyVerification { diff --git a/briar-android/build.gradle b/briar-android/build.gradle index 889f4b06d..7167f9334 100644 --- a/briar-android/build.gradle +++ b/briar-android/build.gradle @@ -6,7 +6,6 @@ dependencies { implementation project(path: ':bramble-core', configuration: 'default') implementation project(path: ':bramble-android', configuration: 'default') - def supportVersion = '27.0.1' implementation "com.android.support:support-v4:$supportVersion" implementation("com.android.support:appcompat-v7:$supportVersion") { exclude module: 'support-v4' @@ -34,7 +33,7 @@ dependencies { implementation 'com.github.bumptech.glide:glide:3.8.0' implementation 'uk.co.samuelwall:material-tap-target-prompt:2.1.0' - annotationProcessor 'com.google.dagger:dagger-compiler:2.0.2' + annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion" compileOnly 'javax.annotation:jsr250-api:1.0' @@ -43,12 +42,12 @@ dependencies { testImplementation 'org.robolectric:robolectric:3.5.1' testImplementation 'org.robolectric:shadows-support-v4:3.0' testImplementation 'org.mockito:mockito-core:2.8.9' - testImplementation 'junit:junit:4.12' - testImplementation "org.jmock:jmock:2.8.2" - testImplementation "org.jmock:jmock-junit4:2.8.2" - testImplementation "org.jmock:jmock-legacy:2.8.2" - testImplementation "org.hamcrest:hamcrest-library:1.3" - testImplementation "org.hamcrest:hamcrest-core:1.3" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.jmock:jmock:$jmockVersion" + testImplementation "org.jmock:jmock-junit4:$jmockVersion" + testImplementation "org.jmock:jmock-legacy:$jmockVersion" + testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" } dependencyVerification { diff --git a/briar-core/build.gradle b/briar-core/build.gradle index 8f03ea2ba..6ee2ec93c 100644 --- a/briar-core/build.gradle +++ b/briar-core/build.gradle @@ -13,20 +13,20 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:3.8.0' implementation 'org.jsoup:jsoup:1.10.3' - apt 'com.google.dagger:dagger-compiler:2.0.2' + apt "com.google.dagger:dagger-compiler:$daggerVersion" testImplementation project(path: ':bramble-core', configuration: 'default') testImplementation project(path: ':bramble-core', configuration: 'testOutput') testImplementation project(path: ':bramble-api', configuration: 'testOutput') testImplementation 'net.jodah:concurrentunit:0.4.2' - testImplementation 'junit:junit:4.12' - testImplementation "org.jmock:jmock:2.8.2" - testImplementation "org.jmock:jmock-junit4:2.8.2" - testImplementation "org.jmock:jmock-legacy:2.8.2" - testImplementation "org.hamcrest:hamcrest-library:1.3" - testImplementation "org.hamcrest:hamcrest-core:1.3" + testImplementation "junit:junit:$junitVersion" + testImplementation "org.jmock:jmock:$jmockVersion" + testImplementation "org.jmock:jmock-junit4:$jmockVersion" + testImplementation "org.jmock:jmock-legacy:$jmockVersion" + testImplementation "org.hamcrest:hamcrest-library:$hamcrestVersion" + testImplementation "org.hamcrest:hamcrest-core:$hamcrestVersion" - testApt 'com.google.dagger:dagger-compiler:2.0.2' + testApt "com.google.dagger:dagger-compiler:$daggerVersion" } dependencyVerification { diff --git a/build.gradle b/build.gradle index 34a7c8331..9511bc518 100644 --- a/build.gradle +++ b/build.gradle @@ -21,22 +21,34 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'net.ltgt.gradle:gradle-apt-plugin:0.9' - classpath 'de.undercouch:gradle-download-task:3.2.0' + classpath 'de.undercouch:gradle-download-task:3.3.0' classpath files('libs/gradle-witness.jar') } } -// If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs -ext.useJava6StandardLibrary = { task -> - def home = System.env.JAVA_6_HOME; - if (home != null && !home.isEmpty()) { - println "Setting Java 6 bootstrap classpath for ${task.name}" - task.dependsOn createJavaLangInvokeJar - task.options.bootstrapClasspath = files( - "${project.rootDir}/build/invoke.jar", - "${home}/jre/lib/rt.jar", - "${home}/jre/lib/jsse.jar" - ) + +ext { + // Define common library version centrally + daggerVersion = '2.0.2' + supportVersion = '27.0.1' + junitVersion = '4.12' + jmockVersion = '2.8.2' + hamcrestVersion = '1.3' + torVersion = '0.2.9.12' + geoipVersion = '2017-09-06' + + // If a Java 6 JRE is available, check we're not using any Java 7 or 8 APIs + useJava6StandardLibrary = { task -> + def home = System.env.JAVA_6_HOME; + if (home != null && !home.isEmpty()) { + println "Setting Java 6 bootstrap classpath for ${task.name}" + task.dependsOn createJavaLangInvokeJar + task.options.bootstrapClasspath = files( + "${project.rootDir}/build/invoke.jar", + "${home}/jre/lib/rt.jar", + "${home}/jre/lib/jsse.jar" + ) + } } }