Fix build.gradle.kts

Fixed build.gradle.kts, added versions plugin to the whole project.
This commit is contained in:
Adolfo Santiago 2021-11-13 17:36:37 +01:00
parent 05531fa6f2
commit 609fb301dc
No known key found for this signature in database
GPG key ID: 244D6F9A317B4A65
6 changed files with 260 additions and 255 deletions

1
.gitattributes vendored
View file

@ -7,4 +7,5 @@
# Denote all files that are truly binary and should not be modified. # Denote all files that are truly binary and should not be modified.
*.png binary *.png binary
*.jpg binary
*.jar binary *.jar binary

View file

@ -1,12 +1,10 @@
plugins { plugins {
id("com.android.application") id(AppPlugins.androidApplication)
kotlin("android") kotlin(AppPlugins.androidBase)
id("kotlin-android-extensions") kotlin(AppPlugins.kapt)
kotlin("kapt") id(AppPlugins.kotlinExtensions)
// id(AppPlugins.kotlinParcelize)
//id("kotlin-parcelize")
id("com.github.ben-manes.versions")
} }
android { android {
@ -69,6 +67,7 @@ android {
ProguardFile.defaultRules ProguardFile.defaultRules
) )
} }
}
flavorDimensions.addAll( flavorDimensions.addAll(
listOf( listOf(
@ -84,12 +83,6 @@ android {
create(Flavors.beta) { create(Flavors.beta) {
dimension = Flavors.Dimensions.release dimension = Flavors.Dimensions.release
/*
versionCode = BetaConfig.versionCodeBeta
versionName = BetaConfig.versionNameBeta
applicationIdSuffix = BetaConfig.betaSufix
*/
versionNameSuffix = "-${BetaConfig.betaSufix}${BetaConfig.betaSufixVersion}" versionNameSuffix = "-${BetaConfig.betaSufix}${BetaConfig.betaSufixVersion}"
buildConfigField( buildConfigField(
@ -155,7 +148,6 @@ android {
enableSplit = true enableSplit = true
} }
} }
}
} }
dependencies { dependencies {

View file

@ -10,6 +10,7 @@ buildscript {
// Plugins // Plugins
classpath(GradlePlugins.gradleVersions) classpath(GradlePlugins.gradleVersions)
classpath(GradlePlugins.spotless)
} }
} }
@ -27,6 +28,8 @@ allprojects {
) )
} }
apply(plugin = AppPlugins.manesVersions)
tasks.withType<DependencyUpdatesTask> { tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = "current" gradleReleaseChannel = "current"
@ -37,8 +40,6 @@ allprojects {
} }
tasks.register<Delete>(BuildTasks.taskTypeClean) { tasks.register<Delete>(BuildTasks.taskTypeClean) {
delete(rootProject.buildDir)
delete(project.buildDir)
delete(buildDir) delete(buildDir)
delete("${projectDir}/buildSrc/build") delete("${projectDir}/buildSrc/build")
} }

View file

