Bug 1123013 - Set project SDK explicitly in Gradle configuration. r=me,f=mcomella

This is a sad, but necessary, loss of generality that will cause the
Gradle configuration to lag behind the rest of the build system over
time.  The existing Gradle build worked fine, but IDEA based IDEs can
not yet read build.gradle files containing arbitrary Groovy code.  I
can find no alternative to including the values in the build.gradle
file directly.  We will just try to keep them up to date.

The versions chosen (compileSdkVersion 21 and buildTools "21.1.1")
correspond to the current versions used on the buildbots.  Changing
compileSdkVersion to an integer absolutely requires Gradle-Android
plugin version 1.0.0 or higher, which in turn mandates IntelliJ
version 14.0.3 EAP or higher.

I took the opportunity to update some settings and bump dependency
versions from v19 to v21 as well.

--HG--
extra : rebase_source : 7ada8da4dec7bd56ca3d276d833788d895e12e25
This commit is contained in:
Nick Alexander 2015-01-28 10:42:30 -08:00
parent d02ecf71cf
commit 7b9cf79f10
7 changed files with 126 additions and 69 deletions

View File

@ -1,29 +0,0 @@
// Configure shared Android settings. This should be run (using "apply from")
// immediately after applying the Android plugin. Be aware that IntelliJ does
// not parse these values correctly: the Android-Gradle facet panel manually
// parses build.gradle rather than interrogating the Gradle model.
android {
compileSdkVersion "android-${mozconfig.defines.ANDROID_TARGET_SDK}"
// Turn "android-sdk/build-tools/21.1.1" into "21.1.1".
buildToolsVersion (new File(mozconfig.substs.ANDROID_BUILD_TOOLS).getName())
defaultConfig {
targetSdkVersion mozconfig.defines.ANDROID_TARGET_SDK
minSdkVersion mozconfig.defines.MOZ_ANDROID_MIN_SDK_VERSION
if (mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION) {
maxSdkVersion mozconfig.defines.MOZ_ANDROID_MAX_SDK_VERSION
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
android {
lintOptions {
abortOnError false
}
}
}

View File

@ -1,8 +1,28 @@
apply plugin: 'com.android.application'
apply from: rootProject.file("${topsrcdir}/mobile/android/gradle/android.gradle")
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
preDexLibraries true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled true

View File

@ -1,8 +1,27 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
@ -31,12 +50,13 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.+'
compile 'com.android.support:support-v4:21.+'
if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
compile 'com.android.support:appcompat-v7:19.1.+'
compile 'com.android.support:mediarouter-v7:19.1.+'
compile 'com.google.android.gms:play-services:5.+'
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:mediarouter-v7:21.+'
compile 'com.google.android.gms:play-services-base:6.5.+'
compile 'com.google.android.gms:play-services-cast:6.5.+'
}
compile project(':branding')
@ -53,9 +73,7 @@ apply plugin: 'idea'
idea {
module {
// excludeDirs = []
excludeDirs += file('src/main/java/org/mozilla/gecko/tests')
excludeDirs += file('org/mozilla/gecko/resources')
excludeDirs += file('org/mozilla/gecko/tests')
excludeDirs += file('tests')
}
}

View File

@ -1,12 +1,24 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
}
lintOptions {
abortOnError false
}
}

View File

@ -1,13 +1,25 @@
apply plugin: 'android-library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
}
lintOptions {
abortOnError false
}
}

View File

@ -1,13 +1,25 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
}
lintOptions {
abortOnError false
}
}

View File

@ -1,17 +1,29 @@
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/android.gradle"
android {
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
}
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
targetSdkVersion 21
minSdkVersion 9
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
incremental true
}
lintOptions {
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:19.1.+'
compile 'com.android.support:support-v4:21.+'
}