diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2017-02-15 19:56:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-15 19:56:31 +0100 |
commit | 0c0d7ceaebf822ababc7147c494e88f4c16e18e3 (patch) | |
tree | 024437c194098cd9c8049cb0573c026df50e4328 /platform | |
parent | 8f1c580ea164b47644e4dd935e7d30afe5872a96 (diff) | |
download | qtlocation-mapboxgl-0c0d7ceaebf822ababc7147c494e88f4c16e18e3.tar.gz |
[android] - use project wide configurations for all modules + fixup wear compile error (#8066)
Diffstat (limited to 'platform')
7 files changed, 94 insertions, 72 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 112350aaf2..6dc7df7281 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -1,9 +1,5 @@ apply plugin: 'com.android.library' -ext { - supportLibVersion = '25.1.0' -} - dependencies { compile "com.android.support:support-annotations:${supportLibVersion}" compile "com.android.support:support-v4:${supportLibVersion}" @@ -24,29 +20,23 @@ dependencies { } android { - compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) - buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { - minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK) - targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision()) } - android { - // avoid naming conflicts, force usage of prefix - resourcePrefix 'mapbox_' - } + // avoid naming conflicts, force usage of prefix + resourcePrefix 'mapbox_' sourceSets { // limit amount of exposed library resources main.res.srcDirs += 'src/main/res-public' } - repositories { - mavenCentral() - } - compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties index 7bdc7ab455..dac39fa60a 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle.properties +++ b/platform/android/MapboxGLAndroidSDK/gradle.properties @@ -11,12 +11,6 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt POM_LICENCE_DIST=repo POM_DEVELOPER_ID=mapbox POM_DEVELOPER_NAME=Mapbox - -ANDROID_MIN_SDK=15 -ANDROID_BUILD_TARGET_SDK_VERSION=25 -ANDROID_BUILD_TOOLS_VERSION=25.0.2 -ANDROID_BUILD_SDK_VERSION=25 - POM_NAME=Mapbox Android SDK POM_ARTIFACT_ID=mapbox-android-sdk POM_PACKAGING=aar diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 20fff123fd..1b4d54106d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -1,22 +1,15 @@ apply plugin: 'com.android.application' -ext { - supportLibVersion = '25.1.0' - espressoVersion = '2.2.2' - testRunnerVersion = '0.5' - leakCanaryVersion = '1.5' -} - android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.mapbox.mapboxsdk.testapp" - minSdkVersion 15 - targetSdkVersion 25 - versionCode 11 - versionName "5.0.0" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode rootProject.ext.versionCode + versionName rootProject.ext.versionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } @@ -61,31 +54,31 @@ dependencies { } // Support libraries - compile "com.android.support:support-annotations:${supportLibVersion}" - compile "com.android.support:support-v4:${supportLibVersion}" - compile "com.android.support:appcompat-v7:${supportLibVersion}" - compile "com.android.support:design:${supportLibVersion}" - compile "com.android.support:recyclerview-v7:${supportLibVersion}" + compile rootProject.ext.dep.supportAnnotations + compile rootProject.ext.dep.supportV4 + compile rootProject.ext.dep.supportAppcompatV7 + compile rootProject.ext.dep.supportDesign + compile rootProject.ext.dep.supportRecyclerView // Leak Canary - debugCompile "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}" - releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" - testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" + debugCompile rootProject.ext.dep.leakCanaryDebug + releaseCompile rootProject.ext.dep.leakCanaryRelease + testCompile rootProject.ext.dep.leakCanaryTest // Mapbox Android Services (Java component) - compile('com.mapbox.mapboxsdk:mapbox-java-services:2.0.0-beta.1@jar') { + compile(rootProject.ext.dep.mapboxJavaServices) { transitive = true } // Testing dependencies - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:2.2.27' - androidTestCompile 'com.squareup.spoon:spoon-client:1.6.2' - androidTestCompile "com.android.support:support-annotations:${supportLibVersion}" - androidTestCompile "com.android.support.test:runner:${testRunnerVersion}" - androidTestCompile "com.android.support.test:rules:${testRunnerVersion}" - androidTestCompile "com.android.support.test.espresso:espresso-core:${espressoVersion}" - androidTestCompile "com.android.support.test.espresso:espresso-intents:${espressoVersion}" + testCompile rootProject.ext.dep.junit + testCompile rootProject.ext.dep.mockito + androidTestCompile rootProject.ext.dep.testSpoonRunner + androidTestCompile rootProject.ext.dep.supportAnnotations + androidTestCompile rootProject.ext.dep.testRunner + androidTestCompile rootProject.ext.dep.testRules + androidTestCompile rootProject.ext.dep.testEspressoCore + androidTestCompile rootProject.ext.dep.testEspressoIntents } apply from: 'gradle-make.gradle' diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle index c02b869953..e08d5a9a03 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle @@ -1,20 +1,15 @@ apply plugin: 'com.android.application' -ext { - wearableVersion = '2.0.0-alpha3' - leakCanaryVersion = '1.5' -} - android { - compileSdkVersion 25 - buildToolsVersion "25.0.2" + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { applicationId "com.mapbox.mapboxsdk.testapp" - minSdkVersion 21 - targetSdkVersion 25 - versionCode 11 - versionName "5.0.0" + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + versionCode rootProject.ext.versionCode + versionName rootProject.ext.versionName } buildTypes { @@ -34,18 +29,17 @@ dependencies { } // Wear - compile fileTree(dir: 'libs', include: ['*.jar']) - compile "com.google.android.support:wearable:${wearableVersion}" - provided "com.google.android.wearable:wearable:${wearableVersion}" + compile rootProject.ext.dep.wearCompile + provided rootProject.ext.dep.wearProvided // Leak Canary - debugCompile "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}" - releaseCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" - testCompile "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" + debugCompile rootProject.ext.dep.leakCanaryDebug + releaseCompile rootProject.ext.dep.leakCanaryRelease + testCompile rootProject.ext.dep.leakCanaryTest // Testing dependencies - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:2.2.27' + testCompile rootProject.ext.dep.junit + testCompile rootProject.ext.dep.mockito } apply from: 'gradle-config.gradle' diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/utils/OffsettingHelper.java b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/utils/OffsettingHelper.java index 5b5d512c45..8550d0d016 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/utils/OffsettingHelper.java +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/src/main/java/com/mapbox/weartestapp/utils/OffsettingHelper.java @@ -34,7 +34,7 @@ public class OffsettingHelper extends DefaultOffsettingHelper { } @Override - protected void adjustAnchorOffsetXY(View child, float[] anchorOffsetXY) { + public void adjustAnchorOffsetXY(View child, float[] anchorOffsetXY) { anchorOffsetXY[0] = child.getHeight() / 2.0f; } } diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 139389e5b5..69eb6616d1 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -18,3 +18,6 @@ allprojects { task wrapper(type: Wrapper) { gradleVersion = '3.2.1' } + +apply from: rootProject.file('dependencies.gradle') + diff --git a/platform/android/dependencies.gradle b/platform/android/dependencies.gradle new file mode 100644 index 0000000000..9d0fe05f1c --- /dev/null +++ b/platform/android/dependencies.gradle @@ -0,0 +1,48 @@ +ext { + minSdkVersion = 15 + targetSdkVersion = 25 + compileSdkVersion = 25 + buildToolsVersion = "25.0.2" + + versionCode = 11 + versionName = "5.0.0" + + supportLibVersion = "25.1.1" + leakCanaryVersion = '1.5' + wearableVersion = '2.0.0' + + espressoVersion = '2.2.2' + testRunnerVersion = '0.5' + + dep = [ + // mapbox + mapboxJavaServices : 'com.mapbox.mapboxsdk:mapbox-java-services:2.0.0-beta.1@jar', + + // unit test + junit : 'junit:junit:4.12', + mockito : 'org.mockito:mockito-core:2.2.27', + + // instrumentation test + testSpoonRunner : 'com.squareup.spoon:spoon-client:1.6.2', + 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}", + + // support + supportAnnotations : "com.android.support:support-annotations:${supportLibVersion}", + supportAppcompatV7 : "com.android.support:appcompat-v7:${supportLibVersion}", + supportV4 : "com.android.support:support-v4:${supportLibVersion}", + supportDesign : "com.android.support:design:${supportLibVersion}", + supportRecyclerView: "com.android.support:recyclerview-v7:${supportLibVersion}", + + // wear + wearCompile : "com.google.android.support:wearable:${wearableVersion}", + wearProvided : "com.google.android.wearable:wearable:${wearableVersion}", + + // leakCanary + leakCanaryDebug : "com.squareup.leakcanary:leakcanary-android:${leakCanaryVersion}", + leakCanaryRelease : "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}", + leakCanaryTest : "com.squareup.leakcanary:leakcanary-android-no-op:${leakCanaryVersion}" + ] +}
\ No newline at end of file |