Permalink
Fetching contributors…
Cannot retrieve contributors at this time
206 lines (168 sloc) 6.87 KB
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-allopen'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.cookpad.android.licensetools'
allOpen {
// allows mocking for classes w/o directly opening them for release builds
annotation 'de.metzgore.beansplan.testing.OpenClass'
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "de.metzgore.beansplan"
minSdkVersion 21
targetSdkVersion 27
versionCode 6
versionName "1.1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
}
}
signingConfigs {
release
}
buildTypes {
debug {
applicationIdSuffix ".dev"
minifyEnabled false
shrinkResources false
useProguard false
}
release {
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
def isRunningOnTravis = System.getenv("CI") == "true"
if (isRunningOnTravis) {
signingConfigs.release.storeFile = file("../android.jks")
signingConfigs.release.storePassword = System.getenv("keystore_password")
signingConfigs.release.keyAlias = System.getenv("keystore_alias")
signingConfigs.release.keyPassword = System.getenv("keystore_alias_password")
} else {
File propFile = file('signing.properties')
if (propFile.exists()) {
Properties props = new Properties()
props.load(new FileInputStream(propFile))
if (props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') &&
props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) {
signingConfigs.release.storeFile = file(props['STORE_FILE'])
signingConfigs.release.storePassword = props['STORE_PASSWORD']
signingConfigs.release.keyAlias = props['KEY_ALIAS']
signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
buildTypes.release.signingConfig = null
}
} else {
buildTypes.release.signingConfig = null
}
}
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "beansplan_${variant.versionName}.apk"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
lintOptions {
abortOnError false
}
testOptions {
unitTests.returnDefaultValues = true
unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
sourceSets {
String sharedTestResourcesDir = 'src/sharedTest/resources'
String sharedTestJavaDir = 'src/sharedTest/java'
test {
java.srcDirs += [sharedTestJavaDir]
resources.srcDirs += [sharedTestResourcesDir]
}
androidTest {
java.srcDirs += [sharedTestJavaDir]
resources.srcDirs += [sharedTestResourcesDir]
}
}
flavorDimensions "default"
productFlavors {
prod {
dimension "default"
buildConfigField 'String', 'HOST', '"http://api.rbtv.rodney.io/"'
}
mockedServer {
dimension "default"
buildConfigField 'String', 'HOST', '"http://127.0.0.1:43210/"'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//Unit tests
testImplementation "android.arch.core:core-testing:$arch_components_version"
testImplementation 'junit:junit:4.12'
testImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3_version"
testImplementation "org.mockito:mockito-core:$mockito_version"
//Android tests
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation('com.schibsted.spain:barista:2.5.0') {
exclude group: 'com.android.support'
exclude group: 'org.jetbrains.kotlin' // Only if you already use Kotlin in your project
}
androidTestImplementation "android.arch.core:core-testing:$arch_components_version"
androidTestImplementation "org.mockito:mockito-core:$mockito_version"
androidTestImplementation "com.squareup.okhttp3:mockwebserver:$okhttp3_version"
androidTestImplementation 'io.mockk:mockk-android:1.8.6'
//Support libs
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:preference-v7:$support_version"
implementation 'com.google.code.gson:gson:2.8.5'
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'org.apache.commons:commons-lang3:3.7'
implementation "android.arch.lifecycle:extensions:$arch_components_version"
implementation "android.arch.persistence.room:runtime:$arch_components_version"
kapt "android.arch.persistence.room:compiler:$arch_components_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
androidTestImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
implementation 'com.github.daniel-stoneuk:material-about-library:2.3.0'
implementation 'com.mikepenz:iconics-core:3.0.4@aar'
implementation 'com.mikepenz:community-material-typeface:2.0.46.1@aar'
implementation "com.google.dagger:dagger-android:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.0'
}
// we need all open to run tests which a we enable only for debug builds.
project.tasks.whenTaskAdded {
if (it.name == "testProdReleaseUnitTest" || it.name == "testMockedServerReleaseUnitTest") {
it.enabled = false
}
}