blob: ea8ce96e065acaf5f013107018abe82cbff7e5ac [file] [log] [blame]
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
maven { url 'http://wordpress-mobile.github.io/WordPress-Android' }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
useLibrary 'org.apache.http.legacy'
dexOptions {
jumboMode = true
javaMaxHeapSize = "6g"
dexInProcess = true
}
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "org.wordpress.android"
versionName "6.0-rc-1"
versionCode 308
minSdkVersion 16
targetSdkVersion 24
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
productFlavors {
vanilla {} // used for release and beta
zalpha { // alpha version - enable experimental features
applicationId "org.wordpress.android"
}
wasabi { // "hot" version, can be installed along release, alpha or beta versions
applicationId "org.wordpress.android.beta"
minSdkVersion 21 // to take advantage of "fast" multi dex (pre-dex each module)
}
}
buildTypes {
release {
// Proguard is used to shrink our apk, and reduce the number of methods in our final apk,
// but we don't obfuscate the bytecode.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
}
debug {
minifyEnabled false
buildConfigField "String", "APP_PN_KEY", "\"org.wordpress.android.debug.build\""
ext.enableCrashlytics = false
}
}
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
// Provided by maven central
compile ('org.wordpress:mediapicker:1.2.4') {
exclude group:'com.android.support'
}
compile 'com.google.code.gson:gson:2.6.+'
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
compile 'com.android.support:support-compat:24.2.1'
compile 'com.android.support:support-core-ui:24.2.1'
compile 'com.android.support:support-fragment:24.2.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:percent:24.2.1'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.android.gms:play-services-auth:9.0.2'
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.helpshift:android-helpshift-aar:4.7.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.automattic:rest:1.0.7'
compile 'org.wordpress:graphview:3.4.0'
compile 'org.wordpress:persistentedittext:1.0.1'
compile 'org.wordpress:emailchecker2:1.1.0'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.github.xizzhu:simple-tool-tip:0.5.0'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
androidTestCompile 'org.objenesis:objenesis:2.1'
androidTestCompile 'org.mockito:mockito-core:+'
androidTestCompile 'com.squareup.okhttp:mockwebserver:2.7.5'
androidTestCompile 'com.squareup.okio:okio:1.9.0' // explicitly compile okio to match the version needed by ucrop
// Provided by the WordPress-Android Repository
compile 'org.wordpress:drag-sort-listview:0.6.1' // not found in maven central
compile 'org.wordpress:slidinguppanel:1.0.0' // not found in maven central
compile 'org.wordpress:passcodelock:1.3.0'
// Simperium
compile 'com.simperium.android:simperium:0.6.8'
releaseCompile project(path:':libs:utils:WordPressUtils', configuration: 'release')
debugCompile project(path:':libs:utils:WordPressUtils', configuration: 'debug')
releaseCompile project(path:':libs:networking:WordPressNetworking', configuration: 'release')
debugCompile project(path:':libs:networking:WordPressNetworking', configuration: 'debug')
releaseCompile project(path:':libs:analytics:WordPressAnalytics', configuration: 'release')
debugCompile project(path:':libs:analytics:WordPressAnalytics', configuration: 'debug')
releaseCompile project(path:':libs:editor:WordPressEditor', configuration: 'release')
debugCompile project(path:':libs:editor:WordPressEditor', configuration: 'debug')
}
configurations.all {
// Exclude packaged wordpress sub projects, force the use of the source project
// (eg. use :libs:utils:WordPressUtils instead of 'org.wordpress:utils')
exclude group: 'org.wordpress', module: 'utils'
exclude group: 'org.wordpress', module: 'analytics'
}
task generateCrashlyticsConfig(group: "generate", description: "Generate Crashlytics config") {
def outputFile = new File("${rootDir}/WordPress/crashlytics.properties")
def inputFile = file("${rootDir}/WordPress/gradle.properties")
if (!inputFile.exists()) {
throw new StopActionException("Build configuration file:" + inputFile
+ " doesn't exist, follow README instructions")
}
outputs.file outputFile
inputs.file inputFile
doLast {
def properties = new Properties()
inputFile.withInputStream { stream ->
properties.load(stream)
}
def crashlyticsApiKey = properties.getProperty('wp.crashlytics.apikey', '0')
def writer = new FileWriter(outputFile)
writer.write("""// auto-generated file from ${rootDir}/gradle.properties do not modify
apiKey=${crashlyticsApiKey}""")
writer.close()
}
}
// Add generateCrashlyticsConfig to all generateBuildConfig tasks (all variants)
android.applicationVariants.all { variant ->
variant.generateBuildConfig.dependsOn(generateCrashlyticsConfig)
}
// Add properties named "wp.xxx" to our BuildConfig
android.buildTypes.all { buildType ->
project.properties.any { property ->
if (property.key.toLowerCase().startsWith("wp.")) {
buildType.buildConfigField "String", property.key.replace("wp.", "").replace(".", "_").toUpperCase(),
"\"${property.value}\""
}
}
}
// For app signing
if (["storeFile", "storePassword", "keyAlias", "keyPassword"].count { !project.hasProperty(it) } == 0) {
android {
signingConfigs {
release {
storeFile = file(project.storeFile)
storePassword = project.storePassword
keyAlias = project.keyAlias
keyPassword = project.keyPassword
}
}
}
android.buildTypes.release.signingConfig = android.signingConfigs.release
}