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,91 +67,85 @@ android {
ProguardFile.defaultRules ProguardFile.defaultRules
) )
} }
}
flavorDimensions.addAll( flavorDimensions.addAll(
listOf(
Flavors.Dimensions.husky,
Flavors.Dimensions.release
)
)
productFlavors {
create(Flavors.husky) {
dimension = Flavors.Dimensions.husky
}
create(Flavors.beta) {
dimension = Flavors.Dimensions.release
versionNameSuffix = "-${BetaConfig.betaSufix}${BetaConfig.betaSufixVersion}"
buildConfigField(
"String",
"APPLICATION_NAME",
"\"${CustomHuskyBuild.applicationName} Beta\""
)
}
create(Flavors.stable) {
dimension = Flavors.Dimensions.release
}
}
lint {
// isAbortOnError = true
disable("MissingTranslation")
disable("ExtraTranslation")
disable("AppCompatCustomView")
disable("UseRequireInsteadOfGet")
}
compileOptions {
sourceCompatibility = DefaultConfig.javaVersion
targetCompatibility = DefaultConfig.javaVersion
}
kotlinOptions {
jvmTarget = DefaultConfig.javaVersion.toString()
}
buildFeatures {
viewBinding = true
}
// TODO: remove this, only for compiling
androidExtensions {
isExperimental = true
}
testOptions {
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
}
sourceSets {
getByName("androidTest").assets.srcDirs("$projectDir/schemas")
}
packagingOptions {
resources.excludes.addAll(
listOf( listOf(
Flavors.Dimensions.husky, "LICENSE_OFL",
Flavors.Dimensions.release "LICENSE_UNICODE"
) )
) )
productFlavors { }
create(Flavors.husky) {
dimension = Flavors.Dimensions.husky
}
create(Flavors.beta) { bundle {
dimension = Flavors.Dimensions.release language {
enableSplit = true
/*
versionCode = BetaConfig.versionCodeBeta
versionName = BetaConfig.versionNameBeta
applicationIdSuffix = BetaConfig.betaSufix
*/
versionNameSuffix = "-${BetaConfig.betaSufix}${BetaConfig.betaSufixVersion}"
buildConfigField(
"String",
"APPLICATION_NAME",
"\"${CustomHuskyBuild.applicationName} Beta\""
)
}
create(Flavors.stable) {
dimension = Flavors.Dimensions.release
}
}
lint {
// isAbortOnError = true
disable("MissingTranslation")
disable("ExtraTranslation")
disable("AppCompatCustomView")
disable("UseRequireInsteadOfGet")
}
compileOptions {
sourceCompatibility = DefaultConfig.javaVersion
targetCompatibility = DefaultConfig.javaVersion
}
kotlinOptions {
jvmTarget = DefaultConfig.javaVersion.toString()
}
buildFeatures {
viewBinding = true
}
// TODO: remove this, only for compiling
androidExtensions {
isExperimental = true
}
testOptions {
unitTests {
isReturnDefaultValues = true
isIncludeAndroidResources = true
}
}
sourceSets {
getByName("androidTest").assets.srcDirs("$projectDir/schemas")
}
packagingOptions {
resources.excludes.addAll(
listOf(
"LICENSE_OFL",
"LICENSE_UNICODE"
)
)
}
bundle {
language {
enableSplit = true
}
} }
} }
} }

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,150 +1,174 @@
object ApplicationLibs { object AppPlugins {
const val androidApplication = "com.android.application"
private object Versions { const val androidBase = "android"
const val androidImageCropper = "2.8.0" const val kapt = "kapt"
const val appcompat = "1.2.0" const val kotlinExtensions = "kotlin-android-extensions"
const val autodispose = "1.4.0" const val kotlinParcelize = "kotlin-parcelize"
const val bigImageViewer = "1.7.0" const val manesVersions = "com.github.ben-manes.versions"
const val browser = "1.3.0" const val spotless = "com.diffplug.gradle.spotless"
const val cardView = "1.0.0" }
const val conscryptAndroid = "2.5.1"
const val constraintlayout = "2.1.0" object ApplicationLibs {
const val coreKtx = "1.3.2" private object Versions {
const val dagger = "2.38.1" const val androidImageCropper = "2.8.0"
const val emoji = "1.1.0" const val appcompat = "1.2.0"
const val exifInterface = "1.3.2" const val autodispose = "1.4.0"
const val exoplayer = "2.15.0" const val bigImageViewer = "1.7.0"
const val filemojiCompat = "1.0.17" const val browser = "1.3.0"
const val flexbox = "2.0.1" const val cardView = "1.0.0"
const val fragmentKtx = "1.2.5" const val conscryptAndroid = "2.5.2"
const val glide = "4.11.0" const val constraintlayout = "2.1.1"
const val glideImage = "1.8.0" const val coreKtx = "1.3.2"
const val lifecycle = "2.2.0" const val dagger = "2.38.1"
const val markdownEdit = "1.0.0" const val emoji = "1.1.0"
const val materialDesign = "1.4.0" const val exifInterface = "1.3.2"
const val materialDrawer = "8.2.0" const val exoplayer = "2.16.0"
const val materialDrawerTypeface = "3.0.1.4.original-kotlin@aar" const val filemojiCompat = "1.0.17"
const val pagingRuntimeKtx = "2.1.2" const val flexbox = "2.0.1"
const val preferenceKtx = "1.1.1" const val fragmentKtx = "1.2.5"
const val okhttpVersion = "4.9.0" const val glide = "4.12.0"
const val recyclerView = "1.1.0" const val glideImage = "1.8.0"
const val retrofit = "2.9.0" const val lifecycle = "2.4.0"
const val room = "2.2.5" const val markdownEdit = "1.0.0"
const val rxAndroid = "2.1.1" const val materialDesign = "1.4.0"
const val rxJava = "2.2.20" const val materialDrawer = "8.2.0"
const val rxKotlin = "2.4.0" const val materialDrawerTypeface = "3.0.1.4.original-kotlin@aar"
const val shareTarget = "1.0.0" const val pagingRuntimeKtx = "2.1.2"
const val simplestack = "2.6.2" const val preferenceKtx = "1.1.1"
const val simplestackExt = "2.2.2" const val okhttpVersion = "4.9.2"
const val sparkButton = "4.1.0" const val recyclerView = "1.2.1"
const val swipeRefreshLayout = "1.1.0" const val retrofit = "2.9.0"
const val timber = "5.0.1" const val room = "2.2.5"
const val viewpager2 = "1.0.0" const val rxAndroid = "2.1.1"
const val workRuntime = "2.4.0" const val rxJava = "2.2.21"
} const val rxKotlin = "2.4.0"
const val shareTarget = "1.0.0"
object AndroidX { const val simplestack = "2.6.2"
const val appCompat = "androidx.appcompat:appcompat:${Versions.appcompat}" const val simplestackExt = "2.2.2"
const val browser = "androidx.browser:browser:${Versions.browser}" const val sparkButton = "4.1.0"
const val cardView = "androidx.cardview:cardview:${Versions.cardView}" const val swipeRefreshLayout = "1.1.0"
const val constraintLayout = const val timber = "5.0.1"
"androidx.constraintlayout:constraintlayout:${Versions.constraintlayout}" const val viewpager2 = "1.0.0"
const val coreKtx = "androidx.core:core-ktx:${Versions.coreKtx}" const val workRuntime = "2.4.0"
const val emoji = "androidx.emoji:emoji:${Versions.emoji}" }
const val emojiAppCompat = "androidx.emoji:emoji-appcompat:${Versions.emoji}"
const val emojiBundled = "androidx.emoji:emoji-bundled:${Versions.emoji}" object AndroidX {
const val exifInterface = "androidx.exifinterface:exifinterface:${Versions.exifInterface}" const val appCompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
const val fragmentKtx = "androidx.fragment:fragment-ktx:${Versions.fragmentKtx}" const val browser = "androidx.browser:browser:${Versions.browser}"
const val pagingRuntimeKtx = const val cardView = "androidx.cardview:cardview:${Versions.cardView}"
"androidx.paging:paging-runtime-ktx:${Versions.pagingRuntimeKtx}" const val constraintLayout =
const val preferenceKtx = "androidx.preference:preference-ktx:${Versions.preferenceKtx}" "androidx.constraintlayout:constraintlayout:${Versions.constraintlayout}"
const val recyclerView = "androidx.recyclerview:recyclerview:${Versions.recyclerView}" const val coreKtx = "androidx.core:core-ktx:${Versions.coreKtx}"
const val roomCompiler = "androidx.room:room-compiler:${Versions.room}" const val emoji = "androidx.emoji:emoji:${Versions.emoji}"
const val roomRuntime = "androidx.room:room-runtime:${Versions.room}" const val emojiAppCompat = "androidx.emoji:emoji-appcompat:${Versions.emoji}"
const val roomRxJava = "androidx.room:room-rxjava2:${Versions.room}" const val emojiBundled = "androidx.emoji:emoji-bundled:${Versions.emoji}"
const val shareTarget = "androidx.sharetarget:sharetarget:${Versions.shareTarget}" const val exifInterface = "androidx.exifinterface:exifinterface:${Versions.exifInterface}"
const val swipeRefreshLayout = const val fragmentKtx = "androidx.fragment:fragment-ktx:${Versions.fragmentKtx}"
"androidx.swiperefreshlayout:swiperefreshlayout:${Versions.swipeRefreshLayout}" const val pagingRuntimeKtx =
const val viewpager2 = "androidx.viewpager2:viewpager2:${Versions.viewpager2}" "androidx.paging:paging-runtime-ktx:${Versions.pagingRuntimeKtx}"
const val workRuntime = "androidx.work:work-runtime:${Versions.workRuntime}" const val preferenceKtx = "androidx.preference:preference-ktx:${Versions.preferenceKtx}"
const val recyclerView = "androidx.recyclerview:recyclerview:${Versions.recyclerView}"
object Lifecycle { const val roomCompiler = "androidx.room:room-compiler:${Versions.room}"
const val commonJava = "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle}" const val roomRuntime = "androidx.room:room-runtime:${Versions.room}"
const val liveDataKtx = const val roomRxJava = "androidx.room:room-rxjava2:${Versions.room}"
"androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}" const val shareTarget = "androidx.sharetarget:sharetarget:${Versions.shareTarget}"
const val reactiveStreamsKtx = const val swipeRefreshLayout =
"androidx.lifecycle:lifecycle-reactivestreams-ktx:${Versions.lifecycle}" "androidx.swiperefreshlayout:swiperefreshlayout:${Versions.swipeRefreshLayout}"
const val viewmodelKtx = const val viewpager2 = "androidx.viewpager2:viewpager2:${Versions.viewpager2}"
"androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}" const val workRuntime = "androidx.work:work-runtime:${Versions.workRuntime}"
}
} object Lifecycle {
const val commonJava = "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle}"
object Dagger { const val liveDataKtx =
const val dagger = "com.google.dagger:dagger:${Versions.dagger}" "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle}"
const val daggerAndroid = "com.google.dagger:dagger-android:${Versions.dagger}" const val reactiveStreamsKtx =
const val daggerCompiler = "com.google.dagger:dagger-compiler:${Versions.dagger}" "androidx.lifecycle:lifecycle-reactivestreams-ktx:${Versions.lifecycle}"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:${Versions.dagger}" const val viewmodelKtx =
const val daggerSupport = "com.google.dagger:dagger-android-support:${Versions.dagger}" "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}"
} }
}
object Glide {
const val glide = "com.github.bumptech.glide:glide:${Versions.glide}" object Dagger {
const val glideCompiler = "com.github.bumptech.glide:compiler:${Versions.glide}" const val dagger = "com.google.dagger:dagger:${Versions.dagger}"
const val glideOkhttp = "com.github.bumptech.glide:okhttp3-integration:${Versions.glide}" const val daggerAndroid = "com.google.dagger:dagger-android:${Versions.dagger}"
} const val daggerCompiler = "com.google.dagger:dagger-compiler:${Versions.dagger}"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:${Versions.dagger}"
object Google { const val daggerSupport = "com.google.dagger:dagger-android-support:${Versions.dagger}"
const val flexbox = "com.google.android:flexbox:${Versions.flexbox}" }
const val exoplayer = "com.google.android.exoplayer:exoplayer:${Versions.exoplayer}"
const val materialDesign = "com.google.android.material:material:${Versions.materialDesign}" object Glide {
} const val glide = "com.github.bumptech.glide:glide:${Versions.glide}"
const val glideCompiler = "com.github.bumptech.glide:compiler:${Versions.glide}"
object Kotlin { const val glideOkhttp = "com.github.bumptech.glide:okhttp3-integration:${Versions.glide}"
const val reflect = "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}" }
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
const val stdlibJdk = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}" object Google {
} const val flexbox = "com.google.android:flexbox:${Versions.flexbox}"
const val exoplayer = "com.google.android.exoplayer:exoplayer:${Versions.exoplayer}"
object RxJava { const val materialDesign = "com.google.android.material:material:${Versions.materialDesign}"
const val rxAndroid = "io.reactivex.rxjava2:rxandroid:${Versions.rxAndroid}" }
const val rxJava = "io.reactivex.rxjava2:rxjava:${Versions.rxJava}"
const val rxKotlin = "io.reactivex.rxjava2:rxkotlin:${Versions.rxKotlin}" object Kotlin {
} const val reflect = "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
object SimpleStack { const val stdlibJdk = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}"
const val lib = "com.github.Zhuinden:simple-stack:${Versions.simplestack}" }
const val ext = "com.github.Zhuinden:simple-stack-extensions:${Versions.simplestackExt}"
} object RxJava {
const val rxAndroid = "io.reactivex.rxjava2:rxandroid:${Versions.rxAndroid}"
object Square { const val rxJava = "io.reactivex.rxjava2:rxjava:${Versions.rxJava}"
const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}" const val rxKotlin = "io.reactivex.rxjava2:rxkotlin:${Versions.rxKotlin}"
const val retrofitAdapterRxJ2 = }
"com.squareup.retrofit2:adapter-rxjava2:${Versions.retrofit}"
const val retrofitConvGson = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}" object SimpleStack {
const val lib = "com.github.Zhuinden:simple-stack:${Versions.simplestack}"
const val logginInterceptor = const val ext = "com.github.Zhuinden:simple-stack-extensions:${Versions.simplestackExt}"
"com.squareup.okhttp3:logging-interceptor:${Versions.okhttpVersion}" }
const val okhttp = "com.squareup.okhttp3:okhttp:${Versions.okhttpVersion}"
const val okhttpBrotli = "com.squareup.okhttp3:okhttp-brotli:${Versions.okhttpVersion}" object Square {
} const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}"
const val retrofitAdapterRxJ2 =
const val androidImageCropper = "com.squareup.retrofit2:adapter-rxjava2:${Versions.retrofit}"
"com.theartofdev.edmodo:android-image-cropper:${Versions.androidImageCropper}" const val retrofitConvGson = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}"
const val autodispose = "com.uber.autodispose:autodispose:${Versions.autodispose}"
const val autodisposeAndroidArchComp = const val logginInterceptor =
"com.uber.autodispose:autodispose-android-archcomponents:${Versions.autodispose}" "com.squareup.okhttp3:logging-interceptor:${Versions.okhttpVersion}"
const val bigImageViewer = "com.github.piasy:BigImageViewer:${Versions.bigImageViewer}" const val okhttp = "com.squareup.okhttp3:okhttp:${Versions.okhttpVersion}"
const val conscryptAndroid = "org.conscrypt:conscrypt-android:${Versions.conscryptAndroid}" const val okhttpBrotli = "com.squareup.okhttp3:okhttp-brotli:${Versions.okhttpVersion}"
const val filemojiCompat = "de.c1710:filemojicompat:${Versions.filemojiCompat}" }
const val glideImage = "com.github.piasy:GlideImageLoader:${Versions.glideImage}"
const val glideImageViewFactory = const val androidImageCropper =
"com.github.piasy:GlideImageViewFactory:${Versions.glideImage}" "com.theartofdev.edmodo:android-image-cropper:${Versions.androidImageCropper}"
const val markdownEdit = "com.github.Tunous:MarkdownEdit:${Versions.markdownEdit}" const val autodispose = "com.uber.autodispose:autodispose:${Versions.autodispose}"
const val materialDrawer = "com.mikepenz:materialdrawer:${Versions.materialDrawer}" const val autodisposeAndroidArchComp =
const val materialDrawerIconics = "com.uber.autodispose:autodispose-android-archcomponents:${Versions.autodispose}"
"com.mikepenz:materialdrawer-iconics:${Versions.materialDrawer}" const val bigImageViewer = "com.github.piasy:BigImageViewer:${Versions.bigImageViewer}"
const val materialDrawerTypeface = const val conscryptAndroid = "org.conscrypt:conscrypt-android:${Versions.conscryptAndroid}"
"com.mikepenz:google-material-typeface:${Versions.materialDrawerTypeface}" const val filemojiCompat = "de.c1710:filemojicompat:${Versions.filemojiCompat}"
const val sparkButton = "com.github.connyduck:sparkbutton:${Versions.sparkButton}" const val glideImage = "com.github.piasy:GlideImageLoader:${Versions.glideImage}"
const val timber = "com.jakewharton.timber:timber:${Versions.timber}" const val glideImageViewFactory =
"com.github.piasy:GlideImageViewFactory:${Versions.glideImage}"
const val markdownEdit = "com.github.Tunous:MarkdownEdit:${Versions.markdownEdit}"
const val materialDrawer = "com.mikepenz:materialdrawer:${Versions.materialDrawer}"
const val materialDrawerIconics =
"com.mikepenz:materialdrawer-iconics:${Versions.materialDrawer}"
const val materialDrawerTypeface =
"com.mikepenz:google-material-typeface:${Versions.materialDrawerTypeface}"
const val sparkButton = "com.github.connyduck:sparkbutton:${Versions.sparkButton}"
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