Skip to content

Commit

Permalink
More conversion for KTS and spotless Update
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmaggi committed Dec 30, 2019
1 parent 730b944 commit 1cc9636
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 178 deletions.
11 changes: 6 additions & 5 deletions about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ plugins {
kotlin("kapt")
}

apply(from = "$rootDir/dependencies.gradle.kts")

android {
compileSdkVersion(Versions.compileSdk)

Expand All @@ -37,16 +39,15 @@ android {
}
}

dataBinding.isEnabled = true

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

sharedDependencies()
testDependencies()
buildFeatures {
dataBinding = true
}
}

dependencies {
implementation(project(":app"))
Expand Down
31 changes: 15 additions & 16 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import org.jetbrains.kotlin.kapt3.base.Kapt.kapt

plugins {
id("com.android.application")
kotlin("android")
Expand All @@ -25,6 +23,8 @@ plugins {
id("com.google.gms.google-services")
}

apply(from = "$rootDir/dependencies.gradle.kts")

android {
compileSdkVersion(Versions.compileSdk)

Expand All @@ -51,8 +51,6 @@ android {
}
}

dataBinding.isEnabled = true

buildTypes {
getByName("release") {
// There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features
Expand Down Expand Up @@ -84,27 +82,28 @@ android {
":dribbble",
":search"
)
}

sharedDependencies()
testDependencies()
buildFeatures {
dataBinding = true
}

kotlinOptions {
jvmTarget = "1.8"
}
}

dependencies {
implementation(project(":core"))
implementation("androidx.appcompat:appcompat:${Versions.appcompat}")
implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}")
implementation("com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}")
implementation("com.google.firebase:firebase-core:${Versions.firebase}")
implementation("com.github.bumptech.glide:glide:${Versions.glide}")
implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}")
implementation("com.google.firebase:firebase-core:${Versions.firebase}")

kapt("com.google.dagger:dagger-compiler:${Versions.dagger}")
}

kapt {
useBuildCache = true
}

//// Must be applied after dependencies. See https://stackoverflow.com/a/38018985
//plugins {
// id("com.google.gms.google-services")
//}
//kapt {
// useBuildCache = true
//}
54 changes: 37 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* limitations under the License.
*/

plugins {
id("com.diffplug.gradle.spotless") version "3.26.1"
}

buildscript {

Config.run { repositories.deps() }
Expand All @@ -27,23 +31,39 @@ buildscript {

}

//plugins {
// id 'com.diffplug.gradle.spotless' version '3.14.0'
//}

//subprojects {
// apply plugin: 'com.diffplug.gradle.spotless'
// spotless {
// kotlin {
// target '**/*.kt'
// ktlint(versions.ktlint)
// licenseHeaderFile project.rootProject.file('scripts/copyright.kt')
// }
spotless {
kotlin {
target("**/*.kt")
ktlint("0.36.0")
licenseHeaderFile("$rootDir/scripts/copyright.txt", "(package |import |@file:)")
// paddedCell()
}
// kotlin {
// // optionally takes a version
// ktlint()
// // Optional user arguments can be set as such:
// ktlint().userData(['indent_size': '2', 'continuation_indent_size' : '2'])
//
// // also supports license headers
// licenseHeader '/* Licensed under Apache-2.0 */' // License header
// licenseHeaderFile 'path-to-license-file' // License header file
// }
//}

// kotlinGradle {
// // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts')
// target '*.gradle.kts', 'additionalScripts/*.gradle.kts'
//
// ktlint()
//
// // Optional user arguments can be set as such:
// ktlint().userData(['indent_size': '2', 'continuation_indent_size' : '2'])
//
// // doesn't support licenseHeader, because scripts don't have a package statement
// // to clearly mark where the license should go
// }
}
subprojects {

Config.run { repositories.deps() }

}
Config.run {
repositories.deps()
}
}
50 changes: 23 additions & 27 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/*
* Copyright 2019 Google LLC
* Copyright 2019 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.maven

@Suppress("MayBeConstant") // Improve perf when changing values
Expand All @@ -27,8 +25,8 @@ object Config {
includeGroupByRegex("com.android.*")
includeGroupByRegex("androidx.*")

includeGroup("android.arch.lifecycle")
includeGroup("android.arch.core")
includeGroup("androidx.lifecycle")
includeGroup("androidx.core")
includeGroup("com.google.firebase")
includeGroup("com.google.android.gms")
includeGroup("com.google.android.material")
Expand All @@ -50,7 +48,6 @@ object Config {
includeGroupByRegex("javax.*")
includeGroupByRegex("org.ow2.*")


includeGroup("com.github.bumptech.glide")
includeGroup("com.ibm.icu")
includeGroup("com.nhaarman.mockitokotlin2")
Expand Down Expand Up @@ -100,37 +97,37 @@ object Versions {
val compileSdk = 29
val targetSdk = 28
val minSdk = 23
val gradle_plugin = "3.6.0-alpha06"
val gradle_plugin = "4.0.0-alpha05"

val appcompat = "1.1.0-rc01"
val appcompat = "1.1.0"
val androidx = "1.0.0"
val androidxCollection = "1.0.0"
val androidxCoreRuntime = "2.0.1-alpha01"
val androidxCoreRuntime = "2.1.0"
val androidxArch = "2.0.0"
val constraintLayout = "2.0.0-alpha2"
val coreKtx = "1.0.0"
val coroutines = "1.1.1"
val constraintLayout = "2.0.0-beta3"
val coreKtx = "1.1.0"
val coroutines = "1.3.2"
val crashlytics = "2.10.1"
val dagger = "2.23.2"
val espresso = "3.1.0-beta02"
val extJunit = "1.1.0"
val fabric = "1.28.0"
val firebase = "17.0.0"
val firebase = "17.2.1"
val glide = "4.9.0"
val googleServices = "4.3.0"
val gson = "2.8.5"
val jsoup = "1.11.3"
val junit = "4.12"
val kotlin = "1.3.41"
val kotlin = "1.3.61"
val ktlint = "0.24.0"
val legacyCoreUtils = "1.0.0"
val lifecycle = "2.1.0-alpha01"
val lifecycle = "2.2.0-rc03"
val material = "1.1.0-alpha05"
val mockito = "2.23.0"
val mockito_kotlin = "2.0.0-RC3"
val okhttp = "3.10.0"
val okhttp = "4.2.2"
val retrofit = "2.6.0"
val room = "2.1.0"
val room = "2.2.2"
val supportLibrary = "28.0.0"
val test_rules = "1.1.0-beta02"
val test_runner = "1.1.0-beta02"
Expand All @@ -141,4 +138,3 @@ object Versions {
object Names {
val applicationId = "io.plaidapp"
}

25 changes: 12 additions & 13 deletions buildSrc/src/main/java/Helper.kt
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*
* Copyright 2019 Google LLC
* Copyright 2019 Google LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.Project
import java.io.ByteArrayOutputStream
import org.gradle.api.Project

fun Project.runCmd(vararg command: String) = try {
val stdOut = ByteArrayOutputStream()
Expand All @@ -28,4 +27,4 @@ fun Project.runCmd(vararg command: String) = try {
} catch (e: Throwable) {
e.printStackTrace()
null
}
}
80 changes: 0 additions & 80 deletions buildSrc/src/main/java/dependencies.kt

This file was deleted.

Loading

0 comments on commit 1cc9636

Please sign in to comment.