Permalink
248 lines (229 sloc) 9.11 KB
buildscript {
ext.buildConfig = [
'compileSdk': 28,
'minSdk': 24,
'targetSdk': 28,
'version': [
'major': 1,
'minor': 3,
'patch': 4,
'build': 0,
],
]
ext.buildConfig.version['name'] = "${buildConfig.version.major}.${buildConfig.version.minor}.${buildConfig.version.patch}"
ext.buildConfig.version['fullName'] = "${buildConfig.version.name}.${buildConfig.version.build}"
ext.buildConfig.version['code'] = buildConfig.version.major * 1000000 + buildConfig.version.minor * 10000 + buildConfig.version.patch * 100 + buildConfig.version.build
ext.versions = [
'kotlin': '1.3.11',
'kotlinCoroutines': '1.0.1',
'kotlinSerialization': '0.9.1',
'okhttp': '3.12.0',
'retrofit': '2.5.0',
'kotshi': '1.0.6',
'dagger': '2.19',
'sqldelight': '1.0.0-rc4',
]
ext.deps = [
'kotlin': [
'stdlib': [
'common': "org.jetbrains.kotlin:kotlin-stdlib-common:${versions.kotlin}",
'jdk': "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}",
'js': "org.jetbrains.kotlin:kotlin-stdlib-js:${versions.kotlin}",
],
'test': [
'common': "org.jetbrains.kotlin:kotlin-test-common:${versions.kotlin}",
'annotations': "org.jetbrains.kotlin:kotlin-test-annotations-common:${versions.kotlin}",
'jdk': "org.jetbrains.kotlin:kotlin-test-junit:${versions.kotlin}",
'js': "org.jetbrains.kotlin:kotlin-test-js:${versions.kotlin}",
],
'coroutines': [
'common': "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${versions.kotlinCoroutines}",
'jdk': "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}",
'jdk8': "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${versions.kotlinCoroutines}",
'js': "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:${versions.kotlinCoroutines}",
'android': "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}",
],
'serialization': [
'common': "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${versions.kotlinSerialization}",
'jdk': "org.jetbrains.kotlinx:kotlinx-serialization-runtime:${versions.kotlinSerialization}",
'js': "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${versions.kotlinSerialization}",
],
],
'androidx': [
'annotations': 'androidx.annotation:annotation:1.0.0',
'appCompat': 'androidx.appcompat:appcompat:1.0.0',
'browser': 'androidx.browser:browser:1.0.0',
'constraintLayout': 'androidx.constraintlayout:constraintlayout:1.1.3',
'core': 'androidx.core:core-ktx:1.0.0',
'recyclerView': 'androidx.recyclerview:recyclerview:1.1.0-alpha01',
'sqliteFramework': 'androidx.sqlite:sqlite-framework:1.0.0',
'test': [
'runner': 'androidx.test:runner:1.1.0-alpha4',
'rules': 'androidx.test:rules:1.1.0-alpha4',
],
],
'material': 'com.google.android.material:material:1.0.0',
'okhttp': [
'client': "com.squareup.okhttp3:okhttp:${versions.okhttp}",
'logging': "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}",
'mockWebServer': "com.squareup.okhttp3:mockwebserver:${versions.okhttp}",
],
'retrofit': [
'client': "com.squareup.retrofit2:retrofit:${versions.retrofit}",
'adapterKotlinCoroutines': 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2',
'converterKotlinxSerialization': 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.2.0',
'converterMoshi': "com.squareup.retrofit2:converter-moshi:${versions.retrofit}",
],
'kotshi': [
'api': "se.ansman.kotshi:api:${versions.kotshi}",
'compiler': "se.ansman.kotshi:compiler:${versions.kotshi}",
],
'dagger': [
'runtime': "com.google.dagger:dagger:${versions.dagger}",
'compiler': "com.google.dagger:dagger-compiler:${versions.dagger}",
'androidRuntime': "com.google.dagger:dagger-android:${versions.dagger}",
'androidCompiler': "com.google.dagger:dagger-android-processor:${versions.dagger}",
],
'okio': 'com.squareup.okio:okio:2.1.0',
'moshi': 'com.squareup.moshi:moshi:1.8.0',
'timber': [
'common': 'com.jakewharton.timber:timber-common:5.0.0-SNAPSHOT',
'jdk': 'com.jakewharton.timber:timber-jdk:5.0.0-SNAPSHOT',
'js': 'com.jakewharton.timber:timber-js:5.0.0-SNAPSHOT',
'android': 'com.jakewharton.timber:timber-android:5.0.0-SNAPSHOT',
],
'junit': 'junit:junit:4.12',
'truth': 'com.google.truth:truth:0.42',
'compileTesting': 'com.google.testing.compile:compile-testing:0.15',
'javaPoet': 'com.squareup:javapoet:1.11.1',
'auto': [
'service': 'com.google.auto.service:auto-service:1.0-rc4',
'value': [
'annotations': 'com.google.auto.value:auto-value-annotations:1.6.2',
'compiler': 'com.google.auto.value:auto-value:1.6.2',
],
],
'jetbrainsAnnotations': 'org.jetbrains:annotations:16.0.3',
'bugsnag': 'com.bugsnag:bugsnag-android:4.2.2',
'argparser': 'com.xenomachina:kotlin-argparser:2.0.5',
'byteunits': 'com.jakewharton.byteunits:byteunits:0.9.1',
'sqldelight': [
'android': "com.squareup.sqldelight:android-driver:${versions.sqldelight}",
'runtime': [
'common': "com.squareup.sqldelight:runtime-metadata:${versions.sqldelight}",
'jdk': "com.squareup.sqldelight:runtime-jvm:${versions.sqldelight}",
'js': "com.squareup.sqldelight:runtime-js:${versions.sqldelight}",
],
],
]
ext.isCiBuild = System.getenv('CI') == 'true'
repositories {
mavenCentral()
google()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-rc02'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}"
classpath 'org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.44'
classpath "com.squareup.sqldelight:gradle-plugin:${versions.sqldelight}"
classpath 'gradle.plugin.org.jlleitschuh.gradle:ktlint-gradle:5.0.0'
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
}
}
allprojects {
apply plugin: 'org.jlleitschuh.gradle.ktlint'
repositories {
mavenCentral()
google()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
jcenter()
}
configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all Kotlin stdlib artifacts to use the same version.
if (details.requested.group == 'org.jetbrains.kotlin'
&& details.requested.name.startsWith('kotlin-stdlib')) {
details.useVersion versions.kotlin
}
}
}
}
// TODO this hasn't landed in the compiler yet
//afterEvaluate {
// def kotlin = extensions.findByName('kotlin')
// if (kotlin != null) {
// kotlin.experimental {
// newInference 'enable'
// }
// }
//}
tasks.withType(JavaCompile).all {
options.compilerArgs += [
'-Adagger.formatGeneratedSource=disabled'
]
}
afterEvaluate {
def kapt = extensions.findByName('kapt')
if (kapt != null) {
kapt.arguments {
arg("dagger.formatGeneratedSource", "disabled")
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += [
'-progressive'
]
}
}
tasks.withType(Test) {
testLogging {
events "skipped", "failed", "passed"
}
}
// TODO same thing for instrumentation tests: https://issuetracker.google.com/issues/37056080
//tasks.withType(AndroidTestTask) {
// testLogging {
// events "skipped", "failed", "passed"
// }
//}
}
def gitSha() {
def f = new File(buildDir, "commit-sha.txt")
if (!f.exists()) {
def p = 'git rev-parse HEAD'.execute([], project.rootDir)
if (p.waitFor() != 0) {
throw new RuntimeException(p.errorStream.text)
}
f.parentFile.mkdirs()
f.text = p.text.trim()
}
return f.text.trim()
}
def gitTimestamp() {
def f = new File(buildDir, "commit-timestamp.txt")
if (!f.exists()) {
def p = 'git log -n 1 --format=%at'.execute([], rootDir)
if (p.waitFor() != 0) {
throw new RuntimeException(p.errorStream.text)
}
f.parentFile.mkdirs()
f.text = p.text.trim()
}
return f.text.trim()
}
def propOrEmpty(String name) {
return hasProperty(name) ? getProperty(name) : ''
}
def useDaggerReflect() {
return hasProperty('dagger.reflect') ? getProperty('dagger.reflect') == 'true' : false
}
apply from: file('gradle/projectDependencyGraph.gradle')