Skip to content

Commit

Permalink
Adopt the Java Platform plugin to share dependencies versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmaggi committed Jan 3, 2020
1 parent d416128 commit e5da487
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 101 deletions.
8 changes: 5 additions & 3 deletions about/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down
14 changes: 8 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
}
Expand Down
29 changes: 0 additions & 29 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
27 changes: 15 additions & 12 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
134 changes: 134 additions & 0 deletions depconstraints/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<MavenPublication>("JavaPlatform") {
from(components["javaPlatform"])
}
}
}
70 changes: 36 additions & 34 deletions dependencies.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 5 additions & 3 deletions designernews/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down
8 changes: 5 additions & 3 deletions dribbble/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
}
Expand Down
Loading

0 comments on commit e5da487

Please sign in to comment.