From f534dbe71a2bd01e7f575c8cfbd28d5cc2e1ad5d Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 17 Jan 2018 20:22:14 +0100 Subject: [android] - cleaup dependencies.gradle --- platform/android/MapboxGLAndroidSDK/build.gradle | 47 ++++++------ .../android/MapboxGLAndroidSDKTestApp/build.gradle | 49 ++++++------ platform/android/build.gradle | 5 +- platform/android/gradle/dependencies.gradle | 87 +++++++++++----------- 4 files changed, 89 insertions(+), 99 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 707bc80f57..0900f700c8 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -1,29 +1,29 @@ apply plugin: 'com.android.library' dependencies { - api rootProject.ext.dep.mapboxAndroidTelemetry - api rootProject.ext.dep.mapboxJavaGeoJSON - implementation rootProject.ext.dep.supportAnnotations - implementation rootProject.ext.dep.supportFragmentV4 - implementation rootProject.ext.dep.timber - implementation rootProject.ext.dep.okhttp3 - compileOnly(rootProject.ext.dep.lost) { + api dependenciesList.mapboxAndroidTelemetry + api dependenciesList.mapboxJavaGeoJSON + implementation dependenciesList.supportAnnotations + implementation dependenciesList.supportFragmentV4 + implementation dependenciesList.timber + implementation dependenciesList.okhttp3 + compileOnly(dependenciesList.lost) { exclude group: 'com.google.guava' exclude group: 'com.android.support' } - testImplementation rootProject.ext.dep.lost - testImplementation rootProject.ext.dep.junit - testImplementation rootProject.ext.dep.mockito - testImplementation rootProject.ext.dep.robolectric + testImplementation dependenciesList.lost + testImplementation dependenciesList.junit + testImplementation dependenciesList.mockito + testImplementation dependenciesList.robolectric } android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion androidVersions.compileSdkVersion + buildToolsVersion androidVersions.buildToolsVersion defaultConfig { - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion + minSdkVersion androidVersions.minSdkVersion + targetSdkVersion androidVersions.targetSdkVersion buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision()) buildConfigField "String", "MAPBOX_VERSION_STRING", String.format("\"Mapbox/%s\"", project.VERSION_NAME) buildConfigField "String", "MAPBOX_EVENTS_USER_AGENT", String.format("\"MapboxEventsAndroid/%s\"", project.VERSION_NAME) @@ -64,12 +64,12 @@ android { arguments "-DANDROID_CPP_FEATURES=rtti;exceptions" arguments "-DMBGL_PLATFORM=android" arguments "-DMASON_PLATFORM=android" - arguments "-DNodeJS_EXECUTABLE=" + rootProject.ext.node - arguments "-Dnpm_EXECUTABLE=" + rootProject.ext.npm + arguments "-DNodeJS_EXECUTABLE=" + node + arguments "-Dnpm_EXECUTABLE=" + npm // Enable ccache if the user has installed it. - if (rootProject.ext.ccache?.trim()) { - arguments "-DANDROID_CCACHE=" + rootProject.ext.ccache + if (ccache?.trim()) { + arguments "-DANDROID_CCACHE=" + ccache // ccache splits up the compile command until multiple invocations and uses -E // with one of them, and clang doesn't like unused arguments in that case. cFlags "-Qunused-arguments" @@ -121,7 +121,7 @@ android { testOptions { unitTests { - returnDefaultValues = true + returnDefaultValues true } } @@ -129,15 +129,10 @@ android { debug { jniDebuggable true } - - release { - // aar proguard configuration - jniDebuggable false - } } } -def getGitRevision() { +def static getGitRevision() { def cmd = "git rev-parse --short HEAD" def proc = cmd.execute() def ref = proc.text.trim() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 42b0a629e8..3723ae2acf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion rootProject.ext.compileSdkVersion - buildToolsVersion rootProject.ext.buildToolsVersion + compileSdkVersion androidVersions.compileSdkVersion + buildToolsVersion androidVersions.buildToolsVersion defaultConfig { applicationId "com.mapbox.mapboxsdk.testapp" - minSdkVersion rootProject.ext.minSdkVersion - targetSdkVersion rootProject.ext.targetSdkVersion - versionCode rootProject.ext.versionCode - versionName rootProject.ext.versionName + minSdkVersion androidVersions.minSdkVersion + targetSdkVersion androidVersions.targetSdkVersion + versionCode 12 + versionName "6.0.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -53,31 +53,24 @@ android { dependencies { implementation(project(':MapboxGLAndroidSDK')) - - // Support libraries - implementation rootProject.ext.dep.supportAppcompatV7 - implementation rootProject.ext.dep.supportRecyclerView - implementation rootProject.ext.dep.supportDesign - - // Leak Canary - debugImplementation rootProject.ext.dep.leakCanaryDebug - releaseImplementation rootProject.ext.dep.leakCanaryRelease - - // Timber - implementation rootProject.ext.dep.timber - - // Mapbox Android Services (Java component) - implementation(rootProject.ext.dep.mapboxJavaServices) { + implementation(dependenciesList.mapboxJavaServices) { transitive = true } - implementation rootProject.ext.dep.lost - // Testing dependencies - androidTestImplementation rootProject.ext.dep.supportAnnotations - androidTestImplementation rootProject.ext.dep.testRunner - androidTestImplementation rootProject.ext.dep.testRules - androidTestImplementation rootProject.ext.dep.testEspressoCore - androidTestImplementation rootProject.ext.dep.testEspressoIntents + implementation dependenciesList.supportAppcompatV7 + implementation dependenciesList.supportRecyclerView + implementation dependenciesList.supportDesign + + implementation dependenciesList.lost + implementation dependenciesList.timber + debugImplementation dependenciesList.leakCanaryDebug + releaseImplementation dependenciesList.leakCanaryRelease + + androidTestImplementation dependenciesList.supportAnnotations + androidTestImplementation dependenciesList.testRunner + androidTestImplementation dependenciesList.testRules + androidTestImplementation dependenciesList.testEspressoCore + androidTestImplementation dependenciesList.testEspressoIntents } apply from: "${rootDir}/gradle/gradle-make.gradle" diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 88b65e6c80..0368558e92 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -1,4 +1,5 @@ buildscript { + repositories { jcenter() google() @@ -16,8 +17,8 @@ allprojects { } } -task wrapper(type: Wrapper) { - gradleVersion = '3.2.1' +subprojects { + apply from: "${rootDir}/gradle/dependencies.gradle" } apply from: "${rootDir}/gradle/dependencies.gradle" diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index a32e18166d..dcf29101e3 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -1,49 +1,50 @@ ext { - minSdkVersion = 14 - targetSdkVersion = 25 - compileSdkVersion = 25 - buildToolsVersion = "26.0.3" - versionCode = 12 - versionName = "6.0.0" - - mapboxServicesVersion = "2.2.9" - supportLibVersion = "25.4.0" - espressoVersion = '3.0.1' - testRunnerVersion = '1.0.1' - leakCanaryVersion = '1.5.1' - - dep = [ - // mapbox - mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-java-services:${mapboxServicesVersion}@jar", - mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-java-geojson:${mapboxServicesVersion}@jar", - mapboxAndroidTelemetry : "com.mapbox.mapboxsdk:mapbox-android-telemetry:${mapboxServicesVersion}@aar", - - // mapzen lost - lost : 'com.mapzen.android:lost:3.0.4', - - // unit test - junit : 'junit:junit:4.12', - mockito : 'org.mockito:mockito-core:2.10.0', - robolectric : 'org.robolectric:robolectric:3.5.1', - - // instrumentation test - testRunner : "com.android.support.test:runner:${testRunnerVersion}", - testRules : "com.android.support.test:rules:${testRunnerVersion}", - testEspressoCore : "com.android.support.test.espresso:espresso-core:${espressoVersion}", - testEspressoIntents : "com.android.support.test.espresso:espresso-intents:${espressoVersion}", + androidVersions = [ + minSdkVersion : 14, + targetSdkVersion : 25, + compileSdkVersion: 25, + buildToolsVersion: '26.0.3' + ] - // support - supportAnnotations : "com.android.support:support-annotations:${supportLibVersion}", - supportAppcompatV7 : "com.android.support:appcompat-v7:${supportLibVersion}", - supportFragmentV4 : "com.android.support:support-fragment:${supportLibVersion}", - supportDesign : "com.android.support:design:${supportLibVersion}", - supportRecyclerView : "com.android.support:recyclerview-v7:${supportLibVersion}", + versions = [ + mapboxServices: '2.2.9', + supportLib : '25.4.0', + espresso : '3.0.1', + testRunner : '1.0.1', + leakCanary : '1.5.1', + lost : '3.0.4', + junit : '4.12', + mockito : '2.10.0', + roboelectric : '3.5.1', + timber : '4.5.1', + okhttp : '3.9.1' + ] - // square crew - timber : 'com.jakewharton.timber:timber:4.5.1', - okhttp3 : 'com.squareup.okhttp3:okhttp:3.9.1', - leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}", - leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" + dependenciesList = [ + mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-java-services:${versions.mapboxServices}@jar", + mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-java-geojson:${versions.mapboxServices}@jar", + mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxServices}@aar", + + junit : "junit:junit:${versions.junit}", + mockito : "org.mockito:mockito-core:${versions.mockito}", + robolectric : "org.robolectric:robolectric:${versions.roboelectric}", + + testRunner : "com.android.support.test:runner:${versions.testRunner}", + testRules : "com.android.support.test:rules:${versions.testRunner}", + testEspressoCore : "com.android.support.test.espresso:espresso-core:${versions.espresso}", + testEspressoIntents : "com.android.support.test.espresso:espresso-intents:${versions.espresso}", + + supportAnnotations : "com.android.support:support-annotations:${versions.supportLib}", + supportAppcompatV7 : "com.android.support:appcompat-v7:${versions.supportLib}", + supportFragmentV4 : "com.android.support:support-fragment:${versions.supportLib}", + supportDesign : "com.android.support:design:${versions.supportLib}", + supportRecyclerView : "com.android.support:recyclerview-v7:${versions.supportLib}", + + lost : "com.mapzen.android:lost:${versions.lost}", + timber : "com.jakewharton.timber:timber:${versions.timber}", + okhttp3 : "com.squareup.okhttp3:okhttp:${versions.okhttp}", + leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${versions.leakCanary}", + leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${versions.leakCanary}" ] } \ No newline at end of file -- cgit v1.2.1