@ -1,5 +1,14 @@
object ApplicationLibs { object AppPlugins {
const val androidApplication = "com.android.application"
const val androidBase = "android"
const val kapt = "kapt"
const val kotlinExtensions = "kotlin-android-extensions"
const val kotlinParcelize = "kotlin-parcelize"
const val manesVersions = "com.github.ben-manes.versions"
const val spotless = "com.diffplug.gradle.spotless"
}
object ApplicationLibs {
private object Versions { private object Versions {
const val androidImageCropper = "2.8.0" const val androidImageCropper = "2.8.0"
const val appcompat = "1.2.0" const val appcompat = "1.2.0"
@ -7,31 +16,31 @@ object ApplicationLibs {
const val bigImageViewer = "1.7.0" const val bigImageViewer = "1.7.0"
const val browser = "1.3.0" const val browser = "1.3.0"
const val cardView = "1.0.0" const val cardView = "1.0.0"
const val conscryptAndroid = "2.5.1" const val conscryptAndroid = "2.5.2"
const val constraintlayout = "2.1.0" const val constraintlayout = "2.1.1"
const val coreKtx = "1.3.2" const val coreKtx = "1.3.2"
const val dagger = "2.38.1" const val dagger = "2.38.1"
const val emoji = "1.1.0" const val emoji = "1.1.0"
const val exifInterface = "1.3.2" const val exifInterface = "1.3.2"
const val exoplayer = "2.15.0" const val exoplayer = "2.16.0"
const val filemojiCompat = "1.0.17" const val filemojiCompat = "1.0.17"
const val flexbox = "2.0.1" const val flexbox = "2.0.1"
const val fragmentKtx = "1.2.5" const val fragmentKtx = "1.2.5"
const val glide = "4.11.0" const val glide = "4.12.0"
const val glideImage = "1.8.0" const val glideImage = "1.8.0"
const val lifecycle = "2.2.0" const val lifecycle = "2.4.0"
const val markdownEdit = "1.0.0" const val markdownEdit = "1.0.0"
const val materialDesign = "1.4.0" const val materialDesign = "1.4.0"
const val materialDrawer = "8.2.0" const val materialDrawer = "8.2.0"
const val materialDrawerTypeface = "3.0.1.4.original-kotlin@aar" const val materialDrawerTypeface = "3.0.1.4.original-kotlin@aar"
const val pagingRuntimeKtx = "2.1.2" const val pagingRuntimeKtx = "2.1.2"
const val preferenceKtx = "1.1.1" const val preferenceKtx = "1.1.1"
const val okhttpVersion = "4.9.0" const val okhttpVersion = "4.9.2"
const val recyclerView = "1.1.0" const val recyclerView = "1.2.1"
const val retrofit = "2.9.0" const val retrofit = "2.9.0"
const val room = "2.2.5" const val room = "2.2.5"
const val rxAndroid = "2.1.1" const val rxAndroid = "2.1.1"
const val rxJava = "2.2.20" const val rxJava = "2.2.21"
const val rxKotlin = "2.4.0" const val rxKotlin = "2.4.0"
const val shareTarget = "1.0.0" const val shareTarget = "1.0.0"
const val simplestack = "2.6.2" const val simplestack = "2.6.2"
@ -148,3 +157,18 @@ object ApplicationLibs {
const val sparkButton = "com.github.connyduck:sparkbutton:${Versions.sparkButton}" const val sparkButton = "com.github.connyduck:sparkbutton:${Versions.sparkButton}"
const val timber = "com.jakewharton.timber:timber:${Versions.timber}" const val timber = "com.jakewharton.timber:timber:${Versions.timber}"
} }
object GradlePlugins {
object Versions {
const val gradle = "7.0.3"
const val gradleVersions = "0.39.0"
const val spotless = "6.0.0"
}
const val android = "com.android.tools.build:gradle:${Versions.gradle}"
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
const val gradleVersions =
"com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersions}"
const val spotless =
"com.diffplug.spotless:spotless-plugin-gradle:${Versions.spotless}"
}

View file

@ -35,8 +35,6 @@ object DefaultConfig {
object BetaConfig { object BetaConfig {
const val betaSufix = "beta" const val betaSufix = "beta"
const val betaSufixVersion = "1" const val betaSufixVersion = "1"
const val versionCodeBeta = 1
const val versionNameBeta = "1.0.2"
} }
object BuildTypes { object BuildTypes {
@ -64,28 +62,17 @@ object BuildTasks {
const val taskTypeClean = "clean" const val taskTypeClean = "clean"
} }
object GradlePlugins {
object Versions {
const val gradle = "7.0.2"
const val gradleVersions = "0.38.0"
}
const val android = "com.android.tools.build:gradle:${Versions.gradle}"
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
const val gradleVersions =
"com.github.ben-manes:gradle-versions-plugin:${Versions.gradleVersions}"
}
// Function to add repositories to the project. // Function to add repositories to the project.
fun addRepos(handler: RepositoryHandler) { fun addRepos(handler: RepositoryHandler) {
handler.google() handler.google()
handler.maven(url = "https://jitpack.io")
handler.gradlePluginPortal() handler.gradlePluginPortal()
handler.maven(url = "https://jitpack.io")
handler.maven(url = "https://plugins.gradle.org/m2/")
} }
// Function to check stable versions // Function to check stable versions
fun isNonStable(version: String): Boolean { fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("alpha", "beta", "final", "ga", "m", "release", "rc") val stableKeyword = listOf("a", "alpha", "beta", "final", "ga", "m", "release", "rc")
.any { version.toLowerCase(Locale.ROOT).contains(it) } .any { version.toLowerCase(Locale.ROOT).contains(it) }
return stableKeyword.not() return stableKeyword.not()
} }

View file

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME