Convert build script to kotlin dsl

pull/820/head
Alex Baker 5 years ago
parent 63b486bf3a
commit f733660480

@ -1,211 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'checkstyle'
apply plugin: 'io.fabric'
apply plugin: 'com.cookpad.android.licensetools'
repositories {
jcenter()
google()
}
android {
lintOptions {
lintConfig file("lint.xml")
textOutput 'stdout'
textReport true
ignoreTestSources true
}
compileSdkVersion 28
defaultConfig {
testApplicationId "org.tasks.test"
applicationId "org.tasks"
versionCode 589
versionName "6.7"
targetSdkVersion 28
minSdkVersion 16
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
signingConfigs {
release
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue 'string', 'mapbox_key', project.hasProperty('tasks_mapbox_key_debug') ? tasks_mapbox_key_debug : ''
resValue 'string', 'google_key', project.hasProperty('tasks_google_key_debug') ? tasks_google_key_debug : ''
testCoverageEnabled project.hasProperty('coverage')
}
release {
resValue 'string', 'mapbox_key', project.hasProperty('tasks_mapbox_key') ? tasks_mapbox_key : ''
resValue 'string', 'google_key', project.hasProperty('tasks_google_key') ? tasks_google_key : ''
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.pro'
signingConfig signingConfigs.release
}
applicationVariants.all { variant ->
variant.resValue "string", "app_package", variant.applicationId
}
}
flavorDimensions 'store'
productFlavors {
generic {
dimension 'store'
proguardFile 'generic.pro'
}
googleplay {
dimension 'store'
}
amazon {
dimension 'store'
}
}
if (project.hasProperty('keyAlias') &&
project.hasProperty('storeFile') &&
project.hasProperty('storePassword') &&
project.hasProperty('keyPassword')) {
android.signingConfigs.release.keyAlias = keyAlias
android.signingConfigs.release.storeFile = file(storeFile)
android.signingConfigs.release.storePassword = storePassword
android.signingConfigs.release.keyPassword = keyPassword
} else {
buildTypes.release.signingConfig = null
}
}
task checkstyle(type: Checkstyle) {
source fileTree('src')
include '**/*.java'
exclude '**/gen/**'
classpath = files()
showViolations true
reports {
xml.enabled = true
html.enabled = true
html.destination = project.file("$buildDir/reports/checkstyle/checkstyle.html")
}
}
checkstyle {
configFile project.file('google_checks.xml')
toolVersion = '8.16'
}
configurations {
all*.exclude group: 'com.google.guava', module: 'guava-jdk5'
all*.exclude group: 'org.apache.httpcomponents', module: 'httpclient'
all*.exclude group: 'com.google.http-client', module: 'google-http-client-apache'
}
final DAGGER_VERSION = '2.23.2'
final BUTTERKNIFE_VERSION = '10.1.0'
final WORK_VERSION = '2.0.1'
final LEAKCANARY_VERSION = '1.6.3'
final ROOM_VERSION = '2.1.0'
final CRASHLYTICS_VERSION = '2.10.1'
final FIREBASE_VERSION = '16.0.9'
dependencies {
implementation(project(":dav4jvm")) {
exclude group: 'org.ogce', module: 'xpp3'
}
implementation(project(":ical4android")) {
exclude group: 'org.threeten', module: 'threetenbp'
}
annotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
implementation "com.google.dagger:dagger:${DAGGER_VERSION}"
implementation "androidx.room:room-rxjava2:${ROOM_VERSION}"
annotationProcessor "androidx.room:room-compiler:${ROOM_VERSION}"
implementation "androidx.lifecycle:lifecycle-extensions:2.0.0"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "androidx.paging:paging-runtime:2.1.0"
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}"
implementation "com.jakewharton:butterknife:${BUTTERKNIFE_VERSION}"
debugImplementation 'com.facebook.flipper:flipper:0.21.1'
debugImplementation 'com.facebook.soloader:soloader:0.6.0'
debugImplementation "com.squareup.leakcanary:leakcanary-android:${LEAKCANARY_VERSION}"
debugImplementation "com.squareup.leakcanary:leakcanary-support-fragment:${LEAKCANARY_VERSION}"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:2.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'me.saket:better-link-movement-method:2.2.0'
//noinspection GradleDependency
implementation 'com.squareup.okhttp3:okhttp:3.12.2' // 3.13 minSdk is 21
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.rey5137:material:1.2.5'
implementation 'com.nononsenseapps:filepicker:4.2.1'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.0'
//noinspection GradleDependency
implementation 'com.google.guava:guava:27.1-android'
implementation 'com.jakewharton:process-phoenix:2.0.0'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation 'com.twofortyfouram:android-plugin-api-for-locale:1.0.2'
implementation('com.rubiconproject.oss:jchronic:0.2.6') {
transitive = false
}
implementation('org.scala-saddle:google-rfc-2445:20110304') {
transitive = false
}
implementation('com.wdullaer:materialdatetimepicker:4.0.1')
implementation "me.leolin:ShortcutBadger:1.1.22@aar"
implementation 'com.google.apis:google-api-services-tasks:v1-rev59-1.25.0'
implementation 'com.google.apis:google-api-services-drive:v3-rev165-1.25.0'
implementation 'com.google.api-client:google-api-client-android:1.29.2'
implementation "androidx.work:work-runtime:${WORK_VERSION}"
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0'
implementation'com.mapbox.mapboxsdk:mapbox-sdk-services:4.6.0'
googleplayImplementation "com.crashlytics.sdk.android:crashlytics:${CRASHLYTICS_VERSION}"
googleplayImplementation "com.google.firebase:firebase-core:${FIREBASE_VERSION}"
googleplayImplementation "com.google.android.gms:play-services-location:16.0.0"
googleplayImplementation 'com.google.android.gms:play-services-maps:16.1.0'
googleplayImplementation 'com.google.android.libraries.places:places:1.1.0'
googleplayImplementation 'com.android.billingclient:billing:1.2.2'
amazonImplementation fileTree(dir: 'libs', include: ['*.jar'])
amazonImplementation "com.crashlytics.sdk.android:crashlytics:${CRASHLYTICS_VERSION}"
amazonImplementation "com.google.firebase:firebase-core:${FIREBASE_VERSION}"
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
androidTestAnnotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}"
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation 'com.natpryce:make-it-easy:4.0.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
}
apply plugin: 'com.google.gms.google-services'

