From 03bc61e992d71f3e4e0edf5adf6b726c2f36fc4c Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Wed, 7 Aug 2019 18:15:13 +0100 Subject: [PATCH 01/20] Initial incomplete conversion to Gradle Kotlin DSL --- about/build.gradle | 58 ------- about/build.gradle.kts | 64 ++++++++ app/build.gradle | 93 ----------- app/build.gradle.kts | 109 +++++++++++++ build.gradle | 108 ------------- build.gradle.kts | 77 +++++++++ buildSrc/build.gradle.kts | 33 ++++ buildSrc/settings.gradle.kts | 17 ++ buildSrc/src/main/java/Config.kt | 148 ++++++++++++++++++ buildSrc/src/main/java/Helper.kt | 32 ++++ .../src/main/java/dependencies.gradle.kts | 22 +++ core/proguard-rules.pro | 2 +- settings.gradle | 4 - settings.gradle.kts | 4 + shared_dependencies.gradle | 21 ++- test_dependencies.gradle | 108 ++++++------- third_party/bypass/build.gradle | 40 ----- third_party/bypass/build.gradle.kts | 27 ++++ 18 files changed, 598 insertions(+), 369 deletions(-) delete mode 100644 about/build.gradle create mode 100644 about/build.gradle.kts delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/settings.gradle.kts create mode 100644 buildSrc/src/main/java/Config.kt create mode 100644 buildSrc/src/main/java/Helper.kt create mode 100644 buildSrc/src/main/java/dependencies.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts delete mode 100644 third_party/bypass/build.gradle create mode 100644 third_party/bypass/build.gradle.kts diff --git a/about/build.gradle b/about/build.gradle deleted file mode 100644 index 480a887b1..000000000 --- a/about/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - implementation project(':bypass') - - implementation "androidx.viewpager2:viewpager2:${versions.viewPager2}" - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/about/build.gradle.kts b/about/build.gradle.kts new file mode 100644 index 000000000..a29ddfd12 --- /dev/null +++ b/about/build.gradle.kts @@ -0,0 +1,64 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + +// dataBinding { +// enabled true +// } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation(project(":app")) + implementation(project(":core")) + implementation(project(":bypass")) + + implementation("androidx.viewpager2:viewpager2:${Versions.viewPager2}") + implementation("com.android.support:customtabs:${Versions.supportLibrary}") + implementation("com.github.bumptech.glide:glide:${Versions.glide}") + + kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") +} + +kapt { + useBuildCache = true +} diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index bfaaae63d..000000000 --- a/app/build.gradle +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2015 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 - * - * 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. - */ - -apply plugin: 'com.android.application' -apply plugin: 'io.fabric' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - applicationId names.applicationId - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - versionCode rootProject.gitCommitCount - versionName = '1.1.0' - archivesBaseName = 'plaid' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - resConfig 'en' - manifestPlaceholders += [ - crashlyticsEnabled: false - ] - } - - dataBinding { - enabled true - } - - buildTypes { - release { - // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features - // The temporary workaround is to disable shrinking. - // This issue is tracked in: https://issuetracker.google.com/120517460 - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), - 'proguard-rules.pro' - manifestPlaceholders += [crashlyticsEnabled: true] - } - debug { - ext.alwaysUpdateBuildId = false - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - dynamicFeatures = [ - ':about', - ':designernews', - ':dribbble', - ':search' - ] -} - -dependencies { - implementation project(':core') - implementation "androidx.appcompat:appcompat:${versions.appcompat}" - 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}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} - -// Must be applied after dependencies. See https://stackoverflow.com/a/38018985 -apply plugin: 'com.google.gms.google-services' diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 000000000..d3c08d027 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,109 @@ +/* + * Copyright 2015 Google Inc. + * + * 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. + */ + +import org.jetbrains.kotlin.kapt3.base.Kapt.kapt + +plugins { + id("com.android.application") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") + id("io.fabric") + id("com.google.gms.google-services") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + applicationId = Names.applicationId + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + versionCode = 100 + (runCmd("git", "rev-list", "--count", "HEAD")?.toIntOrNull() ?: 1) + versionName = "1.1.0" + + setProperty("archivesBaseName", "plaid") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + resConfig("en") + manifestPlaceholders = mapOf( + "crashlyticsEnabled" to false + ) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + +// dataBinding { +// enabled true +// } +// + buildTypes { + getByName("release") { + // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features + // The temporary workaround is to disable shrinking + isMinifyEnabled = false + manifestPlaceholders = mapOf( + "crashlyticsEnabled" to true + ) + + proguardFiles( + getDefaultProguardFile("proguard-android.txt"), + "proguard-rules.pro" + ) + + } + getByName("debug") { + (this as ExtensionAware).extra["alwaysUpdateBuildId"] = false + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + dynamicFeatures = mutableSetOf( + ":about", + ":designernews", + ":dribbble", + ":search" + ) +} + +dependencies { + implementation(project(":core")) + implementation("androidx.appcompat:appcompat:${Versions.appcompat}") + 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}") + + 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") +//} \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 7213ad721..000000000 --- a/build.gradle +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2015 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 - * - * 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. - */ - -buildscript { scriptHandler -> - apply from: 'repositories.gradle', - to: scriptHandler - ext.versions = [ - 'compileSdk' : 29, - 'minSdk' : 23, - 'targetSdk' : 29, - 'appcompat' : '1.1.0-rc01', - 'androidx' : '1.0.0', - 'androidxCollection' : '1.0.0', - 'androidxArch' : '2.0.0', - 'constraintLayout' : '2.0.0-alpha2', - 'coreKtx' : '1.2.0-alpha03', - 'coroutines' : '1.3.0', - 'crashlytics' : '2.10.1', - 'dagger' : '2.23.2', - 'espresso' : '3.1.0-beta02', - 'extJunit' : '1.1.0', - 'fabric' : '1.28.0', - 'firebase' : '17.0.0', - 'glide' : '4.9.0', - 'googleServices' : '4.3.0', - 'gson' : '2.8.5', - 'jsoup' : '1.11.3', - 'junit' : '4.12', - 'kotlin' : '1.3.50', - 'ktlint' : '0.36.0', - 'legacyCoreUtils' : '1.0.0', - 'lifecycle' : '2.2.0-alpha03', - 'material' : '1.1.0-alpha05', - 'mockito' : '2.23.0', - 'mockito_kotlin' : '2.0.0-RC3', - 'okhttp' : '4.0.0', - 'retrofit' : '2.6.0', - 'room' : '2.2.1', - 'supportLibrary' : '28.0.0', - 'test_rules' : '1.1.0-beta02', - 'test_runner' : '1.1.0-beta02', - 'ui_automator' : '2.2.0-beta02', - 'viewPager2' : '1.0.0' - ] - ext.names = [ - 'applicationId': 'io.plaidapp' - ] - - dependencies { - classpath 'com.android.tools.build:gradle:3.6.0-beta03' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - classpath "com.google.gms:google-services:${versions.googleServices}" - classpath "io.fabric.tools:gradle:${versions.fabric}" - } -} - -plugins { - id 'com.diffplug.gradle.spotless' version '3.26.1' -} - -ext { - // query git for the commit count to automate versioning. - gitCommitCount = 100 + - Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim()) -} - -subprojects { - buildscript { - apply from: rootProject.file('repositories.gradle') - } - - apply plugin: 'com.diffplug.gradle.spotless' - spotless { - kotlin { - target '**/*.kt' - ktlint(versions.ktlint) - licenseHeaderFile project.rootProject.file('scripts/copyright.kt') - } - groovyGradle { - // same as groovy, but for .gradle (defaults to '*.gradle') - target '**/*.gradle' - paddedCell() // Avoid cyclic ambiguities - // the Groovy Eclipse formatter extends the Java Eclipse formatter, - // so it formats Java files by default (unless `excludeJava` is used). - greclipse().configFile(project.rootProject.file('scripts/greclipse.properties')) - licenseHeaderFile project.rootProject.file('scripts/copyright.kt'), '(buildscript|apply)' - } - } - - if (project.hasProperty( "kapt" )) { - kapt { - useBuildCache = true - } - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 000000000..d14a1ba9f --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,77 @@ +/* + * Copyright 2015 Google Inc. + * + * 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. + */ + +buildscript { + + Config.run { repositories.deps() } + + dependencies { + classpath("com.android.tools.build:gradle:${Versions.gradle_plugin}") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}") + classpath("com.google.gms:google-services:${Versions.googleServices}") + classpath("io.fabric.tools:gradle:${Versions.fabric}") + } + +} + +//plugins { +// id 'com.diffplug.gradle.spotless' version '3.14.0' +//} +// + +//subprojects { +// buildscript { +// apply from: rootProject.file('repositories.gradle') +// } +// +// apply plugin: 'com.diffplug.gradle.spotless' +// spotless { +// kotlin { +// target '**/*.kt' +// ktlint(versions.ktlint) +// licenseHeaderFile project.rootProject.file('scripts/copyright.kt') +// } +// } +//} +subprojects { + +// repositories { +// jcenter() +// } +// plugins { +// kotlin("android") +// } +// +// dependencies { +// implementation("com.google.android.material:material:${Versions.material}") +// implementation("com.google.dagger:dagger:${Versions.dagger}") +// implementation("androidx.core:core-ktx:${Versions.coreKtx}") +// implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") +// implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") +// implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") +// implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") +// implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") +// } +// +// tasks { +// compileKotlin { +// kotlinOptions { +// allWarningsAsErrors = true +// } +// } +// } + apply(plugin = "dependencies") +} \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..3327b140e --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,33 @@ +/* + * 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 + * + * 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. + * + */ + +//repositories { +// jcenter() +//} + +plugins { + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() +// jcenter() +} + +//dependencies { +// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.41") +//} \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 000000000..35689e2e2 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,17 @@ +/* + * 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 + * + * 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. + * + */ + diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt new file mode 100644 index 000000000..600d58e40 --- /dev/null +++ b/buildSrc/src/main/java/Config.kt @@ -0,0 +1,148 @@ +/* + * 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 + * + * 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.maven +import org.gradle.kotlin.dsl.version +import org.gradle.plugin.use.PluginDependenciesSpec + +@Suppress("MayBeConstant") // Improve perf when changing values +object Config { +// private const val kotlinVersion = "1.3.41" + + fun RepositoryHandler.deps() { + google().content { + includeGroupByRegex("com\\.android\\..*") + includeGroupByRegex("androidx\\..*") + + includeGroup("android.arch.lifecycle") + includeGroup("android.arch.core") + includeGroup("com.google.firebase") + includeGroup("com.google.android.gms") + includeGroup("com.google.android.material") + includeGroup("com.google.gms") + + includeGroup("zipflinger") +// includeGroup("com.crashlytics.sdk.android") +// includeGroup("io.fabric.sdk.android") + } + + jcenter().content { + includeGroupByRegex("com\\.google\\..*") + includeGroupByRegex("com\\.sun\\..*") + includeGroupByRegex("com\\.squareup\\..*") + includeGroupByRegex("com\\.jakewharton\\..*") + includeGroupByRegex("com\\.googlecode\\..*") + includeGroupByRegex("org\\.jetbrains\\..*") + includeGroupByRegex("org\\.codehaus\\..*") + includeGroupByRegex("org\\.apache\\..*") + includeGroupByRegex("net\\.sf\\..*") + includeGroupByRegex("javax\\..*") + includeGroup("com.github.bumptech.glide") + includeGroup("com.ibm.icu") + includeGroup("com.nhaarman.mockitokotlin2") + includeGroup("commons-io") + includeGroup("commons-codec") + includeGroup("commons-logging") + includeGroup("it.unimi.dsi") + includeGroup("junit") + includeGroup("me.eugeniomarletti.kotlin.metadata") + includeGroup("net.bytebuddy") + includeGroup("net.java") + includeGroup("org.abego.treelayout") + includeGroup("org.antlr") + includeGroup("org.bouncycastle") + includeGroup("org.checkerframework") + includeGroup("org.glassfish") + includeGroup("org.glassfish.jaxb") + includeGroup("org.hamcrest") + includeGroup("org.jvnet.staxex") + includeGroup("org.jsoup") + includeGroup("org.mockito") + includeGroup("org.objenesis") + includeGroup("org.ow2.asm") + includeGroup("org.sonatype.oss") + includeGroup("org.xerial") + includeGroup("net.ltgt.gradle.incap") + + excludeGroup("com.google.firebase") + excludeGroup("com.google.android.gms") + excludeGroup("com.google.android.material") + } + + maven("https://dl.bintray.com/kotlin/kotlin-eap/").content { + includeGroupByRegex("org\\.jetbrains\\..*") + } + + maven("https://maven.fabric.io/public").content { + includeGroupByRegex("io\\.fabric\\..*") + includeGroupByRegex("com\\.crashlytics\\..*") + } + + jcenter() + } +} + +object Versions { + val compileSdk = 29 + val targetSdk = 28 + val minSdk = 23 + val gradle_plugin = "3.6.0-alpha05" + + val appcompat = "1.1.0-rc01" + val androidx = "1.0.0" + val androidxCollection = "1.0.0" + val androidxCoreRuntime = "2.0.1-alpha01" + val androidxArch = "2.0.0" + val constraintLayout = "2.0.0-alpha2" + val coreKtx = "1.0.0" + val coroutines = "1.1.1" + 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 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 ktlint = "0.24.0" + val legacyCoreUtils = "1.0.0" + val lifecycle = "2.1.0-alpha01" + val material = "1.1.0-alpha05" + val mockito = "2.23.0" + val mockito_kotlin = "2.0.0-RC3" + val okhttp = "3.10.0" + val retrofit = "2.6.0" + val room = "2.1.0" + val supportLibrary = "28.0.0" + val test_rules = "1.1.0-beta02" + val test_runner = "1.1.0-beta02" + val ui_automator = "2.2.0-beta02" + val viewPager2 = "1.0.0-alpha0" + + + //val gitCommitCount = gitCommitCount() +} + +object Names { + val applicationId = "io.plaidapp" +} + diff --git a/buildSrc/src/main/java/Helper.kt b/buildSrc/src/main/java/Helper.kt new file mode 100644 index 000000000..bfca494cc --- /dev/null +++ b/buildSrc/src/main/java/Helper.kt @@ -0,0 +1,32 @@ +/* + * 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 + * + * 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 java.util.* + +fun Project.runCmd(vararg command: String) = try { + val stdOut = ByteArrayOutputStream() + exec { + commandLine(*command) + standardOutput = stdOut + } + stdOut.toString(Charsets.UTF_8.name()).trim() +} catch (e: Throwable) { + e.printStackTrace() + null +} \ No newline at end of file diff --git a/buildSrc/src/main/java/dependencies.gradle.kts b/buildSrc/src/main/java/dependencies.gradle.kts new file mode 100644 index 000000000..7d2acbb13 --- /dev/null +++ b/buildSrc/src/main/java/dependencies.gradle.kts @@ -0,0 +1,22 @@ +//plugins { +// kotlin("jvm") +//} + +//dependencies { +// implementation("com.google.android.material:material:${Versions.material}") +// implementation("com.google.dagger:dagger:${Versions.dagger}") +// implementation("androidx.core:core-ktx:${Versions.coreKtx}") +// implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") +// implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") +// implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") +// implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") +// implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") +//} +// +//tasks { +// compileKotlin { +// kotlinOptions { +// allWarningsAsErrors = true +// } +// } +//} \ No newline at end of file diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 5021cc9b1..7c75a31e3 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 76a548844..000000000 --- a/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -include ':app', ':bypass' -include ':about', ':core', ':dribbble', ':designernews', ':search' -include ':test_shared' -project(':bypass').projectDir = new File(rootDir, 'third_party/bypass') diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 000000000..6f2efcc64 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,4 @@ +include(":app", ":bypass") +include(":about", ":core", ":dribbble", ":designernews", ":search") +include(":test_shared") +project(":bypass").projectDir = file("${rootDir}/third_party/bypass") diff --git a/shared_dependencies.gradle b/shared_dependencies.gradle index 46d4dd095..ff608b12f 100644 --- a/shared_dependencies.gradle +++ b/shared_dependencies.gradle @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -dependencies { - implementation "com.google.android.material:material:${versions.material}" - implementation "com.google.dagger:dagger:${versions.dagger}" - implementation "androidx.core:core-ktx:${versions.coreKtx}" - implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" - implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}" - implementation "androidx.lifecycle:lifecycle-viewmodel:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}" -} +//dependencies { +// implementation "com.google.android.material:material:${versions.material}" +// implementation "com.google.dagger:dagger:${versions.dagger}" +// implementation "androidx.core:core-ktx:${versions.coreKtx}" +// implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" +// implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}" +// implementation "androidx.lifecycle:lifecycle-viewmodel:${versions.lifecycle}" +// implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}" +// implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}" +//} diff --git a/test_dependencies.gradle b/test_dependencies.gradle index c5fa70b80..13ca41c4a 100644 --- a/test_dependencies.gradle +++ b/test_dependencies.gradle @@ -1,54 +1,54 @@ -/* - * Copyright 2018 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 - * - * 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. - */ -dependencies { - testImplementation project(':test_shared') - testImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" - testImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" - - // Work around issue with runtime classpath version conflict - implementation "androidx.arch.core:core-runtime:${versions.androidxCoreRuntime}" - implementation "androidx.collection:collection:${versions.androidxCollection}" - implementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" - implementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" - - // Workaround for dependency conflict during assembleAndroidTest - androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") - - // Work around issue with runtime classpath version conflict - androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - androidTestImplementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" - androidTestImplementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" - - androidTestImplementation project(':test_shared') - androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" - androidTestImplementation "androidx.test.espresso:espresso-contrib:${versions.espresso}" - androidTestImplementation "androidx.test.espresso:espresso-core:${versions.espresso}" - androidTestImplementation "androidx.test.ext:junit:${versions.extJunit}" - androidTestImplementation "androidx.test:rules:${versions.test_rules}" - androidTestImplementation "androidx.test:runner:${versions.test_runner}" - androidTestImplementation "androidx.test.uiautomator:uiautomator:${versions.ui_automator}" - androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" - androidTestImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" - androidTestImplementation "org.mockito:mockito-android:${versions.mockito}" - androidTestImplementation "org.mockito:mockito-core:${versions.mockito}" - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - androidTestImplementation "com.google.android.gms:play-services-gcm:16.0.0" -} +///* +// * Copyright 2018 Google Inc. +// * +// * 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. +// */ +//dependencies { +// testImplementation project(':test_shared') +// testImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" +// testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" +// testImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" +// testImplementation "junit:junit:${versions.junit}" +// testImplementation "org.mockito:mockito-core:${versions.mockito}" +// testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" +// +// // Work around issue with runtime classpath version conflict +// implementation "androidx.arch.core:core-runtime:${versions.androidxCoreRuntime}" +// implementation "androidx.collection:collection:${versions.androidxCollection}" +// implementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" +// implementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" +// +// // Workaround for dependency conflict during assembleAndroidTest +// androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") +// +// // Work around issue with runtime classpath version conflict +// androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" +// androidTestImplementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" +// androidTestImplementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" +// +// androidTestImplementation project(':test_shared') +// androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" +// androidTestImplementation "androidx.test.espresso:espresso-contrib:${versions.espresso}" +// androidTestImplementation "androidx.test.espresso:espresso-core:${versions.espresso}" +// androidTestImplementation "androidx.test.ext:junit:${versions.extJunit}" +// androidTestImplementation "androidx.test:rules:${versions.test_rules}" +// androidTestImplementation "androidx.test:runner:${versions.test_runner}" +// androidTestImplementation "androidx.test.uiautomator:uiautomator:${versions.ui_automator}" +// androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" +// androidTestImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" +// androidTestImplementation "org.mockito:mockito-android:${versions.mockito}" +// androidTestImplementation "org.mockito:mockito-core:${versions.mockito}" +// // Adding this to bring "google_play_services_version" into the test project +// // without this, it fails on AGP 3.6.x. +// androidTestImplementation "com.google.android.gms:play-services-gcm:16.0.0" +//} diff --git a/third_party/bypass/build.gradle b/third_party/bypass/build.gradle deleted file mode 100644 index 302185c9f..000000000 --- a/third_party/bypass/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 - * - * 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. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion 23 - targetSdkVersion versions.targetSdk - versionCode 1 - versionName '1.0' - } - buildTypes { - release { - minifyEnabled false - } - } -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation "androidx.annotation:annotation:${versions.androidx}" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" -} diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts new file mode 100644 index 000000000..7cd9e1630 --- /dev/null +++ b/third_party/bypass/build.gradle.kts @@ -0,0 +1,27 @@ +plugins { + id("com.android.library") + kotlin("android") +} +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + versionCode = 1 + versionName = "1.0" + } + buildTypes { + getByName("release") { + // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features + // The temporary workaround is to disable shrinking + isMinifyEnabled = false + } + } +} + +dependencies { + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) + implementation("androidx.annotation:annotation:${Versions.androidx}") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") +} From ed5bf5a10cb1d4fe55c991bea769ec02069bdf13 Mon Sep 17 00:00:00 2001 From: "Pietro F. Maggi" Date: Mon, 12 Aug 2019 12:37:13 +0100 Subject: [PATCH 02/20] Completed, not working, conversion to Kotlin DSL --- about/build.gradle.kts | 13 +-- app/build.gradle.kts | 11 +- build.gradle.kts | 34 +----- buildSrc/build.gradle.kts | 11 +- buildSrc/src/main/java/Config.kt | 50 ++++----- buildSrc/src/main/java/Helper.kt | 1 - .../src/main/java/dependencies.gradle.kts | 22 ---- buildSrc/src/main/java/dependencies.kt | 80 ++++++++++++++ core/build.gradle | 93 ---------------- core/build.gradle.kts | 100 ++++++++++++++++++ core/proguard-rules.pro | 2 +- designernews/build.gradle | 71 ------------- designernews/build.gradle.kts | 71 +++++++++++++ dribbble/build.gradle | 58 ---------- dribbble/build.gradle.kts | 69 ++++++++++++ gradle.properties | 18 ++-- repositories.gradle | 77 -------------- search/build.gradle | 55 ---------- search/build.gradle.kts | 54 ++++++++++ shared_dependencies.gradle | 25 ----- test_dependencies.gradle | 54 ---------- test_shared/build.gradle | 51 --------- test_shared/build.gradle.kts | 47 ++++++++ third_party/bypass/build.gradle.kts | 1 + 24 files changed, 472 insertions(+), 596 deletions(-) delete mode 100644 buildSrc/src/main/java/dependencies.gradle.kts create mode 100644 buildSrc/src/main/java/dependencies.kt delete mode 100644 core/build.gradle create mode 100644 core/build.gradle.kts delete mode 100644 designernews/build.gradle create mode 100644 designernews/build.gradle.kts delete mode 100644 dribbble/build.gradle create mode 100644 dribbble/build.gradle.kts delete mode 100644 repositories.gradle delete mode 100644 search/build.gradle create mode 100644 search/build.gradle.kts delete mode 100644 shared_dependencies.gradle delete mode 100644 test_dependencies.gradle delete mode 100644 test_shared/build.gradle create mode 100644 test_shared/build.gradle.kts diff --git a/about/build.gradle.kts b/about/build.gradle.kts index a29ddfd12..625dfef1b 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -37,9 +37,7 @@ android { } } -// dataBinding { -// enabled true -// } + dataBinding.isEnabled = true compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -47,10 +45,13 @@ android { } } +sharedDependencies() +testDependencies() + dependencies { - implementation(project(":app")) - implementation(project(":core")) - implementation(project(":bypass")) + implementation(project(":app", "default")) + implementation(project(":core", "default")) + implementation(project(":bypass", "default")) implementation("androidx.viewpager2:viewpager2:${Versions.viewPager2}") implementation("com.android.support:customtabs:${Versions.supportLibrary}") diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d3c08d027..075ba4102 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -51,10 +51,8 @@ android { } } -// dataBinding { -// enabled true -// } -// + dataBinding.isEnabled = true + buildTypes { getByName("release") { // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features @@ -88,8 +86,11 @@ android { ) } +sharedDependencies() +testDependencies() + dependencies { - implementation(project(":core")) + implementation(project(":core", "default")) implementation("androidx.appcompat:appcompat:${Versions.appcompat}") implementation("com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}") implementation("com.google.firebase:firebase-core:${Versions.firebase}") diff --git a/build.gradle.kts b/build.gradle.kts index d14a1ba9f..0ea252182 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,13 +30,8 @@ buildscript { //plugins { // id 'com.diffplug.gradle.spotless' version '3.14.0' //} -// //subprojects { -// buildscript { -// apply from: rootProject.file('repositories.gradle') -// } -// // apply plugin: 'com.diffplug.gradle.spotless' // spotless { // kotlin { @@ -46,32 +41,9 @@ buildscript { // } // } //} + subprojects { -// repositories { -// jcenter() -// } -// plugins { -// kotlin("android") -// } -// -// dependencies { -// implementation("com.google.android.material:material:${Versions.material}") -// implementation("com.google.dagger:dagger:${Versions.dagger}") -// implementation("androidx.core:core-ktx:${Versions.coreKtx}") -// implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") -// implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") -// implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") -// implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") -// implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") -// } -// -// tasks { -// compileKotlin { -// kotlinOptions { -// allWarningsAsErrors = true -// } -// } -// } - apply(plugin = "dependencies") + Config.run { repositories.deps() } + } \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 3327b140e..93f9ef982 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -15,19 +15,10 @@ * */ -//repositories { -// jcenter() -//} - plugins { `kotlin-dsl` } repositories { gradlePluginPortal() -// jcenter() -} - -//dependencies { -// implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.41") -//} \ No newline at end of file +} \ No newline at end of file diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 600d58e40..43f134b15 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -16,18 +16,16 @@ */ import org.gradle.api.artifacts.dsl.RepositoryHandler +import org.gradle.kotlin.dsl.dependencies import org.gradle.kotlin.dsl.maven -import org.gradle.kotlin.dsl.version -import org.gradle.plugin.use.PluginDependenciesSpec @Suppress("MayBeConstant") // Improve perf when changing values object Config { -// private const val kotlinVersion = "1.3.41" fun RepositoryHandler.deps() { google().content { - includeGroupByRegex("com\\.android\\..*") - includeGroupByRegex("androidx\\..*") + includeGroupByRegex("com.android.*") + includeGroupByRegex("androidx.*") includeGroup("android.arch.lifecycle") includeGroup("android.arch.core") @@ -37,21 +35,22 @@ object Config { includeGroup("com.google.gms") includeGroup("zipflinger") -// includeGroup("com.crashlytics.sdk.android") -// includeGroup("io.fabric.sdk.android") } jcenter().content { - includeGroupByRegex("com\\.google\\..*") - includeGroupByRegex("com\\.sun\\..*") - includeGroupByRegex("com\\.squareup\\..*") - includeGroupByRegex("com\\.jakewharton\\..*") - includeGroupByRegex("com\\.googlecode\\..*") - includeGroupByRegex("org\\.jetbrains\\..*") - includeGroupByRegex("org\\.codehaus\\..*") - includeGroupByRegex("org\\.apache\\..*") - includeGroupByRegex("net\\.sf\\..*") - includeGroupByRegex("javax\\..*") + includeGroupByRegex("com.google.*") + includeGroupByRegex("com.sun.*") + includeGroupByRegex("com.squareup.*") + includeGroupByRegex("com.jakewharton.*") + includeGroupByRegex("com.googlecode.*") + includeGroupByRegex("org.jetbrains.*") + includeGroupByRegex("org.codehaus.*") + includeGroupByRegex("org.apache.*") + includeGroupByRegex("net.sf.*") + includeGroupByRegex("javax.*") + includeGroupByRegex("org.ow2.*") + + includeGroup("com.github.bumptech.glide") includeGroup("com.ibm.icu") includeGroup("com.nhaarman.mockitokotlin2") @@ -74,26 +73,26 @@ object Config { includeGroup("org.jsoup") includeGroup("org.mockito") includeGroup("org.objenesis") - includeGroup("org.ow2.asm") includeGroup("org.sonatype.oss") includeGroup("org.xerial") includeGroup("net.ltgt.gradle.incap") + includeGroup("de.undercouch") + includeGroup("org.jdom") + excludeGroup("com.google.firebase") excludeGroup("com.google.android.gms") excludeGroup("com.google.android.material") } maven("https://dl.bintray.com/kotlin/kotlin-eap/").content { - includeGroupByRegex("org\\.jetbrains\\..*") + includeGroupByRegex("org.jetbrains.*") } maven("https://maven.fabric.io/public").content { - includeGroupByRegex("io\\.fabric\\..*") - includeGroupByRegex("com\\.crashlytics\\..*") + includeGroupByRegex("io.fabric.*") + includeGroupByRegex("com.crashlytics.*") } - - jcenter() } } @@ -136,10 +135,7 @@ object Versions { val test_rules = "1.1.0-beta02" val test_runner = "1.1.0-beta02" val ui_automator = "2.2.0-beta02" - val viewPager2 = "1.0.0-alpha0" - - - //val gitCommitCount = gitCommitCount() + val viewPager2 = "1.0.0-beta02" } object Names { diff --git a/buildSrc/src/main/java/Helper.kt b/buildSrc/src/main/java/Helper.kt index bfca494cc..f1fcbb99a 100644 --- a/buildSrc/src/main/java/Helper.kt +++ b/buildSrc/src/main/java/Helper.kt @@ -17,7 +17,6 @@ import org.gradle.api.Project import java.io.ByteArrayOutputStream -import java.util.* fun Project.runCmd(vararg command: String) = try { val stdOut = ByteArrayOutputStream() diff --git a/buildSrc/src/main/java/dependencies.gradle.kts b/buildSrc/src/main/java/dependencies.gradle.kts deleted file mode 100644 index 7d2acbb13..000000000 --- a/buildSrc/src/main/java/dependencies.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -//plugins { -// kotlin("jvm") -//} - -//dependencies { -// implementation("com.google.android.material:material:${Versions.material}") -// implementation("com.google.dagger:dagger:${Versions.dagger}") -// implementation("androidx.core:core-ktx:${Versions.coreKtx}") -// implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") -// implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") -// implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") -// implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") -// implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") -//} -// -//tasks { -// compileKotlin { -// kotlinOptions { -// allWarningsAsErrors = true -// } -// } -//} \ No newline at end of file diff --git a/buildSrc/src/main/java/dependencies.kt b/buildSrc/src/main/java/dependencies.kt new file mode 100644 index 000000000..cb1bee686 --- /dev/null +++ b/buildSrc/src/main/java/dependencies.kt @@ -0,0 +1,80 @@ +/* + * Copyright 2018 Google Inc. + * + * 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. + */ + + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.* + +fun Project.sharedDependencies() { + val implementation by configurations + + dependencies { + implementation("com.google.android.material:material:${Versions.material}") + implementation("com.google.dagger:dagger:${Versions.dagger}") + implementation("androidx.core:core-ktx:${Versions.coreKtx}") + implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") + implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") + implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") + implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") + } +} + +fun Project.testDependencies() { + val implementation by configurations + val testImplementation by configurations + val androidTestImplementation by configurations + + dependencies { + testImplementation(project(":test_shared")) + testImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") + testImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") + testImplementation("junit:junit:${Versions.junit}") + testImplementation("org.mockito:mockito-core:${Versions.mockito}") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") + + // Work around issue with runtime classpath version conflict + implementation("androidx.arch.core:core-runtime:${Versions.androidxCoreRuntime}") + implementation("androidx.collection:collection:${Versions.androidxCollection}") + implementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") + implementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + + // Workaround for dependency conflict during assembleAndroidTest + androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") + + // Work around issue with runtime classpath version conflict + androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + androidTestImplementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") + androidTestImplementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + + androidTestImplementation(project(":test_shared")) + androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + androidTestImplementation("androidx.test.espresso:espresso-contrib:${Versions.espresso}") + androidTestImplementation("androidx.test.espresso:espresso-core:${Versions.espresso}") + androidTestImplementation("androidx.test.ext:junit:${Versions.extJunit}") + androidTestImplementation("androidx.test:rules:${Versions.test_rules}") + androidTestImplementation("androidx.test:runner:${Versions.test_runner}") + androidTestImplementation("androidx.test.uiautomator:uiautomator:${Versions.ui_automator}") + androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") + androidTestImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") + androidTestImplementation("org.mockito:mockito-android:${Versions.mockito}") + androidTestImplementation("org.mockito:mockito-core:${Versions.mockito}") + // Adding this to bring "google_play_services_version" into the test project + // without this, it fails on AGP 3.6.x. + androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") + } +} \ No newline at end of file diff --git a/core/build.gradle b/core/build.gradle deleted file mode 100644 index 5876d21b0..000000000 --- a/core/build.gradle +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - buildConfigField 'String', 'DESIGNER_NEWS_CLIENT_ID', "\"${designer_news_client_id}\"" - buildConfigField 'String', - 'DESIGNER_NEWS_CLIENT_SECRET', "\"${designer_news_client_secret}\"" - - buildConfigField 'String', - 'PRODUCT_HUNT_DEVELOPER_TOKEN', "\"${product_hunt_developer_token}\"" - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['room.incremental': 'true'] - } - } - } - - dataBinding { - enabled true - } - - buildTypes { - release { - consumerProguardFiles 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - packagingOptions { - exclude 'META-INF/core_debug.kotlin_module' - } -} - -dependencies { - implementation project(':bypass') - implementation "com.google.code.gson:gson:${versions.gson}" - implementation "androidx.browser:browser:${versions.androidx}" - implementation "androidx.room:room-runtime:${versions.room}" - implementation "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}" - implementation "com.android.support:palette-v7:${versions.supportLibrary}" - implementation "com.android.support:support-dynamic-animation:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}" - implementation "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}" - implementation "org.jsoup:jsoup:${versions.jsoup}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}" - kapt "com.github.bumptech.glide:compiler:${versions.glide}" - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" - kapt "androidx.annotation:annotation:${versions.androidx}" -} - -androidExtensions { - experimental = true -} diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 000000000..dcff69d36 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,100 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.library") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + val designer_news_client_id: String by project + val designer_news_client_secret: String by project + val product_hunt_developer_token: String by project + + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "${designer_news_client_id}") + buildConfigField("String", + "DESIGNER_NEWS_CLIENT_SECRET", "${designer_news_client_secret}") + + buildConfigField("String", + "PRODUCT_HUNT_DEVELOPER_TOKEN", "${product_hunt_developer_token}") + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + dataBinding.isEnabled = true + + buildTypes { + getByName("release") { + consumerProguardFiles("proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + packagingOptions { + exclude("META-INF/core_debug.kotlin_module") + } +} + +sharedDependencies() +testDependencies() + +dependencies { + implementation(project(":bypass")) + + implementation("com.google.code.gson:gson:${Versions.gson}") + implementation("androidx.browser:browser:${Versions.androidx}") + implementation("androidx.room:room-runtime:${Versions.room}") + implementation("androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}") + implementation("com.android.support:palette-v7:${Versions.supportLibrary}") + implementation("com.android.support:support-dynamic-animation:${Versions.supportLibrary}") + implementation("com.github.bumptech.glide:glide:${Versions.glide}") + implementation("com.squareup.okhttp3:okhttp:${Versions.okhttp}") + implementation("com.squareup.okhttp3:logging-interceptor:${Versions.okhttp}") + implementation("org.jsoup:jsoup:${Versions.jsoup}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") + kapt("com.github.bumptech.glide:compiler:${Versions.glide}") + kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") +} + +kapt.useBuildCache = true +kapt.arguments { + mapOf( + "dagger.formatGeneratedSource" to "disabled", + "dagger.gradle.incremental" to "enabled" + ) +} + +androidExtensions.isExperimental = true \ No newline at end of file diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 7c75a31e3..14a1b38dd 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle.kts. +# proguardFiles setting in build.gradle.kts.kts.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/designernews/build.gradle b/designernews/build.gradle deleted file mode 100644 index 4082f9e50..000000000 --- a/designernews/build.gradle +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - resConfig 'en' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['room.incremental': 'true'] - } - } - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - implementation project(':bypass') - - implementation "androidx.room:room-ktx:${versions.room}" - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:glide:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} - -// enabling experimental for Kotlin parcelize supports -androidExtensions { - experimental = true -} diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts new file mode 100644 index 000000000..584ec4e82 --- /dev/null +++ b/designernews/build.gradle.kts @@ -0,0 +1,71 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.library") + kotlin("android") + id("kotlin-android-extensions") + kotlin("kapt") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + resConfig("en") + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + dataBinding.isEnabled = true + + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +sharedDependencies() +testDependencies() + +dependencies { + implementation(project(":app", "default")) + implementation(project(":core", "default")) + implementation(project(":bypass", "default")) + + implementation("androidx.room:room-ktx:${Versions.room}") + implementation("com.android.support:customtabs:${Versions.supportLibrary}") + implementation("com.github.bumptech.glide:glide:${Versions.glide}") + + kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") +} + +kapt.useBuildCache = true + +// enabling experimental for Kotlin parcelize supports +androidExtensions { + isExperimental = true +} diff --git a/dribbble/build.gradle b/dribbble/build.gradle deleted file mode 100644 index f46e56123..000000000 --- a/dribbble/build.gradle +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - def filesAuthorityValue = names.applicationId + '.shareprovider' - buildConfigField 'String', 'FILES_AUTHORITY', "\"${filesAuthorityValue}\"" - manifestPlaceholders = [filesAuthority: filesAuthorityValue] - } - - dataBinding { - enabled true - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - - implementation "com.android.support:customtabs:${versions.supportLibrary}" - implementation "com.android.support:palette-v7:${versions.supportLibrary}" - implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" - - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts new file mode 100644 index 000000000..872903cd9 --- /dev/null +++ b/dribbble/build.gradle.kts @@ -0,0 +1,69 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + + val filesAuthorityValue = Names.applicationId + ".shareprovider" + buildConfigField("String", "FILES_AUTHORITY", "${filesAuthorityValue}") + + manifestPlaceholders = mapOf( + "filesAuthority" to filesAuthorityValue + ) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + dataBinding.isEnabled = true + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +sharedDependencies() +testDependencies() + +dependencies { + implementation(project(":app", "default")) + implementation(project(":core", "default")) + + implementation("com.android.support:customtabs:${Versions.supportLibrary}") + implementation("com.android.support:palette-v7:${Versions.supportLibrary}") + implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") + + kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") +} + +kapt.useBuildCache = true + + diff --git a/gradle.properties b/gradle.properties index 02b387f02..cdb5fe0d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,20 +13,20 @@ org.gradle.daemon=true org.gradle.caching=true org.gradle.parallel=true -# Use kapt incremental -kapt.incremental.apt=true - -# Use kapt in parallel -kapt.use.worker.api=true +## Use kapt incremental +#kapt.incremental.apt=true +# +## Use kapt in parallel +#kapt.use.worker.api=true # Kapt compile avoidance kapt.include.compile.classpath=false # Design News API -designer_news_client_id = -designer_news_client_secret = +designer_news_client_id = "" +designer_news_client_secret = "" # Product Hunt API -product_hunt_developer_token = +product_hunt_developer_token = "" android.useAndroidX=true -android.enableJetifier=true +android.enableJetifier=true \ No newline at end of file diff --git a/repositories.gradle b/repositories.gradle deleted file mode 100644 index 991672618..000000000 --- a/repositories.gradle +++ /dev/null @@ -1,77 +0,0 @@ -repositories { - maven { - url "https://maven.google.com" - content { - includeGroupByRegex "com\\.android.*" - includeGroupByRegex "androidx.*" - includeGroup "android.arch.lifecycle" - includeGroup "android.arch.core" - includeGroup "com.google.firebase" - includeGroup "com.google.android.gms" - includeGroup "com.google.android.material" - includeGroup "com.google.gms" - includeGroup "zipflinger" - } - } - - maven { - url 'https://jcenter.bintray.com' - content { - includeGroupByRegex "com\\.google.*" - includeGroupByRegex "com\\.sun.*" - includeGroupByRegex "com\\.squareup.*" - includeGroupByRegex "com\\.jakewharton.*" - includeGroupByRegex "com\\.googlecode.*" - includeGroupByRegex "org\\.jetbrains.*" - includeGroupByRegex "org\\.codehaus.*" - includeGroupByRegex "org\\.apache.*" - includeGroupByRegex "net\\.sf.*" - includeGroupByRegex "javax.*" - includeGroup "com.github.bumptech.glide" - includeGroup "com.ibm.icu" - includeGroup "com.nhaarman.mockitokotlin2" - includeGroup "commons-io" - includeGroup "commons-codec" - includeGroup "commons-logging" - includeGroup "it.unimi.dsi" - includeGroup "junit" - includeGroup "me.eugeniomarletti.kotlin.metadata" - includeGroup "net.bytebuddy" - includeGroup "net.java" - includeGroup "org.abego.treelayout" - includeGroup "org.antlr" - includeGroup "org.bouncycastle" - includeGroup "org.checkerframework" - includeGroup "org.glassfish" - includeGroup "org.glassfish.jaxb" - includeGroup "org.hamcrest" - includeGroup "org.jvnet.staxex" - includeGroup "org.jsoup" - includeGroup "org.mockito" - includeGroup "org.objenesis" - includeGroup "org.ow2.asm" - includeGroup "org.sonatype.oss" - includeGroup "org.xerial" - includeGroup "net.ltgt.gradle.incap" - - excludeGroup "com.google.firebase" - excludeGroup "com.google.android.gms" - excludeGroup "com.google.android.material" - } - } - - maven { - url 'https://maven.fabric.io/public' - content { - includeGroupByRegex "io\\.fabric.*" - includeGroupByRegex "com\\.crashlytics.*" - } - } - - maven { - url 'https://dl.bintray.com/kotlin/kotlin-eap' - content { - includeGroupByRegex "org\\.jetbrains.*" - } - } -} diff --git a/search/build.gradle b/search/build.gradle deleted file mode 100644 index dbd66b0cd..000000000 --- a/search/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ - -apply plugin: 'com.android.dynamic-feature' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-kapt' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - - javaCompileOptions { - annotationProcessorOptions { - arguments << ['dagger.gradle.incremental': 'true'] - } - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } -} - -dependencies { - implementation project(':app') - implementation project(':core') - - implementation "com.github.bumptech.glide:recyclerview-integration:${versions.glide}" - implementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}" - kapt "com.google.dagger:dagger-compiler:${versions.dagger}" -} diff --git a/search/build.gradle.kts b/search/build.gradle.kts new file mode 100644 index 000000000..76455bdde --- /dev/null +++ b/search/build.gradle.kts @@ -0,0 +1,54 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.dynamic-feature") + kotlin("android") + kotlin("kapt") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + + javaCompileOptions { + annotationProcessorOptions { + arguments = mapOf("dagger.gradle.incremental" to "true") + } + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation(project(":app", "default")) + implementation(project(":core", "default")) + + implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") + implementation("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") + kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + +} + +kapt.useBuildCache = true diff --git a/shared_dependencies.gradle b/shared_dependencies.gradle deleted file mode 100644 index ff608b12f..000000000 --- a/shared_dependencies.gradle +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 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 - * - * 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. - */ -//dependencies { -// implementation "com.google.android.material:material:${versions.material}" -// implementation "com.google.dagger:dagger:${versions.dagger}" -// implementation "androidx.core:core-ktx:${versions.coreKtx}" -// implementation "com.squareup.retrofit2:retrofit:${versions.retrofit}" -// implementation "com.squareup.retrofit2:converter-gson:${versions.retrofit}" -// implementation "androidx.lifecycle:lifecycle-viewmodel:${versions.lifecycle}" -// implementation "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}" -// implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}" -//} diff --git a/test_dependencies.gradle b/test_dependencies.gradle deleted file mode 100644 index 13ca41c4a..000000000 --- a/test_dependencies.gradle +++ /dev/null @@ -1,54 +0,0 @@ -///* -// * Copyright 2018 Google Inc. -// * -// * 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. -// */ -//dependencies { -// testImplementation project(':test_shared') -// testImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" -// testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" -// testImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" -// testImplementation "junit:junit:${versions.junit}" -// testImplementation "org.mockito:mockito-core:${versions.mockito}" -// testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" -// -// // Work around issue with runtime classpath version conflict -// implementation "androidx.arch.core:core-runtime:${versions.androidxCoreRuntime}" -// implementation "androidx.collection:collection:${versions.androidxCollection}" -// implementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" -// implementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" -// -// // Workaround for dependency conflict during assembleAndroidTest -// androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") -// -// // Work around issue with runtime classpath version conflict -// androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" -// androidTestImplementation "androidx.legacy:legacy-support-core-utils:${versions.legacyCoreUtils}" -// androidTestImplementation "androidx.lifecycle:lifecycle-runtime:${versions.lifecycle}" -// -// androidTestImplementation project(':test_shared') -// androidTestImplementation "androidx.arch.core:core-testing:${versions.androidxArch}" -// androidTestImplementation "androidx.test.espresso:espresso-contrib:${versions.espresso}" -// androidTestImplementation "androidx.test.espresso:espresso-core:${versions.espresso}" -// androidTestImplementation "androidx.test.ext:junit:${versions.extJunit}" -// androidTestImplementation "androidx.test:rules:${versions.test_rules}" -// androidTestImplementation "androidx.test:runner:${versions.test_runner}" -// androidTestImplementation "androidx.test.uiautomator:uiautomator:${versions.ui_automator}" -// androidTestImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:${versions.mockito_kotlin}" -// androidTestImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}" -// androidTestImplementation "org.mockito:mockito-android:${versions.mockito}" -// androidTestImplementation "org.mockito:mockito-core:${versions.mockito}" -// // Adding this to bring "google_play_services_version" into the test project -// // without this, it fails on AGP 3.6.x. -// androidTestImplementation "com.google.android.gms:play-services-gcm:16.0.0" -//} diff --git a/test_shared/build.gradle b/test_shared/build.gradle deleted file mode 100644 index 40074df6c..000000000 --- a/test_shared/build.gradle +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 - * - * 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. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -apply from: '../shared_dependencies.gradle' -apply from: '../test_dependencies.gradle' - -android { - compileSdkVersion versions.compileSdk - - defaultConfig { - minSdkVersion versions.minSdk - targetSdkVersion versions.targetSdk - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } - packagingOptions { - exclude 'META-INF/test_shared_debug.kotlin_module' - } -} - -dependencies { - implementation project(':core') - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}" - implementation "junit:junit:${versions.junit}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.coroutines}" -} - diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts new file mode 100644 index 000000000..e634b61ed --- /dev/null +++ b/test_shared/build.gradle.kts @@ -0,0 +1,47 @@ +/* + * Copyright 2018 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 + * + * 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. + * + */ + +plugins { + id("com.android.library") + kotlin("android") +} + +android { + compileSdkVersion(Versions.compileSdk) + + defaultConfig { + minSdkVersion(Versions.minSdk) + targetSdkVersion(Versions.targetSdk) + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + packagingOptions { + exclude("META-INF/test_shared_debug.kotlin_module") + } +} + +dependencies { + implementation(project(":core", "default")) + + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") + implementation("junit:junit:${Versions.junit}") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") +} diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index 7cd9e1630..ed90da9e8 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("com.android.library") kotlin("android") } + android { compileSdkVersion(Versions.compileSdk) From 730b944bda5e038ab2657e127da8481c5e35e77d Mon Sep 17 00:00:00 2001 From: "Pietro F. Maggi" Date: Wed, 14 Aug 2019 16:56:10 +0100 Subject: [PATCH 03/20] Corrected syntax for dynamicFeatures --- about/build.gradle.kts | 6 +++--- app/build.gradle.kts | 4 ++-- buildSrc/src/main/java/Config.kt | 2 +- designernews/build.gradle.kts | 8 ++++---- dribbble/build.gradle.kts | 4 ++-- search/build.gradle.kts | 4 ++-- test_shared/build.gradle.kts | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 625dfef1b..67e5a7014 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -49,9 +49,9 @@ sharedDependencies() testDependencies() dependencies { - implementation(project(":app", "default")) - implementation(project(":core", "default")) - implementation(project(":bypass", "default")) + implementation(project(":app")) + implementation(project(":core")) + implementation(project(":bypass")) implementation("androidx.viewpager2:viewpager2:${Versions.viewPager2}") implementation("com.android.support:customtabs:${Versions.supportLibrary}") diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 075ba4102..d06599fd8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -78,7 +78,7 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - dynamicFeatures = mutableSetOf( + dynamicFeatures = hashSetOf( ":about", ":designernews", ":dribbble", @@ -90,7 +90,7 @@ sharedDependencies() testDependencies() dependencies { - implementation(project(":core", "default")) + implementation(project(":core")) implementation("androidx.appcompat:appcompat:${Versions.appcompat}") implementation("com.crashlytics.sdk.android:crashlytics:${Versions.crashlytics}") implementation("com.google.firebase:firebase-core:${Versions.firebase}") diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 43f134b15..8f18e9c2e 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -100,7 +100,7 @@ object Versions { val compileSdk = 29 val targetSdk = 28 val minSdk = 23 - val gradle_plugin = "3.6.0-alpha05" + val gradle_plugin = "3.6.0-alpha06" val appcompat = "1.1.0-rc01" val androidx = "1.0.0" diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 584ec4e82..3c3e152a6 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -16,7 +16,7 @@ */ plugins { - id("com.android.library") + id("com.android.dynamic-feature") kotlin("android") id("kotlin-android-extensions") kotlin("kapt") @@ -52,9 +52,9 @@ sharedDependencies() testDependencies() dependencies { - implementation(project(":app", "default")) - implementation(project(":core", "default")) - implementation(project(":bypass", "default")) + implementation(project(":app")) + implementation(project(":core")) + implementation(project(":bypass")) implementation("androidx.room:room-ktx:${Versions.room}") implementation("com.android.support:customtabs:${Versions.supportLibrary}") diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 872903cd9..18bb70bf5 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -54,8 +54,8 @@ sharedDependencies() testDependencies() dependencies { - implementation(project(":app", "default")) - implementation(project(":core", "default")) + implementation(project(":app")) + implementation(project(":core")) implementation("com.android.support:customtabs:${Versions.supportLibrary}") implementation("com.android.support:palette-v7:${Versions.supportLibrary}") diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 76455bdde..2f74514b2 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -42,8 +42,8 @@ android { } dependencies { - implementation(project(":app", "default")) - implementation(project(":core", "default")) + implementation(project(":app")) + implementation(project(":core")) implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") implementation("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index e634b61ed..7c92cb95b 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -37,7 +37,7 @@ android { } dependencies { - implementation(project(":core", "default")) + implementation(project(":core")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") From 1cc9636a984d0ce6b78e26b3b1440ee22a9f89d1 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Fri, 6 Dec 2019 18:50:51 +0000 Subject: [PATCH 04/20] More conversion for KTS and spotless Update --- about/build.gradle.kts | 11 ++-- app/build.gradle.kts | 31 +++++---- build.gradle.kts | 54 +++++++++++----- buildSrc/src/main/java/Config.kt | 50 +++++++-------- buildSrc/src/main/java/Helper.kt | 25 ++++---- buildSrc/src/main/java/dependencies.kt | 80 ------------------------ core/build.gradle.kts | 15 ++--- dependencies.gradle.kts | 77 +++++++++++++++++++++++ designernews/build.gradle.kts | 11 ++-- dribbble/build.gradle.kts | 13 ++-- gradle/wrapper/gradle-wrapper.properties | 3 +- scripts/{copyright.kt => copyright.txt} | 0 search/build.gradle.kts | 7 ++- test_shared/build.gradle.kts | 2 + 14 files changed, 201 insertions(+), 178 deletions(-) delete mode 100644 buildSrc/src/main/java/dependencies.kt create mode 100644 dependencies.gradle.kts rename scripts/{copyright.kt => copyright.txt} (100%) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 67e5a7014..a0a77df5f 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -21,6 +21,8 @@ plugins { kotlin("kapt") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -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")) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d06599fd8..78201987a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,8 +14,6 @@ * limitations under the License. */ -import org.jetbrains.kotlin.kapt3.base.Kapt.kapt - plugins { id("com.android.application") kotlin("android") @@ -25,6 +23,8 @@ plugins { id("com.google.gms.google-services") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -51,8 +51,6 @@ android { } } - dataBinding.isEnabled = true - buildTypes { getByName("release") { // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features @@ -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") -//} \ No newline at end of file +//kapt { +// useBuildCache = true +//} diff --git a/build.gradle.kts b/build.gradle.kts index 0ea252182..637eb4f7e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,10 @@ * limitations under the License. */ +plugins { + id("com.diffplug.gradle.spotless") version "3.26.1" +} + buildscript { Config.run { repositories.deps() } @@ -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() } - -} \ No newline at end of file + Config.run { + repositories.deps() + } +} diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 8f18e9c2e..427a38c88 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -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 @@ -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") @@ -50,7 +48,6 @@ object Config { includeGroupByRegex("javax.*") includeGroupByRegex("org.ow2.*") - includeGroup("com.github.bumptech.glide") includeGroup("com.ibm.icu") includeGroup("com.nhaarman.mockitokotlin2") @@ -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" @@ -141,4 +138,3 @@ object Versions { object Names { val applicationId = "io.plaidapp" } - diff --git a/buildSrc/src/main/java/Helper.kt b/buildSrc/src/main/java/Helper.kt index f1fcbb99a..fbfae0ce5 100644 --- a/buildSrc/src/main/java/Helper.kt +++ b/buildSrc/src/main/java/Helper.kt @@ -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() @@ -28,4 +27,4 @@ fun Project.runCmd(vararg command: String) = try { } catch (e: Throwable) { e.printStackTrace() null -} \ No newline at end of file +} diff --git a/buildSrc/src/main/java/dependencies.kt b/buildSrc/src/main/java/dependencies.kt deleted file mode 100644 index cb1bee686..000000000 --- a/buildSrc/src/main/java/dependencies.kt +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * 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. - */ - - -import org.gradle.api.Project -import org.gradle.kotlin.dsl.* - -fun Project.sharedDependencies() { - val implementation by configurations - - dependencies { - implementation("com.google.android.material:material:${Versions.material}") - implementation("com.google.dagger:dagger:${Versions.dagger}") - implementation("androidx.core:core-ktx:${Versions.coreKtx}") - implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") - implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") - implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") - } -} - -fun Project.testDependencies() { - val implementation by configurations - val testImplementation by configurations - val androidTestImplementation by configurations - - dependencies { - testImplementation(project(":test_shared")) - testImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") - testImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") - testImplementation("junit:junit:${Versions.junit}") - testImplementation("org.mockito:mockito-core:${Versions.mockito}") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") - - // Work around issue with runtime classpath version conflict - implementation("androidx.arch.core:core-runtime:${Versions.androidxCoreRuntime}") - implementation("androidx.collection:collection:${Versions.androidxCollection}") - implementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") - implementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") - - // Workaround for dependency conflict during assembleAndroidTest - androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") - - // Work around issue with runtime classpath version conflict - androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - androidTestImplementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") - androidTestImplementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") - - androidTestImplementation(project(":test_shared")) - androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - androidTestImplementation("androidx.test.espresso:espresso-contrib:${Versions.espresso}") - androidTestImplementation("androidx.test.espresso:espresso-core:${Versions.espresso}") - androidTestImplementation("androidx.test.ext:junit:${Versions.extJunit}") - androidTestImplementation("androidx.test:rules:${Versions.test_rules}") - androidTestImplementation("androidx.test:runner:${Versions.test_runner}") - androidTestImplementation("androidx.test.uiautomator:uiautomator:${Versions.ui_automator}") - androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") - androidTestImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") - androidTestImplementation("org.mockito:mockito-android:${Versions.mockito}") - androidTestImplementation("org.mockito:mockito-core:${Versions.mockito}") - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") - } -} \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index dcff69d36..791e50857 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -22,6 +22,8 @@ plugins { kotlin("kapt") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -49,8 +51,6 @@ android { } } - dataBinding.isEnabled = true - buildTypes { getByName("release") { consumerProguardFiles("proguard-rules.pro") @@ -65,10 +65,11 @@ android { packagingOptions { exclude("META-INF/core_debug.kotlin_module") } -} -sharedDependencies() -testDependencies() + buildFeatures { + dataBinding = true + } +} dependencies { implementation(project(":bypass")) @@ -83,8 +84,8 @@ dependencies { implementation("com.squareup.okhttp3:okhttp:${Versions.okhttp}") implementation("com.squareup.okhttp3:logging-interceptor:${Versions.okhttp}") implementation("org.jsoup:jsoup:${Versions.jsoup}") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") kapt("com.github.bumptech.glide:compiler:${Versions.glide}") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts new file mode 100644 index 000000000..5d3ceb10d --- /dev/null +++ b/dependencies.gradle.kts @@ -0,0 +1,77 @@ +/* + * Copyright 2018 Google Inc. + * + * 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. + */ + + +import org.gradle.api.Project +import org.gradle.kotlin.dsl.* + +// this will try to take configuration from existing ones +val implementation by configurations +val testImplementation by configurations +val androidTestImplementation by configurations +val compile by configurations +val api by configurations +dependencies { + implementation("com.google.android.material:material:${Versions.material}") + implementation("com.google.dagger:dagger:${Versions.dagger}") + implementation("androidx.arch.core:core-common:${Versions.androidxCoreRuntime}") + implementation("androidx.arch.core:core-runtime:${Versions.androidxCoreRuntime}") + implementation("androidx.core:core-ktx:${Versions.coreKtx}") + implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") + implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") + implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}") + implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") + + // Work around issue with runtime classpath version conflict + implementation("androidx.collection:collection:${Versions.androidxCollection}") + implementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") + implementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + + + testImplementation(project(":test_shared")) + testImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") + testImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") + testImplementation("junit:junit:${Versions.junit}") + testImplementation("org.mockito:mockito-core:${Versions.mockito}") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") + + // Workaround for dependency conflict during assembleAndroidTest + androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") + + // Work around issue with runtime classpath version conflict + androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + androidTestImplementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") + androidTestImplementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + + androidTestImplementation(project(":test_shared")) + androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") + androidTestImplementation("androidx.test.espresso:espresso-contrib:${Versions.espresso}") + androidTestImplementation("androidx.test.espresso:espresso-core:${Versions.espresso}") + androidTestImplementation("androidx.test.ext:junit:${Versions.extJunit}") + androidTestImplementation("androidx.test:rules:${Versions.test_rules}") + androidTestImplementation("androidx.test:runner:${Versions.test_runner}") + androidTestImplementation("androidx.test.uiautomator:uiautomator:${Versions.ui_automator}") + androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") + androidTestImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") + androidTestImplementation("org.mockito:mockito-android:${Versions.mockito}") + androidTestImplementation("org.mockito:mockito-core:${Versions.mockito}") + // Adding this to bring "google_play_services_version" into the test project + // without this, it fails on AGP 3.6.x. + androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") +} \ No newline at end of file diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 3c3e152a6..35e24406f 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -22,6 +22,8 @@ plugins { kotlin("kapt") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -39,17 +41,16 @@ android { } } - dataBinding.isEnabled = true - - compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } + + buildFeatures { + dataBinding = true + } } -sharedDependencies() -testDependencies() dependencies { implementation(project(":app")) diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 18bb70bf5..10c7ef82a 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -21,6 +21,8 @@ plugins { kotlin("kapt") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -29,7 +31,7 @@ android { targetSdkVersion(Versions.targetSdk) val filesAuthorityValue = Names.applicationId + ".shareprovider" - buildConfigField("String", "FILES_AUTHORITY", "${filesAuthorityValue}") + buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"") manifestPlaceholders = mapOf( "filesAuthority" to filesAuthorityValue @@ -42,16 +44,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")) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 59b5f8928..d13172714 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Thu Dec 05 16:57:02 GMT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-milestone-1-bin.zip diff --git a/scripts/copyright.kt b/scripts/copyright.txt similarity index 100% rename from scripts/copyright.kt rename to scripts/copyright.txt diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 2f74514b2..46852b6d7 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -21,6 +21,8 @@ plugins { kotlin("kapt") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) @@ -39,6 +41,10 @@ android { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } + + kotlinOptions { + jvmTarget = "1.8" + } } dependencies { @@ -48,7 +54,6 @@ dependencies { implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") implementation("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") - } kapt.useBuildCache = true diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index 7c92cb95b..8773fc14e 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -20,6 +20,8 @@ plugins { kotlin("android") } +apply(from = "$rootDir/dependencies.gradle.kts") + android { compileSdkVersion(Versions.compileSdk) From 53aeb17ee831bb4ce3c9319f3008a62b977b689e Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Fri, 6 Dec 2019 19:18:32 +0000 Subject: [PATCH 05/20] spotless also checks *.kts files --- build.gradle.kts | 37 ++++++++--------------------- buildSrc/settings.gradle.kts | 17 ------------- dependencies.gradle.kts | 11 ++++----- settings.gradle.kts | 18 +++++++++++++- third_party/bypass/build.gradle.kts | 16 +++++++++++++ 5 files changed, 47 insertions(+), 52 deletions(-) delete mode 100644 buildSrc/settings.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 637eb4f7e..6d519d456 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ /* - * Copyright 2015 Google Inc. + * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -28,39 +28,22 @@ buildscript { classpath("com.google.gms:google-services:${Versions.googleServices}") classpath("io.fabric.tools:gradle:${Versions.fabric}") } - } - 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 -// } + kotlinGradle { + // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') + target("*.gradle.kts") + + ktlint("0.36.0") + + licenseHeaderFile("$rootDir/scripts/copyright.txt", "(plugins |import |include)") + } } subprojects { Config.run { diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts deleted file mode 100644 index 35689e2e2..000000000 --- a/buildSrc/settings.gradle.kts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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 - * - * 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. - * - */ - diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts index 5d3ceb10d..424e3dce0 100644 --- a/dependencies.gradle.kts +++ b/dependencies.gradle.kts @@ -1,11 +1,11 @@ /* - * Copyright 2018 Google Inc. + * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -14,9 +14,7 @@ * limitations under the License. */ - -import org.gradle.api.Project -import org.gradle.kotlin.dsl.* +import org.gradle.kotlin.dsl.dependencies // this will try to take configuration from existing ones val implementation by configurations @@ -42,7 +40,6 @@ dependencies { implementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") implementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") - testImplementation(project(":test_shared")) testImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") @@ -74,4 +71,4 @@ dependencies { // Adding this to bring "google_play_services_version" into the test project // without this, it fails on AGP 3.6.x. androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") -} \ No newline at end of file +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 6f2efcc64..cc98a62a7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,20 @@ +/* + * 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 + * + * 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. + */ + include(":app", ":bypass") include(":about", ":core", ":dribbble", ":designernews", ":search") include(":test_shared") -project(":bypass").projectDir = file("${rootDir}/third_party/bypass") +project(":bypass").projectDir = file("$rootDir/third_party/bypass") diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index ed90da9e8..0c4840059 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * Copyright 2019 Google Inc. + * + * 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. + */ + plugins { id("com.android.library") kotlin("android") From b4825b18613045266868e634384825f75eb0820c Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Fri, 6 Dec 2019 19:28:13 +0000 Subject: [PATCH 06/20] Updated copyright of *.gradle.kts files --- about/build.gradle.kts | 2 +- app/build.gradle.kts | 2 +- core/build.gradle.kts | 2 +- designernews/build.gradle.kts | 2 +- dribbble/build.gradle.kts | 2 +- search/build.gradle.kts | 2 +- test_shared/build.gradle.kts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index a0a77df5f..838d2c7b6 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 78201987a..38a1dc1a5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2015 Google Inc. + * Copyright 2019 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 791e50857..6b1694374 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 35e24406f..3a7def4d3 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 10c7ef82a..7ddfd47ee 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 46852b6d7..61ec61b80 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index 8773fc14e..bf927dd81 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2018 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. From 466387a0d806a7d9e441de8bfccbe5729cd095ad Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Fri, 6 Dec 2019 19:50:33 +0000 Subject: [PATCH 07/20] Enable kapt build cache for :app --- app/build.gradle.kts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 38a1dc1a5..8fe12d57a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -104,6 +104,4 @@ dependencies { kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } -//kapt { -// useBuildCache = true -//} +kapt.useBuildCache = true From 22978d5b9d5ab5748a2cac0f0ac689ce09a89b77 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 9 Dec 2019 11:43:16 +0000 Subject: [PATCH 08/20] Align import syntax of properties to the one used in Groovy --- core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 6b1694374..3ca183c49 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -37,12 +37,12 @@ android { val designer_news_client_secret: String by project val product_hunt_developer_token: String by project - buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "${designer_news_client_id}") + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\"") buildConfigField("String", - "DESIGNER_NEWS_CLIENT_SECRET", "${designer_news_client_secret}") + "DESIGNER_NEWS_CLIENT_SECRET", "\"${designer_news_client_secret}\"") buildConfigField("String", - "PRODUCT_HUNT_DEVELOPER_TOKEN", "${product_hunt_developer_token}") + "PRODUCT_HUNT_DEVELOPER_TOKEN", "\"${product_hunt_developer_token}\"") javaCompileOptions { annotationProcessorOptions { From 9ee9a4de31e8b166347fd8035e5508ec3f3548d7 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 9 Dec 2019 14:41:33 +0000 Subject: [PATCH 09/20] Downgraded to AGP v3.6-beta05 to avoid issues on the check task. --- about/build.gradle.kts | 25 ++++++++++------------ app/build.gradle.kts | 9 +++----- build.gradle.kts | 2 +- buildSrc/build.gradle.kts | 23 ++++++++++---------- buildSrc/src/main/java/Config.kt | 2 +- core/build.gradle.kts | 27 +++++++++++------------- designernews/build.gradle.kts | 26 ++++++++++------------- dribbble/build.gradle.kts | 27 ++++++++++-------------- gradle/wrapper/gradle-wrapper.properties | 2 +- search/build.gradle.kts | 21 +++++++++--------- test_shared/build.gradle.kts | 21 +++++++++--------- third_party/bypass/build.gradle.kts | 4 ++-- 12 files changed, 84 insertions(+), 105 deletions(-) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 838d2c7b6..29ad006ae 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { @@ -44,9 +43,7 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - buildFeatures { - dataBinding = true - } + dataBinding.isEnabled = true } dependencies { diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8fe12d57a..8f58fb7c9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,11 +1,11 @@ /* - * Copyright 2019 Google Inc. + * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, @@ -64,7 +64,6 @@ android { getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" ) - } getByName("debug") { (this as ExtensionAware).extra["alwaysUpdateBuildId"] = false @@ -83,9 +82,7 @@ android { ":search" ) - buildFeatures { - dataBinding = true - } + dataBinding.isEnabled = true kotlinOptions { jvmTarget = "1.8" diff --git a/build.gradle.kts b/build.gradle.kts index 6d519d456..ff24dff27 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -38,7 +38,7 @@ spotless { } kotlinGradle { // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') - target("*.gradle.kts") + target("**/*.gradle.kts") ktlint("0.36.0") diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 93f9ef982..69406b441 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { @@ -21,4 +20,4 @@ plugins { repositories { gradlePluginPortal() -} \ No newline at end of file +} diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 427a38c88..05ed3791b 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -97,7 +97,7 @@ object Versions { val compileSdk = 29 val targetSdk = 28 val minSdk = 23 - val gradle_plugin = "4.0.0-alpha05" + val gradle_plugin = "3.6.0-beta05" val appcompat = "1.1.0" val androidx = "1.0.0" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 3ca183c49..263ba4b88 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { @@ -66,9 +65,7 @@ android { exclude("META-INF/core_debug.kotlin_module") } - buildFeatures { - dataBinding = true - } + dataBinding.isEnabled = true } dependencies { @@ -98,4 +95,4 @@ kapt.arguments { ) } -androidExtensions.isExperimental = true \ No newline at end of file +androidExtensions.isExperimental = true diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 3a7def4d3..9f86a2fba 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { @@ -46,12 +45,9 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - buildFeatures { - dataBinding = true - } + dataBinding.isEnabled = true } - dependencies { implementation(project(":app")) implementation(project(":core")) diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 7ddfd47ee..9aee05702 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { @@ -49,9 +48,7 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } - buildFeatures { - dataBinding = true - } + dataBinding.isEnabled = true } dependencies { @@ -66,5 +63,3 @@ dependencies { } kapt.useBuildCache = true - - diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d13172714..07edda538 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-milestone-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 61ec61b80..d5e3505da 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index bf927dd81..f447a50ba 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -1,18 +1,17 @@ /* - * 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. */ plugins { diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index 0c4840059..7583c8dc4 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -1,11 +1,11 @@ /* - * Copyright 2019 Google Inc. + * 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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, From 9f7b861a7090a8fa12d20594e575d496554ab697 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 9 Dec 2019 16:19:47 +0000 Subject: [PATCH 10/20] Update to handle properties with double quotes. --- core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 263ba4b88..ec332b7b1 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -36,12 +36,12 @@ android { val designer_news_client_secret: String by project val product_hunt_developer_token: String by project - buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\"") + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "$designer_news_client_id") buildConfigField("String", - "DESIGNER_NEWS_CLIENT_SECRET", "\"${designer_news_client_secret}\"") + "DESIGNER_NEWS_CLIENT_SECRET", "$designer_news_client_secret") buildConfigField("String", - "PRODUCT_HUNT_DEVELOPER_TOKEN", "\"${product_hunt_developer_token}\"") + "PRODUCT_HUNT_DEVELOPER_TOKEN", "$product_hunt_developer_token") javaCompileOptions { annotationProcessorOptions { From e7f06a1725bee1003c7b94777900b8c805a1e249 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 30 Dec 2019 15:16:40 +0000 Subject: [PATCH 11/20] Update to AGP 3.6.0-rc1 This commit also correct double quotes handling for properties. --- buildSrc/src/main/java/Config.kt | 2 +- core/build.gradle.kts | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt index 05ed3791b..8db398506 100644 --- a/buildSrc/src/main/java/Config.kt +++ b/buildSrc/src/main/java/Config.kt @@ -97,7 +97,7 @@ object Versions { val compileSdk = 29 val targetSdk = 28 val minSdk = 23 - val gradle_plugin = "3.6.0-beta05" + val gradle_plugin = "3.6.0-rc01" val appcompat = "1.1.0" val androidx = "1.0.0" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index ec332b7b1..263ba4b88 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -36,12 +36,12 @@ android { val designer_news_client_secret: String by project val product_hunt_developer_token: String by project - buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "$designer_news_client_id") + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\"") buildConfigField("String", - "DESIGNER_NEWS_CLIENT_SECRET", "$designer_news_client_secret") + "DESIGNER_NEWS_CLIENT_SECRET", "\"${designer_news_client_secret}\"") buildConfigField("String", - "PRODUCT_HUNT_DEVELOPER_TOKEN", "$product_hunt_developer_token") + "PRODUCT_HUNT_DEVELOPER_TOKEN", "\"${product_hunt_developer_token}\"") javaCompileOptions { annotationProcessorOptions { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 07edda538..609a8fc0a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip From 80c62e1d48e7e018ed8bac8cb842eb8864432e33 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 30 Dec 2019 15:55:14 +0000 Subject: [PATCH 12/20] Add the main Glide artifact to kapt classpath This is required having disabled compile avoidance for kapt in master: kapt.include.compile.classpath=false --- core/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 263ba4b88..fd2315c2a 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -84,6 +84,7 @@ dependencies { api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") api("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") kapt("com.github.bumptech.glide:compiler:${Versions.glide}") + kapt("com.github.bumptech.glide:glide:${Versions.glide}") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } From aeb6ed1993950b553d3f789968cd26e192edf1ba Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 30 Dec 2019 16:38:43 +0000 Subject: [PATCH 13/20] Revert change to read properties WITH double-quotes. --- core/build.gradle.kts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index fd2315c2a..2e47316c6 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -36,12 +36,12 @@ android { val designer_news_client_secret: String by project val product_hunt_developer_token: String by project - buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\"") + buildConfigField("String", "DESIGNER_NEWS_CLIENT_ID", "$designer_news_client_id") buildConfigField("String", - "DESIGNER_NEWS_CLIENT_SECRET", "\"${designer_news_client_secret}\"") + "DESIGNER_NEWS_CLIENT_SECRET", "$designer_news_client_secret") buildConfigField("String", - "PRODUCT_HUNT_DEVELOPER_TOKEN", "\"${product_hunt_developer_token}\"") + "PRODUCT_HUNT_DEVELOPER_TOKEN", "$product_hunt_developer_token") javaCompileOptions { annotationProcessorOptions { From 7a595ff7d37cf484406c3183f610958288121821 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Thu, 2 Jan 2020 13:27:55 +0000 Subject: [PATCH 14/20] Integrate some ideas from #811 - Split the config object into three separate files based on content - Cleanup main build.gradle.kts --- build.gradle.kts | 15 +- .../src/main/java/AddCommonRepositories.kt | 90 +++++++++++ buildSrc/src/main/java/Config.kt | 140 ------------------ buildSrc/src/main/java/Names.kt | 19 +++ buildSrc/src/main/java/Versions.kt | 59 ++++++++ 5 files changed, 177 insertions(+), 146 deletions(-) create mode 100644 buildSrc/src/main/java/AddCommonRepositories.kt delete mode 100644 buildSrc/src/main/java/Config.kt create mode 100644 buildSrc/src/main/java/Names.kt create mode 100644 buildSrc/src/main/java/Versions.kt diff --git a/build.gradle.kts b/build.gradle.kts index ff24dff27..7e84a50ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,9 @@ plugins { buildscript { - Config.run { repositories.deps() } + repositories { + addCommonRepositories() + } dependencies { classpath("com.android.tools.build:gradle:${Versions.gradle_plugin}") @@ -33,20 +35,21 @@ buildscript { spotless { kotlin { target("**/*.kt") - ktlint("0.36.0") - licenseHeaderFile("$rootDir/scripts/copyright.txt", "(package |import |@file:)") + ktlint(Versions.ktlint) + licenseHeaderFile("$rootDir/scripts/copyright.txt", "(package |import |@file:|object |@Suppress)") } kotlinGradle { // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') target("**/*.gradle.kts") - ktlint("0.36.0") + ktlint(Versions.ktlint) licenseHeaderFile("$rootDir/scripts/copyright.txt", "(plugins |import |include)") } } + subprojects { - Config.run { - repositories.deps() + repositories { + addCommonRepositories() } } diff --git a/buildSrc/src/main/java/AddCommonRepositories.kt b/buildSrc/src/main/java/AddCommonRepositories.kt new file mode 100644 index 000000000..f51fcd3b9 --- /dev/null +++ b/buildSrc/src/main/java/AddCommonRepositories.kt @@ -0,0 +1,90 @@ +/* + * 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 + * + * 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.maven + +fun RepositoryHandler.addCommonRepositories() { + google().content { + includeGroupByRegex("com.android.*") + includeGroupByRegex("androidx.*") + + includeGroup("androidx.lifecycle") + includeGroup("androidx.core") + includeGroup("com.google.firebase") + includeGroup("com.google.android.gms") + includeGroup("com.google.android.material") + includeGroup("com.google.gms") + + includeGroup("zipflinger") + } + + jcenter().content { + includeGroupByRegex("com.google.*") + includeGroupByRegex("com.sun.*") + includeGroupByRegex("com.squareup.*") + includeGroupByRegex("com.jakewharton.*") + includeGroupByRegex("com.googlecode.*") + includeGroupByRegex("org.jetbrains.*") + includeGroupByRegex("org.codehaus.*") + includeGroupByRegex("org.apache.*") + includeGroupByRegex("net.sf.*") + includeGroupByRegex("javax.*") + includeGroupByRegex("org.ow2.*") + + includeGroup("com.github.bumptech.glide") + includeGroup("com.ibm.icu") + includeGroup("com.nhaarman.mockitokotlin2") + includeGroup("commons-io") + includeGroup("commons-codec") + includeGroup("commons-logging") + includeGroup("it.unimi.dsi") + includeGroup("junit") + includeGroup("me.eugeniomarletti.kotlin.metadata") + includeGroup("net.bytebuddy") + includeGroup("net.java") + includeGroup("org.abego.treelayout") + includeGroup("org.antlr") + includeGroup("org.bouncycastle") + includeGroup("org.checkerframework") + includeGroup("org.glassfish") + includeGroup("org.glassfish.jaxb") + includeGroup("org.hamcrest") + includeGroup("org.jvnet.staxex") + includeGroup("org.jsoup") + includeGroup("org.mockito") + includeGroup("org.objenesis") + includeGroup("org.sonatype.oss") + includeGroup("org.xerial") + includeGroup("net.ltgt.gradle.incap") + + includeGroup("de.undercouch") + includeGroup("org.jdom") + + excludeGroup("com.google.firebase") + excludeGroup("com.google.android.gms") + excludeGroup("com.google.android.material") + } + + maven("https://dl.bintray.com/kotlin/kotlin-eap/").content { + includeGroupByRegex("org.jetbrains.*") + } + + maven("https://maven.fabric.io/public").content { + includeGroupByRegex("io.fabric.*") + includeGroupByRegex("com.crashlytics.*") + } +} diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt deleted file mode 100644 index 8db398506..000000000 --- a/buildSrc/src/main/java/Config.kt +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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 - * - * 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.maven - -@Suppress("MayBeConstant") // Improve perf when changing values -object Config { - - fun RepositoryHandler.deps() { - google().content { - includeGroupByRegex("com.android.*") - includeGroupByRegex("androidx.*") - - includeGroup("androidx.lifecycle") - includeGroup("androidx.core") - includeGroup("com.google.firebase") - includeGroup("com.google.android.gms") - includeGroup("com.google.android.material") - includeGroup("com.google.gms") - - includeGroup("zipflinger") - } - - jcenter().content { - includeGroupByRegex("com.google.*") - includeGroupByRegex("com.sun.*") - includeGroupByRegex("com.squareup.*") - includeGroupByRegex("com.jakewharton.*") - includeGroupByRegex("com.googlecode.*") - includeGroupByRegex("org.jetbrains.*") - includeGroupByRegex("org.codehaus.*") - includeGroupByRegex("org.apache.*") - includeGroupByRegex("net.sf.*") - includeGroupByRegex("javax.*") - includeGroupByRegex("org.ow2.*") - - includeGroup("com.github.bumptech.glide") - includeGroup("com.ibm.icu") - includeGroup("com.nhaarman.mockitokotlin2") - includeGroup("commons-io") - includeGroup("commons-codec") - includeGroup("commons-logging") - includeGroup("it.unimi.dsi") - includeGroup("junit") - includeGroup("me.eugeniomarletti.kotlin.metadata") - includeGroup("net.bytebuddy") - includeGroup("net.java") - includeGroup("org.abego.treelayout") - includeGroup("org.antlr") - includeGroup("org.bouncycastle") - includeGroup("org.checkerframework") - includeGroup("org.glassfish") - includeGroup("org.glassfish.jaxb") - includeGroup("org.hamcrest") - includeGroup("org.jvnet.staxex") - includeGroup("org.jsoup") - includeGroup("org.mockito") - includeGroup("org.objenesis") - includeGroup("org.sonatype.oss") - includeGroup("org.xerial") - includeGroup("net.ltgt.gradle.incap") - - includeGroup("de.undercouch") - includeGroup("org.jdom") - - excludeGroup("com.google.firebase") - excludeGroup("com.google.android.gms") - excludeGroup("com.google.android.material") - } - - maven("https://dl.bintray.com/kotlin/kotlin-eap/").content { - includeGroupByRegex("org.jetbrains.*") - } - - maven("https://maven.fabric.io/public").content { - includeGroupByRegex("io.fabric.*") - includeGroupByRegex("com.crashlytics.*") - } - } -} - -object Versions { - val compileSdk = 29 - val targetSdk = 28 - val minSdk = 23 - val gradle_plugin = "3.6.0-rc01" - - val appcompat = "1.1.0" - val androidx = "1.0.0" - val androidxCollection = "1.0.0" - val androidxCoreRuntime = "2.1.0" - val androidxArch = "2.0.0" - 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.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.61" - val ktlint = "0.24.0" - val legacyCoreUtils = "1.0.0" - 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 = "4.2.2" - val retrofit = "2.6.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" - val ui_automator = "2.2.0-beta02" - val viewPager2 = "1.0.0-beta02" -} - -object Names { - val applicationId = "io.plaidapp" -} diff --git a/buildSrc/src/main/java/Names.kt b/buildSrc/src/main/java/Names.kt new file mode 100644 index 000000000..ba8993bc5 --- /dev/null +++ b/buildSrc/src/main/java/Names.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2020 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 + * + * 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. + */ + +object Names { + val applicationId = "io.plaidapp" +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt new file mode 100644 index 000000000..1d28fe9a6 --- /dev/null +++ b/buildSrc/src/main/java/Versions.kt @@ -0,0 +1,59 @@ +/* + * Copyright 2020 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 + * + * 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. + */ + +@Suppress("MayBeConstant") // Improve perf when changing values + +object Versions { + val compileSdk = 29 + val targetSdk = 28 + val minSdk = 23 + val gradle_plugin = "3.6.0-rc01" + + val appcompat = "1.1.0" + val androidx = "1.0.0" + val androidxCollection = "1.0.0" + val androidxCoreRuntime = "2.1.0" + val androidxArch = "2.0.0" + 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.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.61" + val ktlint = "0.36.0" + val legacyCoreUtils = "1.0.0" + 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 = "4.2.2" + val retrofit = "2.6.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" + val ui_automator = "2.2.0-beta02" + val viewPager2 = "1.0.0-beta02" +} From d416128b62f4333905f62ef349e24782f6a44942 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Thu, 2 Jan 2020 13:41:06 +0000 Subject: [PATCH 15/20] Address a couple of comments on the PR - Incremental annotation processing is now enabled by default - Too many kts in "build.gradle.kts.kts.kts". --- core/proguard-rules.pro | 2 +- gradle.properties | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index 14a1b38dd..7c75a31e3 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle.kts.kts.kts. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/gradle.properties b/gradle.properties index cdb5fe0d3..e60cce0f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,11 +13,8 @@ org.gradle.daemon=true org.gradle.caching=true org.gradle.parallel=true -## Use kapt incremental -#kapt.incremental.apt=true -# -## Use kapt in parallel -#kapt.use.worker.api=true +# Use kapt incremental +kapt.incremental.apt=true # Kapt compile avoidance kapt.include.compile.classpath=false From e5da4878c4fbd14652341f63433d23a13948c832 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Fri, 3 Jan 2020 18:55:27 +0000 Subject: [PATCH 16/20] Adopt the Java Platform plugin to share dependencies versions. --- about/build.gradle.kts | 8 +- app/build.gradle.kts | 14 +-- build.gradle.kts | 6 +- buildSrc/src/main/java/Versions.kt | 29 ------ core/build.gradle.kts | 27 +++--- depconstraints/build.gradle.kts | 134 ++++++++++++++++++++++++++++ dependencies.gradle.kts | 70 ++++++++------- designernews/build.gradle.kts | 8 +- dribbble/build.gradle.kts | 8 +- search/build.gradle.kts | 6 +- settings.gradle.kts | 1 + test_shared/build.gradle.kts | 12 +-- third_party/bypass/build.gradle.kts | 6 +- 13 files changed, 228 insertions(+), 101 deletions(-) create mode 100644 depconstraints/build.gradle.kts diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 29ad006ae..360adcf07 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -47,13 +47,15 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":app")) implementation(project(":core")) implementation(project(":bypass")) - implementation("androidx.viewpager2:viewpager2:${Versions.viewPager2}") - implementation("com.android.support:customtabs:${Versions.supportLibrary}") - implementation("com.github.bumptech.glide:glide:${Versions.glide}") + implementation("androidx.viewpager2:viewpager2") + implementation("com.android.support:customtabs") + implementation("com.github.bumptech.glide:glide") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8f58fb7c9..67a20b49f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -90,13 +90,15 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + 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.github.bumptech.glide:glide:${Versions.glide}") - implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") - implementation("com.google.firebase:firebase-core:${Versions.firebase}") + implementation("androidx.appcompat:appcompat") + implementation("androidx.lifecycle:lifecycle-extensions") + implementation("com.crashlytics.sdk.android:crashlytics") + implementation("com.github.bumptech.glide:glide") + implementation("com.github.bumptech.glide:recyclerview-integration") + implementation("com.google.firebase:firebase-core") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/build.gradle.kts b/build.gradle.kts index 7e84a50ec..4eb82051a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -33,16 +33,18 @@ buildscript { } spotless { + val ktlintVer by extra("0.36.0") + kotlin { target("**/*.kt") - ktlint(Versions.ktlint) + ktlint(ktlintVer) licenseHeaderFile("$rootDir/scripts/copyright.txt", "(package |import |@file:|object |@Suppress)") } kotlinGradle { // same as kotlin, but for .gradle.kts files (defaults to '*.gradle.kts') target("**/*.gradle.kts") - ktlint(Versions.ktlint) + ktlint(ktlintVer) licenseHeaderFile("$rootDir/scripts/copyright.txt", "(plugins |import |include)") } diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 1d28fe9a6..702434332 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -22,38 +22,9 @@ object Versions { val minSdk = 23 val gradle_plugin = "3.6.0-rc01" - val appcompat = "1.1.0" - val androidx = "1.0.0" - val androidxCollection = "1.0.0" - val androidxCoreRuntime = "2.1.0" - val androidxArch = "2.0.0" - 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.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.61" - val ktlint = "0.36.0" - val legacyCoreUtils = "1.0.0" - 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 = "4.2.2" - val retrofit = "2.6.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" - val ui_automator = "2.2.0-beta02" - val viewPager2 = "1.0.0-beta02" } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 2e47316c6..e600ec75d 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -69,20 +69,23 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":bypass")) - implementation("com.google.code.gson:gson:${Versions.gson}") - implementation("androidx.browser:browser:${Versions.androidx}") - implementation("androidx.room:room-runtime:${Versions.room}") - implementation("androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}") - implementation("com.android.support:palette-v7:${Versions.supportLibrary}") - implementation("com.android.support:support-dynamic-animation:${Versions.supportLibrary}") - implementation("com.github.bumptech.glide:glide:${Versions.glide}") - implementation("com.squareup.okhttp3:okhttp:${Versions.okhttp}") - implementation("com.squareup.okhttp3:logging-interceptor:${Versions.okhttp}") - implementation("org.jsoup:jsoup:${Versions.jsoup}") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") - api("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") + implementation("com.google.code.gson:gson") + implementation("androidx.browser:browser") + implementation("androidx.room:room-runtime") + implementation("androidx.constraintlayout:constraintlayout") + implementation("com.android.support:palette-v7") + implementation("com.android.support:support-dynamic-animation") + implementation("com.github.bumptech.glide:glide") + implementation("com.squareup.okhttp3:okhttp") + implementation("com.squareup.okhttp3:logging-interceptor") + implementation("org.jsoup:jsoup") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core") + api("org.jetbrains.kotlinx:kotlinx-coroutines-android") + kapt("com.github.bumptech.glide:compiler:${Versions.glide}") kapt("com.github.bumptech.glide:glide:${Versions.glide}") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") diff --git a/depconstraints/build.gradle.kts b/depconstraints/build.gradle.kts new file mode 100644 index 000000000..61c85c58e --- /dev/null +++ b/depconstraints/build.gradle.kts @@ -0,0 +1,134 @@ +/* + * Copyright 2020 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 + * + * 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. + */ + +plugins { + id("java-platform") + id("maven-publish") +} + +val appcompat = "1.1.0" +val androidx = "1.0.0" +val androidxCollection = "1.0.0" +val androidxCoreRuntime = "2.1.0" +val androidxArch = "2.0.0" +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.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 legacyCoreUtils = "1.0.0" +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 = "4.2.2" +val retrofit = "2.6.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" +val ui_automator = "2.2.0-beta02" +val viewPager2 = "1.0.0-beta02" + +dependencies { + constraints { + api("androidx.annotation:annotation:$androidx") + api("androidx.appcompat:appcompat:$appcompat") + api("androidx.arch.core:core-runtime:$androidxCoreRuntime") + api("androidx.browser:browser:$androidx") + api("androidx.collection:collection:$androidxCollection") + api("androidx.constraintlayout:constraintlayout:$constraintLayout") + api("androidx.legacy:legacy-support-core-utils:$legacyCoreUtils") + api("androidx.lifecycle:lifecycle-extensions:$lifecycle") + api("androidx.lifecycle:lifecycle-runtime:$lifecycle") + api("androidx.room:room-runtime:$room") + api("androidx.room:room-ktx:$room") + api("androidx.viewpager2:viewpager2:$viewPager2") + api("com.android.support:customtabs:$supportLibrary") + api("com.android.support:palette-v7:$supportLibrary") + api("com.android.support:support-dynamic-animation:$supportLibrary") + api("com.crashlytics.sdk.android:crashlytics:$crashlytics") + api("com.github.bumptech.glide:glide:$glide") + api("com.github.bumptech.glide:recyclerview-integration:$glide") + api("com.google.code.gson:gson:$gson") + api("com.google.firebase:firebase-core:$firebase") + api("com.squareup.okhttp3:okhttp:$okhttp") + api("com.squareup.okhttp3:logging-interceptor:$okhttp") + api("junit:junit:$junit") + api("org.jsoup:jsoup:$jsoup") + api("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") + api("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines") + api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines") + api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines") + + api("com.google.android.material:material:$material") + api("com.google.dagger:dagger:$dagger") + api("androidx.arch.core:core-common:$androidxCoreRuntime") + api("androidx.arch.core:core-runtime:$androidxCoreRuntime") + api("androidx.core:core-ktx:$coreKtx") + api("com.squareup.retrofit2:retrofit:$retrofit") + api("com.squareup.retrofit2:converter-gson:$retrofit") + api("androidx.lifecycle:lifecycle-viewmodel:$lifecycle") + api("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle") + api("androidx.lifecycle:lifecycle-extensions:$lifecycle") + api("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle") + + api("androidx.arch.core:core-testing:$androidxArch") + api("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin") + api("com.squareup.retrofit2:retrofit-mock:$retrofit") + api("junit:junit:$junit") + api("org.mockito:mockito-core:$mockito") + api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines") + + api("androidx.arch.core:core-testing:$androidxArch") + api("androidx.legacy:legacy-support-core-utils:$legacyCoreUtils") + api("androidx.lifecycle:lifecycle-runtime:$lifecycle") + + api("androidx.arch.core:core-testing:$androidxArch") + api("androidx.test.espresso:espresso-contrib:$espresso") + api("androidx.test.espresso:espresso-core:$espresso") + api("androidx.test.ext:junit:$extJunit") + api("androidx.test:rules:$test_rules") + api("androidx.test:runner:$test_runner") + api("androidx.test.uiautomator:uiautomator:$ui_automator") + api("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin") + api("com.squareup.retrofit2:retrofit-mock:$retrofit") + api("org.mockito:mockito-android:$mockito") + api("org.mockito:mockito-core:$mockito") + + // Adding this to bring "google_play_services_version" into the test project + // without this, it fails on AGP 3.6.x. + api("com.google.android.gms:play-services-gcm:16.0.0") + } +} + +publishing { + publications { + create("JavaPlatform") { + from(components["javaPlatform"]) + } + } +} diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts index 424e3dce0..f9d5843eb 100644 --- a/dependencies.gradle.kts +++ b/dependencies.gradle.kts @@ -23,51 +23,53 @@ val androidTestImplementation by configurations val compile by configurations val api by configurations dependencies { - implementation("com.google.android.material:material:${Versions.material}") - implementation("com.google.dagger:dagger:${Versions.dagger}") - implementation("androidx.arch.core:core-common:${Versions.androidxCoreRuntime}") - implementation("androidx.arch.core:core-runtime:${Versions.androidxCoreRuntime}") - implementation("androidx.core:core-ktx:${Versions.coreKtx}") - implementation("com.squareup.retrofit2:retrofit:${Versions.retrofit}") - implementation("com.squareup.retrofit2:converter-gson:${Versions.retrofit}") - implementation("androidx.lifecycle:lifecycle-viewmodel:${Versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-extensions:${Versions.lifecycle}") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}") + api(platform(project(":depconstraints"))) + + implementation("com.google.android.material:material") + implementation("com.google.dagger:dagger") + implementation("androidx.arch.core:core-common") + implementation("androidx.arch.core:core-runtime") + implementation("androidx.core:core-ktx") + implementation("com.squareup.retrofit2:retrofit") + implementation("com.squareup.retrofit2:converter-gson") + implementation("androidx.lifecycle:lifecycle-viewmodel") + implementation("androidx.lifecycle:lifecycle-livedata-ktx") + implementation("androidx.lifecycle:lifecycle-extensions") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx") // Work around issue with runtime classpath version conflict - implementation("androidx.collection:collection:${Versions.androidxCollection}") - implementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") - implementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + implementation("androidx.collection:collection") + implementation("androidx.legacy:legacy-support-core-utils") + implementation("androidx.lifecycle:lifecycle-runtime") testImplementation(project(":test_shared")) - testImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") - testImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") - testImplementation("junit:junit:${Versions.junit}") - testImplementation("org.mockito:mockito-core:${Versions.mockito}") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") + testImplementation("androidx.arch.core:core-testing") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin") + testImplementation("com.squareup.retrofit2:retrofit-mock") + testImplementation("junit:junit") + testImplementation("org.mockito:mockito-core") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") // Workaround for dependency conflict during assembleAndroidTest androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") // Work around issue with runtime classpath version conflict - androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - androidTestImplementation("androidx.legacy:legacy-support-core-utils:${Versions.legacyCoreUtils}") - androidTestImplementation("androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle}") + androidTestImplementation("androidx.arch.core:core-testing") + androidTestImplementation("androidx.legacy:legacy-support-core-utils") + androidTestImplementation("androidx.lifecycle:lifecycle-runtime:") androidTestImplementation(project(":test_shared")) - androidTestImplementation("androidx.arch.core:core-testing:${Versions.androidxArch}") - androidTestImplementation("androidx.test.espresso:espresso-contrib:${Versions.espresso}") - androidTestImplementation("androidx.test.espresso:espresso-core:${Versions.espresso}") - androidTestImplementation("androidx.test.ext:junit:${Versions.extJunit}") - androidTestImplementation("androidx.test:rules:${Versions.test_rules}") - androidTestImplementation("androidx.test:runner:${Versions.test_runner}") - androidTestImplementation("androidx.test.uiautomator:uiautomator:${Versions.ui_automator}") - androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}") - androidTestImplementation("com.squareup.retrofit2:retrofit-mock:${Versions.retrofit}") - androidTestImplementation("org.mockito:mockito-android:${Versions.mockito}") - androidTestImplementation("org.mockito:mockito-core:${Versions.mockito}") + androidTestImplementation("androidx.arch.core:core-testing") + androidTestImplementation("androidx.test.espresso:espresso-contrib") + androidTestImplementation("androidx.test.espresso:espresso-core") + androidTestImplementation("androidx.test.ext:junit") + androidTestImplementation("androidx.test:rules") + androidTestImplementation("androidx.test:runner") + androidTestImplementation("androidx.test.uiautomator:uiautomator") + androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin") + androidTestImplementation("com.squareup.retrofit2:retrofit-mock") + androidTestImplementation("org.mockito:mockito-android") + androidTestImplementation("org.mockito:mockito-core") // Adding this to bring "google_play_services_version" into the test project // without this, it fails on AGP 3.6.x. androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 9f86a2fba..837248cec 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -49,13 +49,15 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":app")) implementation(project(":core")) implementation(project(":bypass")) - implementation("androidx.room:room-ktx:${Versions.room}") - implementation("com.android.support:customtabs:${Versions.supportLibrary}") - implementation("com.github.bumptech.glide:glide:${Versions.glide}") + implementation("androidx.room:room-ktx") + implementation("com.android.support:customtabs") + implementation("com.github.bumptech.glide:glide") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 9aee05702..366d72b7c 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -52,12 +52,14 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":app")) implementation(project(":core")) - implementation("com.android.support:customtabs:${Versions.supportLibrary}") - implementation("com.android.support:palette-v7:${Versions.supportLibrary}") - implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") + implementation("com.android.support:customtabs") + implementation("com.android.support:palette-v7") + implementation("com.github.bumptech.glide:recyclerview-integration") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/search/build.gradle.kts b/search/build.gradle.kts index d5e3505da..3b9c14faf 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -47,11 +47,13 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":app")) implementation(project(":core")) - implementation("com.github.bumptech.glide:recyclerview-integration:${Versions.glide}") - implementation("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") + implementation("com.github.bumptech.glide:recyclerview-integration") + implementation("org.jetbrains.kotlin:kotlin-reflect") kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") } diff --git a/settings.gradle.kts b/settings.gradle.kts index cc98a62a7..af9bc5b92 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -14,6 +14,7 @@ * limitations under the License. */ +include("depconstraints") include(":app", ":bypass") include(":about", ":core", ":dribbble", ":designernews", ":search") include(":test_shared") diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index f447a50ba..812f6b56b 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -38,11 +38,13 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(project(":core")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}") - implementation("junit:junit:${Versions.junit}") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines}") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android") + implementation("junit:junit") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") } diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index 7583c8dc4..f0dc51d6b 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -38,7 +38,9 @@ android { } dependencies { + api(platform(project(":depconstraints"))) + implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("androidx.annotation:annotation:${Versions.androidx}") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") + implementation("androidx.annotation:annotation") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7") } From 5df57f441ce0e14d13113332b448e6ff41054286 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Mon, 13 Jan 2020 17:10:36 +0000 Subject: [PATCH 17/20] Manage kapt version sets through Java Platform plugin --- about/build.gradle.kts | 3 ++- app/build.gradle.kts | 3 ++- buildSrc/src/main/java/Versions.kt | 2 -- core/build.gradle.kts | 7 ++++--- depconstraints/build.gradle.kts | 2 ++ designernews/build.gradle.kts | 3 ++- dribbble/build.gradle.kts | 3 ++- search/build.gradle.kts | 3 ++- 8 files changed, 16 insertions(+), 10 deletions(-) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 360adcf07..9562479c5 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -48,6 +48,7 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":app")) implementation(project(":core")) @@ -57,7 +58,7 @@ dependencies { implementation("com.android.support:customtabs") implementation("com.github.bumptech.glide:glide") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.google.dagger:dagger-compiler") } kapt { diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 67a20b49f..d9c82f90c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -91,6 +91,7 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":core")) implementation("androidx.appcompat:appcompat") @@ -100,7 +101,7 @@ dependencies { implementation("com.github.bumptech.glide:recyclerview-integration") implementation("com.google.firebase:firebase-core") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.google.dagger:dagger-compiler") } kapt.useBuildCache = true diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 702434332..15068af25 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -22,9 +22,7 @@ object Versions { val minSdk = 23 val gradle_plugin = "3.6.0-rc01" - val dagger = "2.23.2" val fabric = "1.28.0" - val glide = "4.9.0" val googleServices = "4.3.0" val kotlin = "1.3.61" } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e600ec75d..a7574a210 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -70,6 +70,7 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":bypass")) @@ -86,9 +87,9 @@ dependencies { api("org.jetbrains.kotlinx:kotlinx-coroutines-core") api("org.jetbrains.kotlinx:kotlinx-coroutines-android") - kapt("com.github.bumptech.glide:compiler:${Versions.glide}") - kapt("com.github.bumptech.glide:glide:${Versions.glide}") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.github.bumptech.glide:compiler") + kapt("com.github.bumptech.glide:glide") + kapt("com.google.dagger:dagger-compiler") } kapt.useBuildCache = true diff --git a/depconstraints/build.gradle.kts b/depconstraints/build.gradle.kts index 61c85c58e..9b09471c8 100644 --- a/depconstraints/build.gradle.kts +++ b/depconstraints/build.gradle.kts @@ -72,6 +72,7 @@ dependencies { api("com.crashlytics.sdk.android:crashlytics:$crashlytics") api("com.github.bumptech.glide:glide:$glide") api("com.github.bumptech.glide:recyclerview-integration:$glide") + api("com.github.bumptech.glide:compiler:$glide") api("com.google.code.gson:gson:$gson") api("com.google.firebase:firebase-core:$firebase") api("com.squareup.okhttp3:okhttp:$okhttp") @@ -86,6 +87,7 @@ dependencies { api("com.google.android.material:material:$material") api("com.google.dagger:dagger:$dagger") + api("com.google.dagger:dagger-compiler:$dagger") api("androidx.arch.core:core-common:$androidxCoreRuntime") api("androidx.arch.core:core-runtime:$androidxCoreRuntime") api("androidx.core:core-ktx:$coreKtx") diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 837248cec..b5ad57711 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -50,6 +50,7 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":app")) implementation(project(":core")) @@ -59,7 +60,7 @@ dependencies { implementation("com.android.support:customtabs") implementation("com.github.bumptech.glide:glide") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.google.dagger:dagger-compiler") } kapt.useBuildCache = true diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 366d72b7c..5a2939f27 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -53,6 +53,7 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":app")) implementation(project(":core")) @@ -61,7 +62,7 @@ dependencies { implementation("com.android.support:palette-v7") implementation("com.github.bumptech.glide:recyclerview-integration") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.google.dagger:dagger-compiler") } kapt.useBuildCache = true diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 3b9c14faf..705d2ebb6 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -48,13 +48,14 @@ android { dependencies { api(platform(project(":depconstraints"))) + kapt(platform(project(":depconstraints"))) implementation(project(":app")) implementation(project(":core")) implementation("com.github.bumptech.glide:recyclerview-integration") implementation("org.jetbrains.kotlin:kotlin-reflect") - kapt("com.google.dagger:dagger-compiler:${Versions.dagger}") + kapt("com.google.dagger:dagger-compiler") } kapt.useBuildCache = true From 3ba21d93f4c3619b0fba8284d11b69fdf67763af Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Tue, 14 Jan 2020 17:35:35 +0000 Subject: [PATCH 18/20] Adds Libs object with libray names and version set for kapt --- about/build.gradle.kts | 9 ++- app/build.gradle.kts | 19 ++--- build.gradle.kts | 6 +- buildSrc/src/main/java/Libs.kt | 72 +++++++++++++++++ buildSrc/src/main/java/Versions.kt | 3 - core/build.gradle.kts | 35 ++++---- depconstraints/build.gradle.kts | 119 ++++++++++++---------------- dependencies.gradle.kts | 76 ------------------ designernews/build.gradle.kts | 11 +-- dribbble/build.gradle.kts | 11 +-- search/build.gradle.kts | 9 ++- shared_dependencies.gradle.kts | 37 +++++++++ test_dependencies.gradle.kts | 66 +++++++++++++++ test_shared/build.gradle.kts | 13 +-- third_party/bypass/build.gradle.kts | 4 +- 15 files changed, 289 insertions(+), 201 deletions(-) create mode 100644 buildSrc/src/main/java/Libs.kt delete mode 100644 dependencies.gradle.kts create mode 100644 shared_dependencies.gradle.kts create mode 100644 test_dependencies.gradle.kts diff --git a/about/build.gradle.kts b/about/build.gradle.kts index 9562479c5..d842cb8f4 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -20,7 +20,8 @@ plugins { kotlin("kapt") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -54,9 +55,9 @@ dependencies { implementation(project(":core")) implementation(project(":bypass")) - implementation("androidx.viewpager2:viewpager2") - implementation("com.android.support:customtabs") - implementation("com.github.bumptech.glide:glide") + implementation(Libs.AX_VIEWPAGER2) + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.GLIDE) kapt("com.google.dagger:dagger-compiler") } diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d9c82f90c..bbff229af 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -23,7 +23,8 @@ plugins { id("com.google.gms.google-services") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -94,14 +95,14 @@ dependencies { kapt(platform(project(":depconstraints"))) implementation(project(":core")) - implementation("androidx.appcompat:appcompat") - implementation("androidx.lifecycle:lifecycle-extensions") - implementation("com.crashlytics.sdk.android:crashlytics") - implementation("com.github.bumptech.glide:glide") - implementation("com.github.bumptech.glide:recyclerview-integration") - implementation("com.google.firebase:firebase-core") - - kapt("com.google.dagger:dagger-compiler") + implementation(Libs.AX_APPCOMPAT) + implementation(Libs.AX_LIFECYCLE_EXTENSION) + implementation(Libs.CRASHLYTICS) + implementation(Libs.GLIDE) + implementation(Libs.GLIDE_RECYCLERVIEW) + implementation(Libs.FIREBASE_CORE) + + kapt(Libs.DAGGER_COMPILER) } kapt.useBuildCache = true diff --git a/build.gradle.kts b/build.gradle.kts index 4eb82051a..1ff29d454 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,10 +25,10 @@ buildscript { } dependencies { - classpath("com.android.tools.build:gradle:${Versions.gradle_plugin}") + classpath("com.android.tools.build:gradle:3.6.0-rc01") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}") - classpath("com.google.gms:google-services:${Versions.googleServices}") - classpath("io.fabric.tools:gradle:${Versions.fabric}") + classpath("com.google.gms:google-services:4.3.0") + classpath("io.fabric.tools:gradle:1.28.0") } } diff --git a/buildSrc/src/main/java/Libs.kt b/buildSrc/src/main/java/Libs.kt new file mode 100644 index 000000000..f009cc6a4 --- /dev/null +++ b/buildSrc/src/main/java/Libs.kt @@ -0,0 +1,72 @@ +/* + * Copyright 2020 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 + * + * 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. + */ + +@Suppress("MayBeConstant") // Improve perf when changing values + +object Libs { + val AX_ANNOTATION = "androidx.annotation:annotation:" + val AX_APPCOMPAT = "androidx.appcompat:appcompat:" + val AX_ARCH_CORE_RUNTIME = "androidx.arch.core:core-runtime:" + val AX_BROWSER = "androidx.browser:browser:" + val AX_COLLECTION = "androidx.collection:collection:" + val AX_CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:" + val AX_CORE_COMMON = "androidx.arch.core:core-common:" + val AX_CORE_KTX = "androidx.core:core-ktx:" + val AX_LEGACY_CORE = "androidx.legacy:legacy-support-core-utils:" + val AX_LIFECYCLE_EXTENSION = "androidx.lifecycle:lifecycle-extensions:" + val AX_LIFECYCLE_LIVEDATA = "androidx.lifecycle:lifecycle-livedata-ktx:" + val AX_LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime:" + val AX_LIFECYCLE_VM = "androidx.lifecycle:lifecycle-viewmodel:" + val AX_LIFECYCLE_VM_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx:" + val AX_ROOM_RUNTIME = "androidx.room:room-runtime:" + val AX_ROOM_KTX = "androidx.room:room-ktx:" + val AX_VIEWPAGER2 = "androidx.viewpager2:viewpager2:" + val SUPPORT_CUSTOMTABS = "com.android.support:customtabs:" + val SUPPORT_PALETTE = "com.android.support:palette-v7:" + val SUPPORT_DYN_ANIMATION = "com.android.support:support-dynamic-animation:" + val CRASHLYTICS = "com.crashlytics.sdk.android:crashlytics:" + val GLIDE = "com.github.bumptech.glide:glide:" + val GLIDE_RECYCLERVIEW = "com.github.bumptech.glide:recyclerview-integration:" + val GLIDE_COMPILER = "com.github.bumptech.glide:compiler:" + val GOOGLE_GSON = "com.google.code.gson:gson:" + val FIREBASE_CORE = "com.google.firebase:firebase-core:" + val OKHTTP = "com.squareup.okhttp3:okhttp:" + val OKHTTP_LOGGING = "com.squareup.okhttp3:logging-interceptor:" + val JSOUP = "org.jsoup:jsoup:" + val KOTLIN_STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:" + val KOTLIN_REFLECT = "org.jetbrains.kotlin:kotlin-reflect:" + val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:" + val COROUTINES_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android:" + val MATERIAL = "com.google.android.material:material:" + val DAGGER = "com.google.dagger:dagger:" + val DAGGER_COMPILER = "com.google.dagger:dagger-compiler:" + val RETROFIT = "com.squareup.retrofit2:retrofit:" + val RETROFIT_CONVERTER_GSON = "com.squareup.retrofit2:converter-gson:" + val TEST_CORE = "androidx.arch.core:core-testing:" + val TEST_MOCKITO_KT = "com.nhaarman.mockitokotlin2:mockito-kotlin:" + val TEST_RETROFIT_MOCK = "com.squareup.retrofit2:retrofit-mock:" + val TEST_JUNIT = "junit:junit:" + val TEST_MOCKITO_CORE = "org.mockito:mockito-core:" + val TEST_COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-test:" + val TEST_ESPRESSO_CONTRIB = "androidx.test.espresso:espresso-contrib:" + val TEST_ESPRESSO_CORE = "androidx.test.espresso:espresso-core:" + val TEST_JUNIT_EXT = "androidx.test.ext:junit:" + val TEST_RULES = "androidx.test:rules:" + val TEST_RUNNER = "androidx.test:runner:" + val TEST_UIAUTOMATOR = "androidx.test.uiautomator:uiautomator:" + val TEST_MOCKITO_ANDROID = "org.mockito:mockito-android:" + val GMS_PLAY_SERVICES_GCM = "com.google.android.gms:play-services-gcm:" +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 15068af25..7b40b89c2 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -20,9 +20,6 @@ object Versions { val compileSdk = 29 val targetSdk = 28 val minSdk = 23 - val gradle_plugin = "3.6.0-rc01" - val fabric = "1.28.0" - val googleServices = "4.3.0" val kotlin = "1.3.61" } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index a7574a210..339baf36b 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -21,7 +21,8 @@ plugins { kotlin("kapt") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -74,22 +75,22 @@ dependencies { implementation(project(":bypass")) - implementation("com.google.code.gson:gson") - implementation("androidx.browser:browser") - implementation("androidx.room:room-runtime") - implementation("androidx.constraintlayout:constraintlayout") - implementation("com.android.support:palette-v7") - implementation("com.android.support:support-dynamic-animation") - implementation("com.github.bumptech.glide:glide") - implementation("com.squareup.okhttp3:okhttp") - implementation("com.squareup.okhttp3:logging-interceptor") - implementation("org.jsoup:jsoup") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core") - api("org.jetbrains.kotlinx:kotlinx-coroutines-android") - - kapt("com.github.bumptech.glide:compiler") - kapt("com.github.bumptech.glide:glide") - kapt("com.google.dagger:dagger-compiler") + implementation(Libs.GOOGLE_GSON) + implementation(Libs.AX_BROWSER) + implementation(Libs.AX_ROOM_RUNTIME) + implementation(Libs.AX_CONSTRAINT_LAYOUT) + implementation(Libs.SUPPORT_PALETTE) + implementation(Libs.SUPPORT_DYN_ANIMATION) + implementation(Libs.GLIDE) + implementation(Libs.OKHTTP) + implementation(Libs.OKHTTP_LOGGING) + implementation(Libs.JSOUP) + api(Libs.COROUTINES_CORE) + api(Libs.COROUTINES_ANDROID) + + kapt(Libs.GLIDE_COMPILER) + kapt(Libs.GLIDE) + kapt(Libs.DAGGER_COMPILER) } kapt.useBuildCache = true diff --git a/depconstraints/build.gradle.kts b/depconstraints/build.gradle.kts index 9b09471c8..7577c5600 100644 --- a/depconstraints/build.gradle.kts +++ b/depconstraints/build.gradle.kts @@ -34,7 +34,6 @@ val extJunit = "1.1.0" val fabric = "1.28.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" @@ -54,76 +53,62 @@ val viewPager2 = "1.0.0-beta02" dependencies { constraints { - api("androidx.annotation:annotation:$androidx") - api("androidx.appcompat:appcompat:$appcompat") - api("androidx.arch.core:core-runtime:$androidxCoreRuntime") - api("androidx.browser:browser:$androidx") - api("androidx.collection:collection:$androidxCollection") - api("androidx.constraintlayout:constraintlayout:$constraintLayout") - api("androidx.legacy:legacy-support-core-utils:$legacyCoreUtils") - api("androidx.lifecycle:lifecycle-extensions:$lifecycle") - api("androidx.lifecycle:lifecycle-runtime:$lifecycle") - api("androidx.room:room-runtime:$room") - api("androidx.room:room-ktx:$room") - api("androidx.viewpager2:viewpager2:$viewPager2") - api("com.android.support:customtabs:$supportLibrary") - api("com.android.support:palette-v7:$supportLibrary") - api("com.android.support:support-dynamic-animation:$supportLibrary") - api("com.crashlytics.sdk.android:crashlytics:$crashlytics") - api("com.github.bumptech.glide:glide:$glide") - api("com.github.bumptech.glide:recyclerview-integration:$glide") - api("com.github.bumptech.glide:compiler:$glide") - api("com.google.code.gson:gson:$gson") - api("com.google.firebase:firebase-core:$firebase") - api("com.squareup.okhttp3:okhttp:$okhttp") - api("com.squareup.okhttp3:logging-interceptor:$okhttp") - api("junit:junit:$junit") - api("org.jsoup:jsoup:$jsoup") - api("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}") - api("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}") - api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines") - api("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines") - api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines") + api(Libs.AX_ANNOTATION + androidx) + api(Libs.AX_APPCOMPAT + appcompat) + api(Libs.AX_ARCH_CORE_RUNTIME + androidxCoreRuntime) + api(Libs.AX_CORE_COMMON + androidxCoreRuntime) + api(Libs.AX_CORE_KTX + coreKtx) + api(Libs.AX_BROWSER + androidx) + api(Libs.AX_COLLECTION + androidxCollection) + api(Libs.AX_CONSTRAINT_LAYOUT + constraintLayout) + api(Libs.AX_LEGACY_CORE + legacyCoreUtils) + api(Libs.AX_LIFECYCLE_EXTENSION + lifecycle) + api(Libs.AX_LIFECYCLE_LIVEDATA + lifecycle) + api(Libs.AX_LIFECYCLE_RUNTIME + lifecycle) + api(Libs.AX_LIFECYCLE_VM + lifecycle) + api(Libs.AX_LIFECYCLE_VM_KTX + lifecycle) + api(Libs.AX_ROOM_RUNTIME + room) + api(Libs.AX_ROOM_KTX + room) + api(Libs.AX_VIEWPAGER2 + viewPager2) + api(Libs.COROUTINES_CORE + coroutines) + api(Libs.COROUTINES_ANDROID + coroutines) + api(Libs.CRASHLYTICS + crashlytics) + api(Libs.DAGGER + dagger) + api(Libs.DAGGER_COMPILER + dagger) + api(Libs.GLIDE + glide) + api(Libs.GLIDE_RECYCLERVIEW + glide) + api(Libs.GLIDE_COMPILER + glide) + api(Libs.GOOGLE_GSON + gson) + api(Libs.FIREBASE_CORE + firebase) + api(Libs.JSOUP + jsoup) + api(Libs.KOTLIN_STDLIB + Versions.kotlin) + api(Libs.KOTLIN_REFLECT + Versions.kotlin) + api(Libs.MATERIAL + material) + api(Libs.OKHTTP + okhttp) + api(Libs.OKHTTP_LOGGING + okhttp) + api(Libs.RETROFIT + retrofit) + api(Libs.RETROFIT_CONVERTER_GSON + retrofit) + api(Libs.SUPPORT_CUSTOMTABS + supportLibrary) + api(Libs.SUPPORT_PALETTE + supportLibrary) + api(Libs.SUPPORT_DYN_ANIMATION + supportLibrary) - api("com.google.android.material:material:$material") - api("com.google.dagger:dagger:$dagger") - api("com.google.dagger:dagger-compiler:$dagger") - api("androidx.arch.core:core-common:$androidxCoreRuntime") - api("androidx.arch.core:core-runtime:$androidxCoreRuntime") - api("androidx.core:core-ktx:$coreKtx") - api("com.squareup.retrofit2:retrofit:$retrofit") - api("com.squareup.retrofit2:converter-gson:$retrofit") - api("androidx.lifecycle:lifecycle-viewmodel:$lifecycle") - api("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle") - api("androidx.lifecycle:lifecycle-extensions:$lifecycle") - api("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle") - - api("androidx.arch.core:core-testing:$androidxArch") - api("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin") - api("com.squareup.retrofit2:retrofit-mock:$retrofit") - api("junit:junit:$junit") - api("org.mockito:mockito-core:$mockito") - api("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines") - - api("androidx.arch.core:core-testing:$androidxArch") - api("androidx.legacy:legacy-support-core-utils:$legacyCoreUtils") - api("androidx.lifecycle:lifecycle-runtime:$lifecycle") - - api("androidx.arch.core:core-testing:$androidxArch") - api("androidx.test.espresso:espresso-contrib:$espresso") - api("androidx.test.espresso:espresso-core:$espresso") - api("androidx.test.ext:junit:$extJunit") - api("androidx.test:rules:$test_rules") - api("androidx.test:runner:$test_runner") - api("androidx.test.uiautomator:uiautomator:$ui_automator") - api("com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin") - api("com.squareup.retrofit2:retrofit-mock:$retrofit") - api("org.mockito:mockito-android:$mockito") - api("org.mockito:mockito-core:$mockito") + api(Libs.TEST_CORE + androidxArch) + api(Libs.TEST_COROUTINES + coroutines) + api(Libs.TEST_ESPRESSO_CONTRIB + espresso) + api(Libs.TEST_ESPRESSO_CORE + espresso) + api(Libs.TEST_JUNIT + junit) + api(Libs.TEST_JUNIT_EXT + extJunit) + api(Libs.TEST_MOCKITO_ANDROID + mockito) + api(Libs.TEST_MOCKITO_CORE + mockito) + api(Libs.TEST_MOCKITO_KT + mockito_kotlin) + api(Libs.TEST_RETROFIT_MOCK + retrofit) + api(Libs.TEST_RULES + test_rules) + api(Libs.TEST_RUNNER + test_runner) + api(Libs.TEST_UIAUTOMATOR + ui_automator) // Adding this to bring "google_play_services_version" into the test project // without this, it fails on AGP 3.6.x. - api("com.google.android.gms:play-services-gcm:16.0.0") + api(Libs.GMS_PLAY_SERVICES_GCM + "16.0.0") } } diff --git a/dependencies.gradle.kts b/dependencies.gradle.kts deleted file mode 100644 index f9d5843eb..000000000 --- a/dependencies.gradle.kts +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - * - * 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.kotlin.dsl.dependencies - -// this will try to take configuration from existing ones -val implementation by configurations -val testImplementation by configurations -val androidTestImplementation by configurations -val compile by configurations -val api by configurations -dependencies { - api(platform(project(":depconstraints"))) - - implementation("com.google.android.material:material") - implementation("com.google.dagger:dagger") - implementation("androidx.arch.core:core-common") - implementation("androidx.arch.core:core-runtime") - implementation("androidx.core:core-ktx") - implementation("com.squareup.retrofit2:retrofit") - implementation("com.squareup.retrofit2:converter-gson") - implementation("androidx.lifecycle:lifecycle-viewmodel") - implementation("androidx.lifecycle:lifecycle-livedata-ktx") - implementation("androidx.lifecycle:lifecycle-extensions") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx") - - // Work around issue with runtime classpath version conflict - implementation("androidx.collection:collection") - implementation("androidx.legacy:legacy-support-core-utils") - implementation("androidx.lifecycle:lifecycle-runtime") - - testImplementation(project(":test_shared")) - testImplementation("androidx.arch.core:core-testing") - testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin") - testImplementation("com.squareup.retrofit2:retrofit-mock") - testImplementation("junit:junit") - testImplementation("org.mockito:mockito-core") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") - - // Workaround for dependency conflict during assembleAndroidTest - androidTestImplementation("androidx.arch.core:core-runtime:2.0.1-alpha01") - - // Work around issue with runtime classpath version conflict - androidTestImplementation("androidx.arch.core:core-testing") - androidTestImplementation("androidx.legacy:legacy-support-core-utils") - androidTestImplementation("androidx.lifecycle:lifecycle-runtime:") - - androidTestImplementation(project(":test_shared")) - androidTestImplementation("androidx.arch.core:core-testing") - androidTestImplementation("androidx.test.espresso:espresso-contrib") - androidTestImplementation("androidx.test.espresso:espresso-core") - androidTestImplementation("androidx.test.ext:junit") - androidTestImplementation("androidx.test:rules") - androidTestImplementation("androidx.test:runner") - androidTestImplementation("androidx.test.uiautomator:uiautomator") - androidTestImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin") - androidTestImplementation("com.squareup.retrofit2:retrofit-mock") - androidTestImplementation("org.mockito:mockito-android") - androidTestImplementation("org.mockito:mockito-core") - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - androidTestImplementation("com.google.android.gms:play-services-gcm:16.0.0") -} diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index b5ad57711..51f01b9d0 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -21,7 +21,8 @@ plugins { kotlin("kapt") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -56,11 +57,11 @@ dependencies { implementation(project(":core")) implementation(project(":bypass")) - implementation("androidx.room:room-ktx") - implementation("com.android.support:customtabs") - implementation("com.github.bumptech.glide:glide") + implementation(Libs.AX_ROOM_KTX) + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.GLIDE) - kapt("com.google.dagger:dagger-compiler") + kapt(Libs.DAGGER_COMPILER) } kapt.useBuildCache = true diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 5a2939f27..41eec84f9 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -20,7 +20,8 @@ plugins { kotlin("kapt") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -58,11 +59,11 @@ dependencies { implementation(project(":app")) implementation(project(":core")) - implementation("com.android.support:customtabs") - implementation("com.android.support:palette-v7") - implementation("com.github.bumptech.glide:recyclerview-integration") + implementation(Libs.SUPPORT_CUSTOMTABS) + implementation(Libs.SUPPORT_PALETTE) + implementation(Libs.GLIDE_RECYCLERVIEW) - kapt("com.google.dagger:dagger-compiler") + kapt(Libs.DAGGER_COMPILER) } kapt.useBuildCache = true diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 705d2ebb6..0332df42e 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -20,7 +20,8 @@ plugins { kotlin("kapt") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -53,9 +54,9 @@ dependencies { implementation(project(":app")) implementation(project(":core")) - implementation("com.github.bumptech.glide:recyclerview-integration") - implementation("org.jetbrains.kotlin:kotlin-reflect") - kapt("com.google.dagger:dagger-compiler") + implementation(Libs.GLIDE_RECYCLERVIEW) + implementation(Libs.KOTLIN_REFLECT) + kapt(Libs.DAGGER_COMPILER) } kapt.useBuildCache = true diff --git a/shared_dependencies.gradle.kts b/shared_dependencies.gradle.kts new file mode 100644 index 000000000..7449f9525 --- /dev/null +++ b/shared_dependencies.gradle.kts @@ -0,0 +1,37 @@ +/* + * Copyright 2020 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 + * + * 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.kotlin.dsl.dependencies + +val implementation by configurations +val testImplementation by configurations +val androidTestImplementation by configurations +val compile by configurations +val api by configurations + +dependencies { + api(platform(project(":depconstraints"))) + + implementation(Libs.MATERIAL) + implementation(Libs.DAGGER) + implementation(Libs.AX_CORE_KTX) + implementation(Libs.RETROFIT) + implementation(Libs.RETROFIT_CONVERTER_GSON) + implementation(Libs.AX_LIFECYCLE_VM) + implementation(Libs.AX_LIFECYCLE_LIVEDATA) + implementation(Libs.AX_LIFECYCLE_EXTENSION) + implementation(Libs.AX_LIFECYCLE_VM_KTX) +} diff --git a/test_dependencies.gradle.kts b/test_dependencies.gradle.kts new file mode 100644 index 000000000..6dcaca86a --- /dev/null +++ b/test_dependencies.gradle.kts @@ -0,0 +1,66 @@ +/* + * Copyright 2020 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 + * + * 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.kotlin.dsl.dependencies + +val implementation by configurations +val testImplementation by configurations +val androidTestImplementation by configurations +val compile by configurations +val api by configurations + +dependencies { + api(platform(project(":depconstraints"))) + + testImplementation(project(":test_shared")) + testImplementation(Libs.TEST_CORE) + testImplementation(Libs.TEST_MOCKITO_KT) + testImplementation(Libs.TEST_RETROFIT_MOCK) + testImplementation(Libs.TEST_JUNIT) + testImplementation(Libs.TEST_MOCKITO_CORE) + testImplementation(Libs.TEST_COROUTINES) + + // Work around issue with runtime classpath version conflict + implementation(Libs.AX_CORE_COMMON) + implementation(Libs.AX_ARCH_CORE_RUNTIME) + implementation(Libs.AX_COLLECTION) + implementation(Libs.AX_LEGACY_CORE) + implementation(Libs.AX_LIFECYCLE_RUNTIME) + + // Workaround for dependency conflict during assembleAndroidTest + androidTestImplementation(Libs.AX_ARCH_CORE_RUNTIME + "2.0.1-alpha01") + + // Work around issue with runtime classpath version conflict + androidTestImplementation(Libs.TEST_CORE) + androidTestImplementation(Libs.AX_LEGACY_CORE) + androidTestImplementation(Libs.AX_LIFECYCLE_RUNTIME) + + androidTestImplementation(project(":test_shared")) + androidTestImplementation(Libs.TEST_CORE) + androidTestImplementation(Libs.TEST_ESPRESSO_CONTRIB) + androidTestImplementation(Libs.TEST_ESPRESSO_CORE) + androidTestImplementation(Libs.TEST_JUNIT_EXT) + androidTestImplementation(Libs.TEST_RULES) + androidTestImplementation(Libs.TEST_RUNNER) + androidTestImplementation(Libs.TEST_UIAUTOMATOR) + androidTestImplementation(Libs.TEST_MOCKITO_KT) + androidTestImplementation(Libs.TEST_RETROFIT_MOCK) + androidTestImplementation(Libs.TEST_MOCKITO_ANDROID) + androidTestImplementation(Libs.TEST_MOCKITO_CORE) + // Adding this to bring "google_play_services_version" into the test project + // without this, it fails on AGP 3.6.x. + androidTestImplementation(Libs.GMS_PLAY_SERVICES_GCM + "16.0.0") +} diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index 812f6b56b..1e2cf297a 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -19,7 +19,8 @@ plugins { kotlin("android") } -apply(from = "$rootDir/dependencies.gradle.kts") +apply(from = "$rootDir/shared_dependencies.gradle.kts") +apply(from = "$rootDir/test_dependencies.gradle.kts") android { compileSdkVersion(Versions.compileSdk) @@ -42,9 +43,9 @@ dependencies { implementation(project(":core")) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android") - implementation("junit:junit") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test") + implementation(Libs.KOTLIN_STDLIB) + implementation(Libs.COROUTINES_CORE) + implementation(Libs.COROUTINES_ANDROID) + implementation(Libs.TEST_JUNIT) + implementation(Libs.TEST_COROUTINES) } diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index f0dc51d6b..0d5ce9274 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -41,6 +41,6 @@ dependencies { api(platform(project(":depconstraints"))) implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("androidx.annotation:annotation") - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7") + implementation(Libs.AX_ANNOTATION) + implementation(Libs.KOTLIN_STDLIB) } From 898bd2483e5c26536fe72549ca8bbc6278a3b107 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Wed, 15 Jan 2020 14:44:43 +0000 Subject: [PATCH 19/20] Address PR comments --- about/build.gradle.kts | 6 +- app/build.gradle.kts | 21 +++--- build.gradle.kts | 2 +- buildSrc/src/main/java/Libs.kt | 106 ++++++++++++++------------- buildSrc/src/main/java/Names.kt | 2 +- buildSrc/src/main/java/Versions.kt | 10 ++- core/build.gradle.kts | 6 +- depconstraints/build.gradle.kts | 107 +++++++++++++--------------- designernews/build.gradle.kts | 6 +- dribbble/build.gradle.kts | 8 +-- gradle.properties | 2 +- search/build.gradle.kts | 6 +- shared_dependencies.gradle.kts | 8 +-- test_dependencies.gradle.kts | 18 ++--- test_shared/build.gradle.kts | 6 +- third_party/bypass/build.gradle.kts | 6 +- 16 files changed, 151 insertions(+), 169 deletions(-) diff --git a/about/build.gradle.kts b/about/build.gradle.kts index d842cb8f4..9f95af7f9 100644 --- a/about/build.gradle.kts +++ b/about/build.gradle.kts @@ -24,11 +24,11 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bbff229af..636a358d2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,23 +16,23 @@ plugins { id("com.android.application") + id("com.google.gms.google-services") + id("io.fabric") kotlin("android") id("kotlin-android-extensions") kotlin("kapt") - id("io.fabric") - id("com.google.gms.google-services") } apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - applicationId = Names.applicationId - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + applicationId = Names.APPLICATION_ID + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) versionCode = 100 + (runCmd("git", "rev-list", "--count", "HEAD")?.toIntOrNull() ?: 1) versionName = "1.1.0" @@ -41,9 +41,7 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" resConfig("en") - manifestPlaceholders = mapOf( - "crashlyticsEnabled" to false - ) + manifestPlaceholders = mapOf("crashlyticsEnabled" to false) javaCompileOptions { annotationProcessorOptions { @@ -56,10 +54,9 @@ android { getByName("release") { // There's a Dex Splitter issue when enabling DataBinding & proguard in dynamic features // The temporary workaround is to disable shrinking + // This issue is tracked in: https://issuetracker.google.com/120517460 isMinifyEnabled = false - manifestPlaceholders = mapOf( - "crashlyticsEnabled" to true - ) + manifestPlaceholders = mapOf("crashlyticsEnabled" to true) proguardFiles( getDefaultProguardFile("proguard-android.txt"), diff --git a/build.gradle.kts b/build.gradle.kts index 1ff29d454..a4e349faf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,7 +26,7 @@ buildscript { dependencies { classpath("com.android.tools.build:gradle:3.6.0-rc01") - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}") classpath("com.google.gms:google-services:4.3.0") classpath("io.fabric.tools:gradle:1.28.0") } diff --git a/buildSrc/src/main/java/Libs.kt b/buildSrc/src/main/java/Libs.kt index f009cc6a4..d306053d5 100644 --- a/buildSrc/src/main/java/Libs.kt +++ b/buildSrc/src/main/java/Libs.kt @@ -14,59 +14,57 @@ * limitations under the License. */ -@Suppress("MayBeConstant") // Improve perf when changing values - object Libs { - val AX_ANNOTATION = "androidx.annotation:annotation:" - val AX_APPCOMPAT = "androidx.appcompat:appcompat:" - val AX_ARCH_CORE_RUNTIME = "androidx.arch.core:core-runtime:" - val AX_BROWSER = "androidx.browser:browser:" - val AX_COLLECTION = "androidx.collection:collection:" - val AX_CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:" - val AX_CORE_COMMON = "androidx.arch.core:core-common:" - val AX_CORE_KTX = "androidx.core:core-ktx:" - val AX_LEGACY_CORE = "androidx.legacy:legacy-support-core-utils:" - val AX_LIFECYCLE_EXTENSION = "androidx.lifecycle:lifecycle-extensions:" - val AX_LIFECYCLE_LIVEDATA = "androidx.lifecycle:lifecycle-livedata-ktx:" - val AX_LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime:" - val AX_LIFECYCLE_VM = "androidx.lifecycle:lifecycle-viewmodel:" - val AX_LIFECYCLE_VM_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx:" - val AX_ROOM_RUNTIME = "androidx.room:room-runtime:" - val AX_ROOM_KTX = "androidx.room:room-ktx:" - val AX_VIEWPAGER2 = "androidx.viewpager2:viewpager2:" - val SUPPORT_CUSTOMTABS = "com.android.support:customtabs:" - val SUPPORT_PALETTE = "com.android.support:palette-v7:" - val SUPPORT_DYN_ANIMATION = "com.android.support:support-dynamic-animation:" - val CRASHLYTICS = "com.crashlytics.sdk.android:crashlytics:" - val GLIDE = "com.github.bumptech.glide:glide:" - val GLIDE_RECYCLERVIEW = "com.github.bumptech.glide:recyclerview-integration:" - val GLIDE_COMPILER = "com.github.bumptech.glide:compiler:" - val GOOGLE_GSON = "com.google.code.gson:gson:" - val FIREBASE_CORE = "com.google.firebase:firebase-core:" - val OKHTTP = "com.squareup.okhttp3:okhttp:" - val OKHTTP_LOGGING = "com.squareup.okhttp3:logging-interceptor:" - val JSOUP = "org.jsoup:jsoup:" - val KOTLIN_STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:" - val KOTLIN_REFLECT = "org.jetbrains.kotlin:kotlin-reflect:" - val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core:" - val COROUTINES_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android:" - val MATERIAL = "com.google.android.material:material:" - val DAGGER = "com.google.dagger:dagger:" - val DAGGER_COMPILER = "com.google.dagger:dagger-compiler:" - val RETROFIT = "com.squareup.retrofit2:retrofit:" - val RETROFIT_CONVERTER_GSON = "com.squareup.retrofit2:converter-gson:" - val TEST_CORE = "androidx.arch.core:core-testing:" - val TEST_MOCKITO_KT = "com.nhaarman.mockitokotlin2:mockito-kotlin:" - val TEST_RETROFIT_MOCK = "com.squareup.retrofit2:retrofit-mock:" - val TEST_JUNIT = "junit:junit:" - val TEST_MOCKITO_CORE = "org.mockito:mockito-core:" - val TEST_COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-test:" - val TEST_ESPRESSO_CONTRIB = "androidx.test.espresso:espresso-contrib:" - val TEST_ESPRESSO_CORE = "androidx.test.espresso:espresso-core:" - val TEST_JUNIT_EXT = "androidx.test.ext:junit:" - val TEST_RULES = "androidx.test:rules:" - val TEST_RUNNER = "androidx.test:runner:" - val TEST_UIAUTOMATOR = "androidx.test.uiautomator:uiautomator:" - val TEST_MOCKITO_ANDROID = "org.mockito:mockito-android:" - val GMS_PLAY_SERVICES_GCM = "com.google.android.gms:play-services-gcm:" + const val AX_ANNOTATION = "androidx.annotation:annotation" + const val AX_APPCOMPAT = "androidx.appcompat:appcompat" + const val AX_ARCH_CORE_RUNTIME = "androidx.arch.core:core-runtime" + const val AX_BROWSER = "androidx.browser:browser" + const val AX_COLLECTION = "androidx.collection:collection" + const val AX_CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout" + const val AX_CORE_COMMON = "androidx.arch.core:core-common" + const val AX_CORE_KTX = "androidx.core:core-ktx" + const val AX_LEGACY_CORE = "androidx.legacy:legacy-support-core-utils" + const val AX_LIFECYCLE_EXTENSION = "androidx.lifecycle:lifecycle-extensions" + const val AX_LIFECYCLE_LIVEDATA = "androidx.lifecycle:lifecycle-livedata-ktx" + const val AX_LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime" + const val AX_LIFECYCLE_VM = "androidx.lifecycle:lifecycle-viewmodel" + const val AX_LIFECYCLE_VM_KTX = "androidx.lifecycle:lifecycle-viewmodel-ktx" + const val AX_ROOM_RUNTIME = "androidx.room:room-runtime" + const val AX_ROOM_KTX = "androidx.room:room-ktx" + const val AX_VIEWPAGER2 = "androidx.viewpager2:viewpager2" + const val COROUTINES_CORE = "org.jetbrains.kotlinx:kotlinx-coroutines-core" + const val COROUTINES_ANDROID = "org.jetbrains.kotlinx:kotlinx-coroutines-android" + const val CRASHLYTICS = "com.crashlytics.sdk.android:crashlytics" + const val DAGGER = "com.google.dagger:dagger" + const val DAGGER_COMPILER = "com.google.dagger:dagger-compiler" + const val GLIDE = "com.github.bumptech.glide:glide" + const val GLIDE_RECYCLERVIEW = "com.github.bumptech.glide:recyclerview-integration" + const val GLIDE_COMPILER = "com.github.bumptech.glide:compiler" + const val GMS_PLAY_SERVICES_GCM = "com.google.android.gms:play-services-gcm" + const val GOOGLE_GSON = "com.google.code.gson:gson" + const val FIREBASE_CORE = "com.google.firebase:firebase-core" + const val OKHTTP = "com.squareup.okhttp3:okhttp" + const val OKHTTP_LOGGING = "com.squareup.okhttp3:logging-interceptor" + const val JSOUP = "org.jsoup:jsoup" + const val KOTLIN_STDLIB = "org.jetbrains.kotlin:kotlin-stdlib-jdk7" + const val KOTLIN_REFLECT = "org.jetbrains.kotlin:kotlin-reflect" + const val MATERIAL = "com.google.android.material:material" + const val RETROFIT = "com.squareup.retrofit2:retrofit" + const val RETROFIT_CONVERTER_GSON = "com.squareup.retrofit2:converter-gson" + const val SUPPORT_CUSTOMTABS = "com.android.support:customtabs" + const val SUPPORT_DYN_ANIMATION = "com.android.support:support-dynamic-animation" + const val SUPPORT_PALETTE = "com.android.support:palette-v7" + const val TEST_AX_ESPRESSO_CONTRIB = "androidx.test.espresso:espresso-contrib" + const val TEST_AX_ESPRESSO_CORE = "androidx.test.espresso:espresso-core" + const val TEST_AX_JUNIT_EXT = "androidx.test.ext:junit" + const val TEST_AX_RULES = "androidx.test:rules" + const val TEST_AX_RUNNER = "androidx.test:runner" + const val TEST_AX_UIAUTOMATOR = "androidx.test.uiautomator:uiautomator" + const val TEST_CORE = "androidx.arch.core:core-testing" + const val TEST_COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-test" + const val TEST_JUNIT = "junit:junit" + const val TEST_MOCKITO_ANDROID = "org.mockito:mockito-android" + const val TEST_MOCKITO_CORE = "org.mockito:mockito-core" + const val TEST_MOCKITO_KT = "com.nhaarman.mockitokotlin2:mockito-kotlin" + const val TEST_RETROFIT_MOCK = "com.squareup.retrofit2:retrofit-mock" } diff --git a/buildSrc/src/main/java/Names.kt b/buildSrc/src/main/java/Names.kt index ba8993bc5..bb9f69647 100644 --- a/buildSrc/src/main/java/Names.kt +++ b/buildSrc/src/main/java/Names.kt @@ -15,5 +15,5 @@ */ object Names { - val applicationId = "io.plaidapp" + const val APPLICATION_ID = "io.plaidapp" } diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 7b40b89c2..775577b4d 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -14,12 +14,10 @@ * limitations under the License. */ -@Suppress("MayBeConstant") // Improve perf when changing values - object Versions { - val compileSdk = 29 - val targetSdk = 28 - val minSdk = 23 + const val COMPILE_SDK = 29 + const val TARGET_SDK = 28 + const val MIN_SDK = 23 - val kotlin = "1.3.61" + const val KOTLIN = "1.3.61" } diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 339baf36b..77080dd6d 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -25,11 +25,11 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/depconstraints/build.gradle.kts b/depconstraints/build.gradle.kts index 7577c5600..c465306eb 100644 --- a/depconstraints/build.gradle.kts +++ b/depconstraints/build.gradle.kts @@ -53,62 +53,57 @@ val viewPager2 = "1.0.0-beta02" dependencies { constraints { - api(Libs.AX_ANNOTATION + androidx) - api(Libs.AX_APPCOMPAT + appcompat) - api(Libs.AX_ARCH_CORE_RUNTIME + androidxCoreRuntime) - api(Libs.AX_CORE_COMMON + androidxCoreRuntime) - api(Libs.AX_CORE_KTX + coreKtx) - api(Libs.AX_BROWSER + androidx) - api(Libs.AX_COLLECTION + androidxCollection) - api(Libs.AX_CONSTRAINT_LAYOUT + constraintLayout) - api(Libs.AX_LEGACY_CORE + legacyCoreUtils) - api(Libs.AX_LIFECYCLE_EXTENSION + lifecycle) - api(Libs.AX_LIFECYCLE_LIVEDATA + lifecycle) - api(Libs.AX_LIFECYCLE_RUNTIME + lifecycle) - api(Libs.AX_LIFECYCLE_VM + lifecycle) - api(Libs.AX_LIFECYCLE_VM_KTX + lifecycle) - api(Libs.AX_ROOM_RUNTIME + room) - api(Libs.AX_ROOM_KTX + room) - api(Libs.AX_VIEWPAGER2 + viewPager2) - api(Libs.COROUTINES_CORE + coroutines) - api(Libs.COROUTINES_ANDROID + coroutines) - api(Libs.CRASHLYTICS + crashlytics) - api(Libs.DAGGER + dagger) - api(Libs.DAGGER_COMPILER + dagger) - api(Libs.GLIDE + glide) - api(Libs.GLIDE_RECYCLERVIEW + glide) - api(Libs.GLIDE_COMPILER + glide) - api(Libs.GOOGLE_GSON + gson) - api(Libs.FIREBASE_CORE + firebase) - api(Libs.JSOUP + jsoup) - api(Libs.KOTLIN_STDLIB + Versions.kotlin) - api(Libs.KOTLIN_REFLECT + Versions.kotlin) - api(Libs.MATERIAL + material) - api(Libs.OKHTTP + okhttp) - api(Libs.OKHTTP_LOGGING + okhttp) - api(Libs.RETROFIT + retrofit) - api(Libs.RETROFIT_CONVERTER_GSON + retrofit) - api(Libs.SUPPORT_CUSTOMTABS + supportLibrary) - api(Libs.SUPPORT_PALETTE + supportLibrary) - api(Libs.SUPPORT_DYN_ANIMATION + supportLibrary) - - api(Libs.TEST_CORE + androidxArch) - api(Libs.TEST_COROUTINES + coroutines) - api(Libs.TEST_ESPRESSO_CONTRIB + espresso) - api(Libs.TEST_ESPRESSO_CORE + espresso) - api(Libs.TEST_JUNIT + junit) - api(Libs.TEST_JUNIT_EXT + extJunit) - api(Libs.TEST_MOCKITO_ANDROID + mockito) - api(Libs.TEST_MOCKITO_CORE + mockito) - api(Libs.TEST_MOCKITO_KT + mockito_kotlin) - api(Libs.TEST_RETROFIT_MOCK + retrofit) - api(Libs.TEST_RULES + test_rules) - api(Libs.TEST_RUNNER + test_runner) - api(Libs.TEST_UIAUTOMATOR + ui_automator) - - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - api(Libs.GMS_PLAY_SERVICES_GCM + "16.0.0") + api("${Libs.AX_ANNOTATION}:$androidx") + api("${Libs.AX_APPCOMPAT}:$appcompat") + api("${Libs.AX_ARCH_CORE_RUNTIME}:$androidxCoreRuntime") + api("${Libs.AX_CORE_COMMON}:$androidxCoreRuntime") + api("${Libs.AX_CORE_KTX}:$coreKtx") + api("${Libs.AX_BROWSER}:$androidx") + api("${Libs.AX_COLLECTION}:$androidxCollection") + api("${Libs.AX_CONSTRAINT_LAYOUT}:$constraintLayout") + api("${Libs.AX_LEGACY_CORE}:$legacyCoreUtils") + api("${Libs.AX_LIFECYCLE_EXTENSION}:$lifecycle") + api("${Libs.AX_LIFECYCLE_LIVEDATA}:$lifecycle") + api("${Libs.AX_LIFECYCLE_RUNTIME}:$lifecycle") + api("${Libs.AX_LIFECYCLE_VM}:$lifecycle") + api("${Libs.AX_LIFECYCLE_VM_KTX}:$lifecycle") + api("${Libs.AX_ROOM_RUNTIME}:$room") + api("${Libs.AX_ROOM_KTX}:$room") + api("${Libs.AX_VIEWPAGER2}:$viewPager2") + api("${Libs.COROUTINES_CORE}:$coroutines") + api("${Libs.COROUTINES_ANDROID}:$coroutines") + api("${Libs.CRASHLYTICS}:$crashlytics") + api("${Libs.DAGGER}:$dagger") + api("${Libs.DAGGER_COMPILER}:$dagger") + api("${Libs.GLIDE}:$glide") + api("${Libs.GLIDE_RECYCLERVIEW}:$glide") + api("${Libs.GLIDE_COMPILER}:$glide") + api("${Libs.GOOGLE_GSON}:$gson") + api("${Libs.FIREBASE_CORE}:$firebase") + api("${Libs.JSOUP}:$jsoup") + api("${Libs.KOTLIN_STDLIB}:${Versions.KOTLIN}") + api("${Libs.KOTLIN_REFLECT}:${Versions.KOTLIN}") + api("${Libs.MATERIAL}:$material") + api("${Libs.OKHTTP}:$okhttp") + api("${Libs.OKHTTP_LOGGING}:$okhttp") + api("${Libs.RETROFIT}:$retrofit") + api("${Libs.RETROFIT_CONVERTER_GSON}:$retrofit") + api("${Libs.SUPPORT_CUSTOMTABS}:$supportLibrary") + api("${Libs.SUPPORT_PALETTE}:$supportLibrary") + api("${Libs.SUPPORT_DYN_ANIMATION}:$supportLibrary") + api("${Libs.TEST_CORE}:$androidxArch") + api("${Libs.TEST_COROUTINES}:$coroutines") + api("${Libs.TEST_AX_ESPRESSO_CONTRIB}:$espresso") + api("${Libs.TEST_AX_ESPRESSO_CORE}:$espresso") + api("${Libs.TEST_JUNIT}:$junit") + api("${Libs.TEST_AX_JUNIT_EXT}:$extJunit") + api("${Libs.TEST_MOCKITO_ANDROID}:$mockito") + api("${Libs.TEST_MOCKITO_CORE}:$mockito") + api("${Libs.TEST_MOCKITO_KT}:$mockito_kotlin") + api("${Libs.TEST_RETROFIT_MOCK}:$retrofit") + api("${Libs.TEST_AX_RULES}:$test_rules") + api("${Libs.TEST_AX_RUNNER}:$test_runner") + api("${Libs.TEST_AX_UIAUTOMATOR}:$ui_automator") } } diff --git a/designernews/build.gradle.kts b/designernews/build.gradle.kts index 51f01b9d0..408932ca8 100644 --- a/designernews/build.gradle.kts +++ b/designernews/build.gradle.kts @@ -25,11 +25,11 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) resConfig("en") testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" diff --git a/dribbble/build.gradle.kts b/dribbble/build.gradle.kts index 41eec84f9..b53bcde22 100644 --- a/dribbble/build.gradle.kts +++ b/dribbble/build.gradle.kts @@ -24,13 +24,13 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) - val filesAuthorityValue = Names.applicationId + ".shareprovider" + val filesAuthorityValue = Names.APPLICATION_ID + ".shareprovider" buildConfigField("String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\"") manifestPlaceholders = mapOf( diff --git a/gradle.properties b/gradle.properties index e60cce0f9..37cf742a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ designer_news_client_secret = "" # Product Hunt API product_hunt_developer_token = "" android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true diff --git a/search/build.gradle.kts b/search/build.gradle.kts index 0332df42e..642eae5b9 100644 --- a/search/build.gradle.kts +++ b/search/build.gradle.kts @@ -24,11 +24,11 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) javaCompileOptions { annotationProcessorOptions { diff --git a/shared_dependencies.gradle.kts b/shared_dependencies.gradle.kts index 7449f9525..6f8b67577 100644 --- a/shared_dependencies.gradle.kts +++ b/shared_dependencies.gradle.kts @@ -25,13 +25,13 @@ val api by configurations dependencies { api(platform(project(":depconstraints"))) - implementation(Libs.MATERIAL) - implementation(Libs.DAGGER) implementation(Libs.AX_CORE_KTX) - implementation(Libs.RETROFIT) - implementation(Libs.RETROFIT_CONVERTER_GSON) implementation(Libs.AX_LIFECYCLE_VM) implementation(Libs.AX_LIFECYCLE_LIVEDATA) implementation(Libs.AX_LIFECYCLE_EXTENSION) implementation(Libs.AX_LIFECYCLE_VM_KTX) + implementation(Libs.DAGGER) + implementation(Libs.MATERIAL) + implementation(Libs.RETROFIT) + implementation(Libs.RETROFIT_CONVERTER_GSON) } diff --git a/test_dependencies.gradle.kts b/test_dependencies.gradle.kts index 6dcaca86a..2e62a366e 100644 --- a/test_dependencies.gradle.kts +++ b/test_dependencies.gradle.kts @@ -40,9 +40,6 @@ dependencies { implementation(Libs.AX_LEGACY_CORE) implementation(Libs.AX_LIFECYCLE_RUNTIME) - // Workaround for dependency conflict during assembleAndroidTest - androidTestImplementation(Libs.AX_ARCH_CORE_RUNTIME + "2.0.1-alpha01") - // Work around issue with runtime classpath version conflict androidTestImplementation(Libs.TEST_CORE) androidTestImplementation(Libs.AX_LEGACY_CORE) @@ -50,17 +47,14 @@ dependencies { androidTestImplementation(project(":test_shared")) androidTestImplementation(Libs.TEST_CORE) - androidTestImplementation(Libs.TEST_ESPRESSO_CONTRIB) - androidTestImplementation(Libs.TEST_ESPRESSO_CORE) - androidTestImplementation(Libs.TEST_JUNIT_EXT) - androidTestImplementation(Libs.TEST_RULES) - androidTestImplementation(Libs.TEST_RUNNER) - androidTestImplementation(Libs.TEST_UIAUTOMATOR) + androidTestImplementation(Libs.TEST_AX_ESPRESSO_CONTRIB) + androidTestImplementation(Libs.TEST_AX_ESPRESSO_CORE) + androidTestImplementation(Libs.TEST_AX_JUNIT_EXT) + androidTestImplementation(Libs.TEST_AX_RULES) + androidTestImplementation(Libs.TEST_AX_RUNNER) + androidTestImplementation(Libs.TEST_AX_UIAUTOMATOR) androidTestImplementation(Libs.TEST_MOCKITO_KT) androidTestImplementation(Libs.TEST_RETROFIT_MOCK) androidTestImplementation(Libs.TEST_MOCKITO_ANDROID) androidTestImplementation(Libs.TEST_MOCKITO_CORE) - // Adding this to bring "google_play_services_version" into the test project - // without this, it fails on AGP 3.6.x. - androidTestImplementation(Libs.GMS_PLAY_SERVICES_GCM + "16.0.0") } diff --git a/test_shared/build.gradle.kts b/test_shared/build.gradle.kts index 1e2cf297a..ef34ba413 100644 --- a/test_shared/build.gradle.kts +++ b/test_shared/build.gradle.kts @@ -23,11 +23,11 @@ apply(from = "$rootDir/shared_dependencies.gradle.kts") apply(from = "$rootDir/test_dependencies.gradle.kts") android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/third_party/bypass/build.gradle.kts b/third_party/bypass/build.gradle.kts index 0d5ce9274..3765a37b5 100644 --- a/third_party/bypass/build.gradle.kts +++ b/third_party/bypass/build.gradle.kts @@ -20,11 +20,11 @@ plugins { } android { - compileSdkVersion(Versions.compileSdk) + compileSdkVersion(Versions.COMPILE_SDK) defaultConfig { - minSdkVersion(Versions.minSdk) - targetSdkVersion(Versions.targetSdk) + minSdkVersion(Versions.MIN_SDK) + targetSdkVersion(Versions.TARGET_SDK) versionCode = 1 versionName = "1.0" } From f66882ecf34fbafc0d50355b1cb6a3bb25c100e6 Mon Sep 17 00:00:00 2001 From: Pietro Maggi Date: Wed, 15 Jan 2020 14:52:19 +0000 Subject: [PATCH 20/20] Address comments from the PR. --- buildSrc/src/main/java/AddCommonRepositories.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/buildSrc/src/main/java/AddCommonRepositories.kt b/buildSrc/src/main/java/AddCommonRepositories.kt index f51fcd3b9..43939ba6e 100644 --- a/buildSrc/src/main/java/AddCommonRepositories.kt +++ b/buildSrc/src/main/java/AddCommonRepositories.kt @@ -70,10 +70,8 @@ fun RepositoryHandler.addCommonRepositories() { includeGroup("org.sonatype.oss") includeGroup("org.xerial") includeGroup("net.ltgt.gradle.incap") - includeGroup("de.undercouch") includeGroup("org.jdom") - excludeGroup("com.google.firebase") excludeGroup("com.google.android.gms") excludeGroup("com.google.android.material")