From 4b1a36ebd231358135b5edba42a05580e63e3968 Mon Sep 17 00:00:00 2001 From: Jean-Michel Fayard Date: Mon, 8 Oct 2018 10:53:02 +0200 Subject: [PATCH 1/4] Refactor some build logic to the buildSrc & gradle kotlin-dsl Files buildSrc/src/main/java/{Versions.kt,Libs.kt} are generated with the task $ ./gradlew syncLibs Signed-off-by: Jean-Michel Fayard --- app/build.gradle | 50 ++++----- build.gradle | 43 +++----- buildSrc/.gitignore | 2 + buildSrc/build.gradle.kts | 8 ++ buildSrc/src/main/java/Config.kt | 6 ++ buildSrc/src/main/java/Libs.kt | 162 +++++++++++++++++++++++++++++ buildSrc/src/main/java/Versions.kt | 93 +++++++++++++++++ 7 files changed, 309 insertions(+), 55 deletions(-) create mode 100644 buildSrc/.gitignore create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/java/Config.kt create mode 100644 buildSrc/src/main/java/Libs.kt create mode 100644 buildSrc/src/main/java/Versions.kt diff --git a/app/build.gradle b/app/build.gradle index a13dac6eb..79305a007 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,14 +21,14 @@ apply plugin: 'kotlin-kapt' apply plugin: 'androidx.navigation.safeargs' android { - compileSdkVersion rootProject.compileSdkVersion + compileSdkVersion Config.compileSdkVersion dataBinding { enabled = true } defaultConfig { applicationId "com.google.samples.apps.sunflower" - minSdkVersion rootProject.minSdkVersion - targetSdkVersion rootProject.targetSdkVersion + minSdkVersion Config.minSdkVersion + targetSdkVersion Config.targetSdkVersion testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" versionCode 1 versionName "0.1.5" @@ -47,28 +47,28 @@ android { } dependencies { - kapt "androidx.room:room-compiler:$rootProject.roomVersion" - kapt "com.github.bumptech.glide:compiler:$rootProject.glideVersion" - implementation "android.arch.navigation:navigation-fragment-ktx:$rootProject.navigationVersion" - implementation "android.arch.navigation:navigation-ui-ktx:$rootProject.navigationVersion" - implementation "android.arch.work:work-runtime-ktx:$rootProject.workVersion" - implementation "androidx.appcompat:appcompat:$rootProject.supportLibraryVersion" - implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion" - implementation "androidx.core:core-ktx:$rootProject.ktxVersion" - implementation "androidx.legacy:legacy-support-v4:$rootProject.supportLibraryVersion" - implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion" - implementation "androidx.recyclerview:recyclerview:$rootProject.supportLibraryVersion" - implementation "androidx.room:room-runtime:$rootProject.roomVersion" - implementation "com.github.bumptech.glide:glide:$rootProject.glideVersion" - implementation "com.google.android.material:material:$rootProject.supportLibraryVersion" - implementation "com.google.code.gson:gson:$rootProject.gsonVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.kotlinVersion" + kapt Libs.room_compiler + kapt Libs.com_github_bumptech_glide_compiler + implementation Libs.navigation_fragment_ktx + implementation Libs.navigation_ui_ktx + implementation Libs.work_runtime_ktx + implementation Libs.appcompat + implementation Libs.constraintlayout + implementation Libs.core_ktx + implementation Libs.legacy_support_v4 + implementation Libs.lifecycle_extensions + implementation Libs.recyclerview + implementation Libs.room_runtime + implementation Libs.glide + implementation Libs.material + implementation Libs.gson + implementation Libs.kotlin_stdlib_jdk8 // Testing dependencies - androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion" - androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espressoVersion" - androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion" - androidTestImplementation "androidx.test.espresso:espresso-intents:$rootProject.espressoVersion" - androidTestImplementation "androidx.test.uiautomator:uiautomator:$rootProject.uiAutomatorVersion" - testImplementation "junit:junit:$rootProject.junitVersion" + androidTestImplementation Libs.core_testing // room + androidTestImplementation Libs.espresso_contrib + androidTestImplementation Libs.espresso_core + androidTestImplementation Libs.espresso_intents + androidTestImplementation Libs.uiautomator + testImplementation Libs.junit } diff --git a/build.gradle b/build.gradle index e9566701e..2b53b94fa 100644 --- a/build.gradle +++ b/build.gradle @@ -14,33 +14,15 @@ * limitations under the License. */ -buildscript { - // Define versions in a single place - ext { - // Sdk and tools - compileSdkVersion = 28 - minSdkVersion = 19 - targetSdkVersion = 28 +/** +* Part of the build logic has been moved to the buildSrc directory +* Versions are defined in buildSrc/src/main/java/Versions.kt +* Libraries are defined in buildSrc/src/main/java/Libs.kt +* Other configurations are defined in buildSrc/src/main/java/Config.kt +*/ - // App dependencies - constraintLayoutVersion = '2.0.0-alpha2' - coreTestingVersion = '2.0.0' - espressoVersion = '3.1.0-alpha4' - glideVersion = '4.8.0' - gradleVersion = '3.2.0' - gsonVersion = '2.8.2' - junitVersion = '4.12' - kotlinVersion = '1.3.0-rc-116' - ktlintVersion = '0.28.0' - ktxVersion = '1.0.0' - lifecycleVersion = '2.0.0' - navigationVersion = '1.0.0-alpha06' - roomVersion = '2.0.0' - runnerVersion = '1.0.1' - supportLibraryVersion = '1.0.0' - uiAutomatorVersion = '2.2.0-alpha4' - workVersion = '1.0.0-alpha09' - } + +buildscript { repositories { google() @@ -49,13 +31,14 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:$gradleVersion" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion" + classpath "com.android.tools.build:gradle:" + Versions.gradle + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:" + Versions.kotlin_gradle_plugin + classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:" + Versions.navigation_safe_args_gradle_plugin } } plugins { + id("jmfayard.github.io.gradle-kotlin-dsl-libs") version "0.2.2" // $ gw syncLibs id "com.diffplug.gradle.spotless" version "3.13.0" } @@ -70,6 +53,6 @@ allprojects { spotless { kotlin { target "**/*.kt" - ktlint(ktlintVersion) + ktlint(Config.ktlintVersion) } } diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore new file mode 100644 index 000000000..aaec5b8a3 --- /dev/null +++ b/buildSrc/.gitignore @@ -0,0 +1,2 @@ +/build +.gradle/ \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..3bdb70389 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,8 @@ + +plugins { + `kotlin-dsl` +} +repositories { + jcenter() +} + \ No newline at end of file diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt new file mode 100644 index 000000000..d11112af4 --- /dev/null +++ b/buildSrc/src/main/java/Config.kt @@ -0,0 +1,6 @@ +object Config { + const val compileSdkVersion = 28 + const val minSdkVersion = 19 + const val targetSdkVersion = 28 + const val ktlintVersion = "0.28.0" +} \ No newline at end of file diff --git a/buildSrc/src/main/java/Libs.kt b/buildSrc/src/main/java/Libs.kt new file mode 100644 index 000000000..e032ed779 --- /dev/null +++ b/buildSrc/src/main/java/Libs.kt @@ -0,0 +1,162 @@ +import kotlin.String + +/** + * Generated by [gradle-kotlin-dsl-libs](https://github.com/jmfayard/gradle-kotlin-dsl-libs) + * + * Run again + * `$ ./gradlew syncLibs` + * to update this file */ +object Libs { + /** + * [aapt2 website](https://developer.android.com/studio) */ + const val aapt2: String = "com.android.tools.build:aapt2:" + Versions.aapt2 + + /** + * [appcompat website](http://developer.android.com/tools/extras/support-library.html) */ + const val appcompat: String = "androidx.appcompat:appcompat:" + Versions.appcompat + + const val com_diffplug_gradle_spotless_gradle_plugin: String = + "com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:" + Versions.com_diffplug_gradle_spotless_gradle_plugin + + /** + * [compiler website](https://github.com/bumptech/glide) */ + const val com_github_bumptech_glide_compiler: String = + "com.github.bumptech.glide:compiler:" + Versions.com_github_bumptech_glide_compiler + + /** + * [constraintlayout website](http://tools.android.com) */ + const val constraintlayout: String = + "androidx.constraintlayout:constraintlayout:" + Versions.constraintlayout + + /** + * [core-ktx website](http://developer.android.com/tools/extras/support-library.html) */ + const val core_ktx: String = "androidx.core:core-ktx:" + Versions.core_ktx + + /** + * [core-testing website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val core_testing: String = "androidx.arch.core:core-testing:" + Versions.core_testing + + const val databinding_adapters: String = + "androidx.databinding:databinding-adapters:" + Versions.databinding_adapters + + /** + * [databinding-common website](https://developer.android.com/studio) */ + const val databinding_common: String = + "androidx.databinding:databinding-common:" + Versions.databinding_common + + /** + * [databinding-compiler website](https://developer.android.com/studio) */ + const val databinding_compiler: String = + "androidx.databinding:databinding-compiler:" + Versions.databinding_compiler + + const val databinding_runtime: String = + "androidx.databinding:databinding-runtime:" + Versions.databinding_runtime + + /** + * [espresso-contrib website](https://developer.android.com/testing) */ + const val espresso_contrib: String = + "androidx.test.espresso:espresso-contrib:" + Versions.espresso_contrib + + /** + * [espresso-core website](https://developer.android.com/testing) */ + const val espresso_core: String = + "androidx.test.espresso:espresso-core:" + Versions.espresso_core + + /** + * [espresso-intents website](https://developer.android.com/testing) */ + const val espresso_intents: String = + "androidx.test.espresso:espresso-intents:" + Versions.espresso_intents + + /** + * [glide website](https://github.com/bumptech/glide) */ + const val glide: String = "com.github.bumptech.glide:glide:" + Versions.glide + + /** + * [gradle website](https://developer.android.com/studio) */ + const val gradle: String = "com.android.tools.build:gradle:" + Versions.gradle + + /** + * [gson website](https://github.com/google/gson) */ + const val gson: String = "com.google.code.gson:gson:" + Versions.gson + + const val jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin: String = + "jmfayard.github.io.gradle-kotlin-dsl-libs:jmfayard.github.io.gradle-kotlin-dsl-libs.gradle.plugin:" + Versions.jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin + + /** + * [junit website](http://junit.org) */ + const val junit: String = "junit:junit:" + Versions.junit + + /** + * [kotlin-android-extensions website](https://kotlinlang.org/) */ + const val kotlin_android_extensions: String = + "org.jetbrains.kotlin:kotlin-android-extensions:" + Versions.kotlin_android_extensions + + /** + * [kotlin-annotation-processing-gradle website](https://kotlinlang.org/) */ + const val kotlin_annotation_processing_gradle: String = + "org.jetbrains.kotlin:kotlin-annotation-processing-gradle:" + Versions.kotlin_annotation_processing_gradle + + /** + * [kotlin-gradle-plugin website](https://kotlinlang.org/) */ + const val kotlin_gradle_plugin: String = + "org.jetbrains.kotlin:kotlin-gradle-plugin:" + Versions.kotlin_gradle_plugin + + /** + * [kotlin-stdlib-jdk8 website](https://kotlinlang.org/) */ + const val kotlin_stdlib_jdk8: String = + "org.jetbrains.kotlin:kotlin-stdlib-jdk8:" + Versions.kotlin_stdlib_jdk8 + + /** + * [legacy-support-v4 website](http://developer.android.com/tools/extras/support-library.html) */ + const val legacy_support_v4: String = + "androidx.legacy:legacy-support-v4:" + Versions.legacy_support_v4 + + /** + * [lifecycle-extensions website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val lifecycle_extensions: String = + "androidx.lifecycle:lifecycle-extensions:" + Versions.lifecycle_extensions + + /** + * [lint-gradle website](https://developer.android.com/studio) */ + const val lint_gradle: String = "com.android.tools.lint:lint-gradle:" + Versions.lint_gradle + + /** + * [material website](http://developer.android.com/tools/extras/support-library.html) */ + const val material: String = "com.google.android.material:material:" + Versions.material + + /** + * [navigation-fragment-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val navigation_fragment_ktx: String = + "android.arch.navigation:navigation-fragment-ktx:" + Versions.navigation_fragment_ktx + + /** + * [navigation-safe-args-gradle-plugin website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val navigation_safe_args_gradle_plugin: String = + "android.arch.navigation:navigation-safe-args-gradle-plugin:" + Versions.navigation_safe_args_gradle_plugin + + /** + * [navigation-ui-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val navigation_ui_ktx: String = + "android.arch.navigation:navigation-ui-ktx:" + Versions.navigation_ui_ktx + + /** + * [recyclerview website](http://developer.android.com/tools/extras/support-library.html) */ + const val recyclerview: String = "androidx.recyclerview:recyclerview:" + Versions.recyclerview + + /** + * [room-compiler website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val room_compiler: String = "androidx.room:room-compiler:" + Versions.room_compiler + + /** + * [room-runtime website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val room_runtime: String = "androidx.room:room-runtime:" + Versions.room_runtime + + /** + * [uiautomator website](https://developer.android.com/testing) */ + const val uiautomator: String = "androidx.test.uiautomator:uiautomator:" + Versions.uiautomator + + /** + * [work-runtime-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ + const val work_runtime_ktx: String = + "android.arch.work:work-runtime-ktx:" + Versions.work_runtime_ktx +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt new file mode 100644 index 000000000..20a74c2d1 --- /dev/null +++ b/buildSrc/src/main/java/Versions.kt @@ -0,0 +1,93 @@ +import kotlin.String + +/** + * Generated by [gradle-kotlin-dsl-libs](https://github.com/jmfayard/gradle-kotlin-dsl-libs) + * + * Run again + * `$ ./gradlew syncLibs` + * to update this file */ +object Versions { + const val aapt2: String = "3.2.0-4818971" // available: milestone=3.3.0-alpha13-5013011 + + const val appcompat: String = "1.0.0" // up-to-date + + const val com_diffplug_gradle_spotless_gradle_plugin: String = + "3.13.0" // available: milestone=3.15.0 + + const val com_github_bumptech_glide_compiler: String = "4.8.0" // up-to-date + + const val constraintlayout: String = "2.0.0-alpha2" // up-to-date + + const val core_ktx: String = "1.0.0" // up-to-date + + const val core_testing: String = "2.0.0" // up-to-date + + const val databinding_adapters: String = "3.2.0" // available: milestone=3.3.0-alpha13 + + const val databinding_common: String = "3.2.0" // available: milestone=3.3.0-alpha13 + + const val databinding_compiler: String = "3.2.0" // available: milestone=3.3.0-alpha13 + + const val databinding_runtime: String = "3.2.0" // available: milestone=3.3.0-alpha13 + + const val espresso_contrib: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 + + const val espresso_core: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 + + const val espresso_intents: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 + + const val glide: String = "4.8.0" // up-to-date + + const val gradle: String = "3.2.0" // available: milestone=3.3.0-alpha13 + + const val gson: String = "2.8.2" // available: milestone=2.8.5 + + const val jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin: String = + "0.2.2" // exceed the version found: 0.2.1 + + const val junit: String = "4.12" // up-to-date + + const val kotlin_android_extensions: String = + "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 + + const val kotlin_annotation_processing_gradle: String = + "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 + + const val kotlin_gradle_plugin: String = "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 + + const val kotlin_stdlib_jdk8: String = "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 + + const val legacy_support_v4: String = "1.0.0" // up-to-date + + const val lifecycle_extensions: String = "2.0.0" // up-to-date + + const val lint_gradle: String = "26.2.0" // available: milestone=26.3.0-alpha13 + + const val material: String = "1.0.0" // up-to-date + + const val navigation_fragment_ktx: String = "1.0.0-alpha06" // up-to-date + + const val navigation_safe_args_gradle_plugin: String = "1.0.0-alpha06" // up-to-date + + const val navigation_ui_ktx: String = "1.0.0-alpha06" // up-to-date + + const val recyclerview: String = "1.0.0" // up-to-date + + const val room_compiler: String = "2.0.0" // up-to-date + + const val room_runtime: String = "2.0.0" // up-to-date + + const val uiautomator: String = "2.2.0-alpha4" // available: milestone=2.2.0-beta01 + + const val work_runtime_ktx: String = "1.0.0-alpha09" // up-to-date + + object Gradle { + const val runningVersion: String = "4.10" + + const val currentVersion: String = "4.10.2" + + const val nightlyVersion: String = "5.0-20181007235844+0000" + + const val releaseCandidate: String = "" + } +} From 054516671a92efccda3cf6f26a2d75d51839489d Mon Sep 17 00:00:00 2001 From: Jean-Michel Fayard Date: Mon, 15 Oct 2018 17:57:24 +0200 Subject: [PATCH 2/4] Update to gradle-kotlin-dsl-libs 0.2.3 Got feedback from the gradle team that it's better to sue buildSrc/src/main/kotlin Signed-off-by: Jean-Michel Fayard --- build.gradle | 2 +- buildSrc/src/main/java/Config.kt | 6 -- buildSrc/src/main/java/Libs.kt | 162 ----------------------------- buildSrc/src/main/java/Versions.kt | 93 ----------------- 4 files changed, 1 insertion(+), 262 deletions(-) delete mode 100644 buildSrc/src/main/java/Config.kt delete mode 100644 buildSrc/src/main/java/Libs.kt delete mode 100644 buildSrc/src/main/java/Versions.kt diff --git a/build.gradle b/build.gradle index 2b53b94fa..905a71925 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ buildscript { } plugins { - id("jmfayard.github.io.gradle-kotlin-dsl-libs") version "0.2.2" // $ gw syncLibs + id("jmfayard.github.io.gradle-kotlin-dsl-libs") version "0.2.3" // $ gw syncLibs id "com.diffplug.gradle.spotless" version "3.13.0" } diff --git a/buildSrc/src/main/java/Config.kt b/buildSrc/src/main/java/Config.kt deleted file mode 100644 index d11112af4..000000000 --- a/buildSrc/src/main/java/Config.kt +++ /dev/null @@ -1,6 +0,0 @@ -object Config { - const val compileSdkVersion = 28 - const val minSdkVersion = 19 - const val targetSdkVersion = 28 - const val ktlintVersion = "0.28.0" -} \ No newline at end of file diff --git a/buildSrc/src/main/java/Libs.kt b/buildSrc/src/main/java/Libs.kt deleted file mode 100644 index e032ed779..000000000 --- a/buildSrc/src/main/java/Libs.kt +++ /dev/null @@ -1,162 +0,0 @@ -import kotlin.String - -/** - * Generated by [gradle-kotlin-dsl-libs](https://github.com/jmfayard/gradle-kotlin-dsl-libs) - * - * Run again - * `$ ./gradlew syncLibs` - * to update this file */ -object Libs { - /** - * [aapt2 website](https://developer.android.com/studio) */ - const val aapt2: String = "com.android.tools.build:aapt2:" + Versions.aapt2 - - /** - * [appcompat website](http://developer.android.com/tools/extras/support-library.html) */ - const val appcompat: String = "androidx.appcompat:appcompat:" + Versions.appcompat - - const val com_diffplug_gradle_spotless_gradle_plugin: String = - "com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:" + Versions.com_diffplug_gradle_spotless_gradle_plugin - - /** - * [compiler website](https://github.com/bumptech/glide) */ - const val com_github_bumptech_glide_compiler: String = - "com.github.bumptech.glide:compiler:" + Versions.com_github_bumptech_glide_compiler - - /** - * [constraintlayout website](http://tools.android.com) */ - const val constraintlayout: String = - "androidx.constraintlayout:constraintlayout:" + Versions.constraintlayout - - /** - * [core-ktx website](http://developer.android.com/tools/extras/support-library.html) */ - const val core_ktx: String = "androidx.core:core-ktx:" + Versions.core_ktx - - /** - * [core-testing website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val core_testing: String = "androidx.arch.core:core-testing:" + Versions.core_testing - - const val databinding_adapters: String = - "androidx.databinding:databinding-adapters:" + Versions.databinding_adapters - - /** - * [databinding-common website](https://developer.android.com/studio) */ - const val databinding_common: String = - "androidx.databinding:databinding-common:" + Versions.databinding_common - - /** - * [databinding-compiler website](https://developer.android.com/studio) */ - const val databinding_compiler: String = - "androidx.databinding:databinding-compiler:" + Versions.databinding_compiler - - const val databinding_runtime: String = - "androidx.databinding:databinding-runtime:" + Versions.databinding_runtime - - /** - * [espresso-contrib website](https://developer.android.com/testing) */ - const val espresso_contrib: String = - "androidx.test.espresso:espresso-contrib:" + Versions.espresso_contrib - - /** - * [espresso-core website](https://developer.android.com/testing) */ - const val espresso_core: String = - "androidx.test.espresso:espresso-core:" + Versions.espresso_core - - /** - * [espresso-intents website](https://developer.android.com/testing) */ - const val espresso_intents: String = - "androidx.test.espresso:espresso-intents:" + Versions.espresso_intents - - /** - * [glide website](https://github.com/bumptech/glide) */ - const val glide: String = "com.github.bumptech.glide:glide:" + Versions.glide - - /** - * [gradle website](https://developer.android.com/studio) */ - const val gradle: String = "com.android.tools.build:gradle:" + Versions.gradle - - /** - * [gson website](https://github.com/google/gson) */ - const val gson: String = "com.google.code.gson:gson:" + Versions.gson - - const val jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin: String = - "jmfayard.github.io.gradle-kotlin-dsl-libs:jmfayard.github.io.gradle-kotlin-dsl-libs.gradle.plugin:" + Versions.jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin - - /** - * [junit website](http://junit.org) */ - const val junit: String = "junit:junit:" + Versions.junit - - /** - * [kotlin-android-extensions website](https://kotlinlang.org/) */ - const val kotlin_android_extensions: String = - "org.jetbrains.kotlin:kotlin-android-extensions:" + Versions.kotlin_android_extensions - - /** - * [kotlin-annotation-processing-gradle website](https://kotlinlang.org/) */ - const val kotlin_annotation_processing_gradle: String = - "org.jetbrains.kotlin:kotlin-annotation-processing-gradle:" + Versions.kotlin_annotation_processing_gradle - - /** - * [kotlin-gradle-plugin website](https://kotlinlang.org/) */ - const val kotlin_gradle_plugin: String = - "org.jetbrains.kotlin:kotlin-gradle-plugin:" + Versions.kotlin_gradle_plugin - - /** - * [kotlin-stdlib-jdk8 website](https://kotlinlang.org/) */ - const val kotlin_stdlib_jdk8: String = - "org.jetbrains.kotlin:kotlin-stdlib-jdk8:" + Versions.kotlin_stdlib_jdk8 - - /** - * [legacy-support-v4 website](http://developer.android.com/tools/extras/support-library.html) */ - const val legacy_support_v4: String = - "androidx.legacy:legacy-support-v4:" + Versions.legacy_support_v4 - - /** - * [lifecycle-extensions website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val lifecycle_extensions: String = - "androidx.lifecycle:lifecycle-extensions:" + Versions.lifecycle_extensions - - /** - * [lint-gradle website](https://developer.android.com/studio) */ - const val lint_gradle: String = "com.android.tools.lint:lint-gradle:" + Versions.lint_gradle - - /** - * [material website](http://developer.android.com/tools/extras/support-library.html) */ - const val material: String = "com.google.android.material:material:" + Versions.material - - /** - * [navigation-fragment-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val navigation_fragment_ktx: String = - "android.arch.navigation:navigation-fragment-ktx:" + Versions.navigation_fragment_ktx - - /** - * [navigation-safe-args-gradle-plugin website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val navigation_safe_args_gradle_plugin: String = - "android.arch.navigation:navigation-safe-args-gradle-plugin:" + Versions.navigation_safe_args_gradle_plugin - - /** - * [navigation-ui-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val navigation_ui_ktx: String = - "android.arch.navigation:navigation-ui-ktx:" + Versions.navigation_ui_ktx - - /** - * [recyclerview website](http://developer.android.com/tools/extras/support-library.html) */ - const val recyclerview: String = "androidx.recyclerview:recyclerview:" + Versions.recyclerview - - /** - * [room-compiler website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val room_compiler: String = "androidx.room:room-compiler:" + Versions.room_compiler - - /** - * [room-runtime website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val room_runtime: String = "androidx.room:room-runtime:" + Versions.room_runtime - - /** - * [uiautomator website](https://developer.android.com/testing) */ - const val uiautomator: String = "androidx.test.uiautomator:uiautomator:" + Versions.uiautomator - - /** - * [work-runtime-ktx website](https://developer.android.com/topic/libraries/architecture/index.html) */ - const val work_runtime_ktx: String = - "android.arch.work:work-runtime-ktx:" + Versions.work_runtime_ktx -} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt deleted file mode 100644 index 20a74c2d1..000000000 --- a/buildSrc/src/main/java/Versions.kt +++ /dev/null @@ -1,93 +0,0 @@ -import kotlin.String - -/** - * Generated by [gradle-kotlin-dsl-libs](https://github.com/jmfayard/gradle-kotlin-dsl-libs) - * - * Run again - * `$ ./gradlew syncLibs` - * to update this file */ -object Versions { - const val aapt2: String = "3.2.0-4818971" // available: milestone=3.3.0-alpha13-5013011 - - const val appcompat: String = "1.0.0" // up-to-date - - const val com_diffplug_gradle_spotless_gradle_plugin: String = - "3.13.0" // available: milestone=3.15.0 - - const val com_github_bumptech_glide_compiler: String = "4.8.0" // up-to-date - - const val constraintlayout: String = "2.0.0-alpha2" // up-to-date - - const val core_ktx: String = "1.0.0" // up-to-date - - const val core_testing: String = "2.0.0" // up-to-date - - const val databinding_adapters: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val databinding_common: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val databinding_compiler: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val databinding_runtime: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val espresso_contrib: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 - - const val espresso_core: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 - - const val espresso_intents: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta01 - - const val glide: String = "4.8.0" // up-to-date - - const val gradle: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val gson: String = "2.8.2" // available: milestone=2.8.5 - - const val jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin: String = - "0.2.2" // exceed the version found: 0.2.1 - - const val junit: String = "4.12" // up-to-date - - const val kotlin_android_extensions: String = - "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 - - const val kotlin_annotation_processing_gradle: String = - "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 - - const val kotlin_gradle_plugin: String = "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 - - const val kotlin_stdlib_jdk8: String = "1.3.0-rc-116" // available: milestone=1.3.0-rc-146 - - const val legacy_support_v4: String = "1.0.0" // up-to-date - - const val lifecycle_extensions: String = "2.0.0" // up-to-date - - const val lint_gradle: String = "26.2.0" // available: milestone=26.3.0-alpha13 - - const val material: String = "1.0.0" // up-to-date - - const val navigation_fragment_ktx: String = "1.0.0-alpha06" // up-to-date - - const val navigation_safe_args_gradle_plugin: String = "1.0.0-alpha06" // up-to-date - - const val navigation_ui_ktx: String = "1.0.0-alpha06" // up-to-date - - const val recyclerview: String = "1.0.0" // up-to-date - - const val room_compiler: String = "2.0.0" // up-to-date - - const val room_runtime: String = "2.0.0" // up-to-date - - const val uiautomator: String = "2.2.0-alpha4" // available: milestone=2.2.0-beta01 - - const val work_runtime_ktx: String = "1.0.0-alpha09" // up-to-date - - object Gradle { - const val runningVersion: String = "4.10" - - const val currentVersion: String = "4.10.2" - - const val nightlyVersion: String = "5.0-20181007235844+0000" - - const val releaseCandidate: String = "" - } -} From 310913f4bfc3e0ecf87271c31160708d38e82474 Mon Sep 17 00:00:00 2001 From: Jean-Michel Fayard Date: Tue, 16 Oct 2018 11:16:19 +0200 Subject: [PATCH 3/4] Update to gradle-kotlin-dsl-libs 0.2.4 Signed-off-by: Jean-Michel Fayard --- build.gradle | 4 +-- buildSrc/src/main/kotlin/Config.kt | 6 +++- buildSrc/src/main/kotlin/Libs.kt | 9 +++--- buildSrc/src/main/kotlin/Versions.kt | 44 ++++++++++++++++------------ 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 905a71925..596d80a43 100644 --- a/build.gradle +++ b/build.gradle @@ -31,14 +31,14 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:" + Versions.gradle + classpath "com.android.tools.build:gradle:" + Versions.com_android_tools_build_gradle classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:" + Versions.kotlin_gradle_plugin classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:" + Versions.navigation_safe_args_gradle_plugin } } plugins { - id("jmfayard.github.io.gradle-kotlin-dsl-libs") version "0.2.3" // $ gw syncLibs + id("jmfayard.github.io.gradle-kotlin-dsl-libs") version "0.2.4" // $ gw syncLibs id "com.diffplug.gradle.spotless" version "3.13.0" } diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index b57c36c93..7e79b6593 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -3,4 +3,8 @@ object Config { const val minSdkVersion = 19 const val targetSdkVersion = 28 const val ktlintVersion = "0.29.0" -} \ No newline at end of file +} + + +const val com_diffplug_gradle_spotless_gradle_plugin: String = + "3.13.0" // available milestone: "3.15.0" \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt index e032ed779..548a67964 100644 --- a/buildSrc/src/main/kotlin/Libs.kt +++ b/buildSrc/src/main/kotlin/Libs.kt @@ -15,6 +15,11 @@ object Libs { * [appcompat website](http://developer.android.com/tools/extras/support-library.html) */ const val appcompat: String = "androidx.appcompat:appcompat:" + Versions.appcompat + /** + * [gradle website](https://developer.android.com/studio) */ + const val com_android_tools_build_gradle: String = + "com.android.tools.build:gradle:" + Versions.com_android_tools_build_gradle + const val com_diffplug_gradle_spotless_gradle_plugin: String = "com.diffplug.gradle.spotless:com.diffplug.gradle.spotless.gradle.plugin:" + Versions.com_diffplug_gradle_spotless_gradle_plugin @@ -71,10 +76,6 @@ object Libs { * [glide website](https://github.com/bumptech/glide) */ const val glide: String = "com.github.bumptech.glide:glide:" + Versions.glide - /** - * [gradle website](https://developer.android.com/studio) */ - const val gradle: String = "com.android.tools.build:gradle:" + Versions.gradle - /** * [gson website](https://github.com/google/gson) */ const val gson: String = "com.google.code.gson:gson:" + Versions.gson diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index cc0039a1b..4500205a8 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -7,12 +7,15 @@ import kotlin.String * `$ ./gradlew syncLibs` * to update this file */ object Versions { - const val aapt2: String = "3.2.0-4818971" // available: milestone=3.3.0-alpha13-5013011 + const val aapt2: String = "3.2.0-4818971" // available milestone: "3.3.0-alpha13-5013011" const val appcompat: String = "1.0.0" // up-to-date + const val com_android_tools_build_gradle: String = + "3.2.0" // available milestone: "3.3.0-alpha13" + const val com_diffplug_gradle_spotless_gradle_plugin: String = - "3.13.0" // available: milestone=3.15.0 + "3.13.0" // available milestone: "3.15.0" const val com_github_bumptech_glide_compiler: String = "4.8.0" // up-to-date @@ -22,28 +25,26 @@ object Versions { const val core_testing: String = "2.0.0" // up-to-date - const val databinding_adapters: String = "3.2.0" // available: milestone=3.3.0-alpha13 + const val databinding_adapters: String = "3.2.0" // available milestone: "3.3.0-alpha13" - const val databinding_common: String = "3.2.0" // available: milestone=3.3.0-alpha13 + const val databinding_common: String = "3.2.0" // available milestone: "3.3.0-alpha13" - const val databinding_compiler: String = "3.2.0" // available: milestone=3.3.0-alpha13 + const val databinding_compiler: String = "3.2.0" // available milestone: "3.3.0-alpha13" - const val databinding_runtime: String = "3.2.0" // available: milestone=3.3.0-alpha13 + const val databinding_runtime: String = "3.2.0" // available milestone: "3.3.0-alpha13" - const val espresso_contrib: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta02 + const val espresso_contrib: String = "3.1.0-alpha4" // available milestone: "3.1.0-beta02" - const val espresso_core: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta02 + const val espresso_core: String = "3.1.0-alpha4" // available milestone: "3.1.0-beta02" - const val espresso_intents: String = "3.1.0-alpha4" // available: milestone=3.1.0-beta02 + const val espresso_intents: String = "3.1.0-alpha4" // available milestone: "3.1.0-beta02" const val glide: String = "4.8.0" // up-to-date - const val gradle: String = "3.2.0" // available: milestone=3.3.0-alpha13 - - const val gson: String = "2.8.2" // available: milestone=2.8.5 + const val gson: String = "2.8.2" // available milestone: "2.8.5" const val jmfayard_github_io_gradle_kotlin_dsl_libs_gradle_plugin: String = - "0.2.3" // up-to-date + "0.2.4" // exceed the version found: 0.2.3 const val junit: String = "4.12" // up-to-date @@ -59,7 +60,7 @@ object Versions { const val lifecycle_extensions: String = "2.0.0" // up-to-date - const val lint_gradle: String = "26.2.0" // available: milestone=26.3.0-alpha13 + const val lint_gradle: String = "26.2.0" // available milestone: "26.3.0-alpha13" const val material: String = "1.0.0" // up-to-date @@ -71,20 +72,25 @@ object Versions { const val recyclerview: String = "1.0.0" // up-to-date - const val room_compiler: String = "2.0.0" // available: milestone=2.1.0-alpha01 + const val room_compiler: String = "2.0.0" // available milestone: "2.1.0-alpha01" - const val room_runtime: String = "2.0.0" // available: milestone=2.1.0-alpha01 + const val room_runtime: String = "2.0.0" // available milestone: "2.1.0-alpha01" - const val uiautomator: String = "2.2.0-alpha4" // available: milestone=2.2.0-beta02 + const val uiautomator: String = "2.2.0-alpha4" // available milestone: "2.2.0-beta02" - const val work_runtime_ktx: String = "1.0.0-alpha09" // available: milestone=1.0.0-alpha10 + const val work_runtime_ktx: String = "1.0.0-alpha09" // available milestone: "1.0.0-alpha10" + /** + * + * To update Gradle, edit the wrapper file at path: + * ./gradle/wrapper/gradle-wrapper.properties + */ object Gradle { const val runningVersion: String = "4.10" const val currentVersion: String = "4.10.2" - const val nightlyVersion: String = "5.1-20181015142955+0000" + const val nightlyVersion: String = "5.1-20181015235836+0000" const val releaseCandidate: String = "" } From 3cb56980731b1308d452358b408c4deaf958b0ac Mon Sep 17 00:00:00 2001 From: Jean-Michel Fayard Date: Tue, 16 Oct 2018 11:54:05 +0200 Subject: [PATCH 4/4] gradlew spotlessApply --- buildSrc/src/main/kotlin/Config.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt index 7e79b6593..2b5d2659e 100644 --- a/buildSrc/src/main/kotlin/Config.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -5,6 +5,5 @@ object Config { const val ktlintVersion = "0.29.0" } - const val com_diffplug_gradle_spotless_gradle_plugin: String = "3.13.0" // available milestone: "3.15.0" \ No newline at end of file