@ -0,0 +1,201 @@
import com.android.build.gradle.api.ApplicationVariant
plugins {
id("com.android.application")
id("checkstyle")
id("io.fabric")
id("com.cookpad.android.licensetools")
kotlin("android")
}
repositories {
jcenter()
google()
}
android {
lintOptions {
setLintConfig(file("lint.xml"))
textOutput("stdout")
textReport = true
}
compileSdkVersion(Versions.compileSdk)
defaultConfig {
testApplicationId = "org.tasks.test"
applicationId = "org.tasks"
versionCode = 589
versionName = "6.7"
targetSdkVersion(Versions.compileSdk)
minSdkVersion(Versions.minSdk)
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments["room.schemaLocation"] = "$projectDir/schemas"
}
}
}
signingConfigs {
create("release") {
val tasksKeyAlias: String? by project
val tasksStoreFile: String? by project
val tasksStorePassword: String? by project
val tasksKeyPassword: String? by project
keyAlias = tasksKeyAlias
storeFile = file(tasksStoreFile?: "none")
storePassword = tasksStorePassword
keyPassword = tasksKeyPassword
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildTypes {
getByName("debug") {
val tasks_mapbox_key_debug: String? by project
val tasks_google_key_debug: String? by project
applicationIdSuffix = ".debug"
resValue("string", "mapbox_key", tasks_mapbox_key_debug ?: "")
resValue("string", "google_key", tasks_google_key_debug ?: "")
isTestCoverageEnabled = project.hasProperty("coverage")
}
getByName("release") {
val tasks_mapbox_key: String? by project
val tasks_google_key: String? by project
resValue("string", "mapbox_key", tasks_mapbox_key ?: "")
resValue("string", "google_key", tasks_google_key ?: "")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard.pro")
signingConfig = signingConfigs.getByName("release")
}
}
applicationVariants.all(object : Action<ApplicationVariant> {
override fun execute(variant: ApplicationVariant) {
variant.resValue("string", "app_package", variant.applicationId)
}
})
flavorDimensions("store")
productFlavors {
create("generic") {
setDimension("store")
proguardFile("generic.pro")
}
create("googleplay") {
setDimension("store")
}
create("amazon") {
setDimension("store")
}
}
}
configure<CheckstyleExtension> {
configFile = project.file("google_checks.xml")
toolVersion = "8.16"
}
configurations.all {
exclude(group = "com.google.guava", module = "guava-jdk5")
exclude(group = "org.apache.httpcomponents", module = "httpclient")
exclude(group = "com.google.http-client", module = "google-http-client-apache")
}
val googleplayImplementation by configurations
val amazonImplementation by configurations
dependencies {
implementation(project(":dav4jvm")) {
exclude(group = "org.ogce", module = "xpp3")
}
implementation(project(":ical4android")) {
exclude(group = "org.threeten", module = "threetenbp")
}
annotationProcessor("com.google.dagger:dagger-compiler:${Versions.dagger}")
implementation("com.google.dagger:dagger:${Versions.dagger}")
implementation("androidx.room:room-rxjava2:${Versions.room}")
annotationProcessor("androidx.room:room-compiler:${Versions.room}")
implementation("androidx.lifecycle:lifecycle-extensions:2.0.0")
implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
implementation("androidx.paging:paging-runtime:2.1.0")
annotationProcessor("com.jakewharton:butterknife-compiler:${Versions.butterknife}")
implementation("com.jakewharton:butterknife:${Versions.butterknife}")
debugImplementation("com.facebook.flipper:flipper:0.22.0")
debugImplementation("com.facebook.soloader:soloader:0.6.0")
debugImplementation("com.squareup.leakcanary:leakcanary-android:${Versions.leakcanary}")
debugImplementation("com.squareup.leakcanary:leakcanary-support-fragment:${Versions.leakcanary}")
implementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
implementation("io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:2.0.0")
implementation("androidx.multidex:multidex:2.0.1")
implementation("me.saket:better-link-movement-method:2.2.0")
//noinspection GradleDependency
implementation("com.squareup.okhttp3:okhttp:3.12.2") // 3.13 minSdk is 21
implementation("com.google.code.gson:gson:2.8.5")
implementation("com.github.rey5137:material:1.2.5")
implementation("com.nononsenseapps:filepicker:4.2.1")
implementation("com.google.android.material:material:1.0.0")
implementation("androidx.annotation:annotation:1.1.0")
implementation("androidx.cardview:cardview:1.0.0")
implementation("androidx.constraintlayout:constraintlayout:2.0.0-beta1")
implementation("com.jakewharton.timber:timber:4.7.1")
implementation("com.jakewharton.threetenabp:threetenabp:1.2.0")
//noinspection GradleDependency
implementation("com.google.guava:guava:27.1-android")
implementation("com.jakewharton:process-phoenix:2.0.0")
implementation("com.google.android.apps.dashclock:dashclock-api:2.0.0")
implementation("com.twofortyfouram:android-plugin-api-for-locale:1.0.2")
implementation("com.rubiconproject.oss:jchronic:0.2.6") {
isTransitive = false
}
implementation("org.scala-saddle:google-rfc-2445:20110304") {
isTransitive = false
}
implementation("com.wdullaer:materialdatetimepicker:4.0.1")
implementation("me.leolin:ShortcutBadger:1.1.22@aar")
implementation("com.google.apis:google-api-services-tasks:v1-rev59-1.25.0")
implementation("com.google.apis:google-api-services-drive:v3-rev165-1.25.0")
implementation("com.google.api-client:google-api-client-android:1.29.2")
implementation("androidx.work:work-runtime:${Versions.work}")
implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0")
implementation("com.mapbox.mapboxsdk:mapbox-sdk-services:4.6.0")
googleplayImplementation("com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}")
googleplayImplementation("com.google.firebase:firebase-core:${Versions.firebase}")
googleplayImplementation("com.google.android.gms:play-services-location:16.0.0")
googleplayImplementation("com.google.android.gms:play-services-maps:16.1.0")
googleplayImplementation("com.google.android.libraries.places:places:1.1.0")
googleplayImplementation("com.android.billingclient:billing:1.2.2")
amazonImplementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
amazonImplementation("com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}")
amazonImplementation("com.google.firebase:firebase-core:${Versions.firebase}")
androidTestAnnotationProcessor("com.google.dagger:dagger-compiler:${Versions.dagger}")
androidTestAnnotationProcessor("com.jakewharton:butterknife-compiler:${Versions.butterknife}")
androidTestImplementation("com.google.dexmaker:dexmaker-mockito:1.2")
androidTestImplementation("com.natpryce:make-it-easy:4.0.1")
androidTestImplementation("androidx.test:runner:1.2.0")
androidTestImplementation("androidx.test:rules:1.2.0")
androidTestImplementation("androidx.test.ext:junit:1.1.1")
androidTestImplementation("androidx.annotation:annotation:1.1.0")
}
apply(mapOf("plugin" to "com.google.gms.google-services"))

@ -1501,7 +1501,7 @@
"artifactId": {
"name": "kotlin-stdlib",
"group": "org.jetbrains.kotlin",
"version": "1.2.60"
"version": "1.3.40"
}
},
{
@ -1629,7 +1629,7 @@
"artifactId": {
"name": "kotlin-stdlib-common",
"group": "org.jetbrains.kotlin",
"version": "1.2.60"
"version": "1.3.40"
}
},
{

@ -1,28 +0,0 @@
apply plugin: "com.github.ben-manes.versions"
wrapper {
gradleVersion = "5.1.1"
distributionType = Wrapper.DistributionType.ALL
}
buildscript {
ext.kotlinVersion = '1.3.31'
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.29.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.21.0'
classpath 'com.cookpad.android.licensetools:license-tools-plugin:1.7.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}

@ -0,0 +1,26 @@
buildscript {
repositories {
jcenter()
google()
maven("https://maven.fabric.io/public")
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
classpath("com.google.gms:google-services:4.2.0")
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath("io.fabric.tools:gradle:1.29.0")
classpath("com.github.ben-manes:gradle-versions-plugin:0.21.0")
classpath("com.cookpad.android.licensetools:license-tools-plugin:1.7.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
}
}
plugins {
id("com.github.ben-manes.versions") version "0.21.0"
}
tasks.getByName<Wrapper>("wrapper") {
gradleVersion = "5.1.1"
distributionType = Wrapper.DistributionType.ALL
}

@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}
repositories {
jcenter()
}

@ -0,0 +1,12 @@
object Versions {
const val kotlin = "1.3.40"
const val compileSdk = 28
const val minSdk = 16
const val dagger = "2.23.2"
const val butterknife = "10.1.0"
const val work = "2.0.1"
const val leakcanary = "1.6.3"
const val room = "2.1.0"
const val crashlytics = "2.10.1"
const val firebase = "16.0.9"
}

@ -1 +0,0 @@
include 'dav4jvm', 'ical4android', 'app'

@ -0,0 +1 @@
include("dav4jvm", "ical4android", "app")
Loading…
Cancel
Save