[android] - use project wide configurations for all modules + fixup wear compile error (#8066)

This commit is contained in:
Tobrun
2017-02-15 19:56:31 +01:00
committed by GitHub
parent 8f1c580ea1
commit 0c0d7ceaeb
7 changed files with 94 additions and 72 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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'

View File

@@ -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;
}
}

View File

@@ -18,3 +18,6 @@ allprojects {
task wrapper(type: Wrapper) {
gradleVersion = '3.2.1'
}
apply from: rootProject.file('dependencies.gradle')

View File

@@ -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}"
]
}