build: convert to Gradle Kotlin DSL

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-11-06 17:28:26 +05:30
parent 9839bf4014
commit 1e2fef884f
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
19 changed files with 514 additions and 230 deletions

View file

@ -1,110 +0,0 @@
plugins {
id "kotlin-kapt"
id "dagger.hilt.android.plugin"
}
repositories {
maven { url 'https://jitpack.io' }
}
final def keystorePropertiesFile = rootProject.file("keystore.properties")
android {
adbOptions {
installOptions = ["--user 0"]
}
defaultConfig {
applicationId "dev.msfjarvis.lobsters"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles "proguard-android-optimize.txt", "proguard-rules.pro"
}
}
compileOptions.coreLibraryDesugaringEnabled = true
buildFeatures.compose = true
composeOptions {
kotlinCompilerVersion "${kotlin_version}"
kotlinCompilerExtensionVersion "${compose_version}"
}
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias keystoreProperties["keyAlias"]
keyPassword keystoreProperties["keyPassword"]
storeFile rootProject.file(keystoreProperties["storeFile"])
storePassword keystoreProperties["storePassword"]
}
}
buildTypes.debug.signingConfig = signingConfigs.release
buildTypes.release.signingConfig = signingConfigs.release
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=androidx.compose.material.ExperimentalMaterialApi",
]
}
}
dependencies {
kapt "com.github.MatrixDev.Roomigrant:RoomigrantCompiler:$roomigrant_version"
kapt "com.google.dagger:hilt-compiler:$hilt_dagger_version"
kapt "androidx.hilt:hilt-compiler:$hilt_androidx_version"
kapt "androidx.room:room-compiler:$room_version"
implementation(project(":lobsters-api"))
implementation(project(":model"))
implementation "androidx.core:core-ktx:$core_version"
implementation "androidx.activity:activity-ktx:$activity_version"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.browser:browser:$browser_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
implementation "androidx.compose.foundation:foundation-text:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-text:$compose_version"
implementation "androidx.compose.ui:ui-text-android:$compose_version"
implementation "androidx.compose.ui:ui-unit:$compose_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:$hilt_androidx_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.navigation:navigation-compose:$nav_compose_version"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.ui:ui-tooling:$compose_version"
implementation "com.github.MatrixDev.Roomigrant:RoomigrantLib:$roomigrant_version"
implementation "com.google.android.material:material:$material_version"
implementation "com.google.dagger:hilt-android:$hilt_dagger_version"
implementation "com.squareup.moshi:moshi:$moshi_version"
implementation "dev.chrisbanes.accompanist:accompanist-coil:$accompanist_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "saschpe.android:customtabs:$customtabs_version"
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_dagger_version"
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.ui:ui-test:$compose_version"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:$desugar_version"
}

100
app/build.gradle.kts Normal file
View file

@ -0,0 +1,100 @@
import java.util.Properties
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
id("dagger.hilt.android.plugin")
`lobsters-plugin`
`core-library-desugaring`
}
repositories {
maven { setUrl("https://jitpack.io") }
}
val keystorePropertiesFile = rootProject.file("keystore.properties")
android {
adbOptions.installOptions("--user 0")
defaultConfig {
applicationId = "dev.msfjarvis.lobsters"
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions.annotationProcessorOptions {
argument("room.schemaLocation", "${projectDir}/schemas")
}
}
buildTypes {
named("release") {
isMinifyEnabled = true
setProguardFiles(listOf("proguard-android-optimize.txt", "proguard-rules.pro"))
}
}
buildFeatures.compose = true
composeOptions {
kotlinCompilerVersion = "1.4.10"
kotlinCompilerExtensionVersion = Dependencies.COMPOSE_VERSION
}
if (keystorePropertiesFile.exists()) {
val keystoreProperties = Properties()
keystoreProperties.load(keystorePropertiesFile.inputStream())
signingConfigs {
register("release") {
keyAlias = keystoreProperties["keyAlias"] as String
keyPassword = keystoreProperties["keyPassword"] as String
storeFile = rootProject.file(keystoreProperties["storeFile"] as String)
storePassword = keystoreProperties["storePassword"] as String
}
}
listOf("release", "debug").map {
buildTypes.getByName(it).signingConfig = signingConfigs.getByName(it)
}
}
}
dependencies {
kapt(Dependencies.ThirdParty.Roomigrant.compiler)
kapt(Dependencies.AndroidX.Hilt.daggerCompiler)
kapt(Dependencies.AndroidX.Hilt.daggerHiltCompiler)
kapt(Dependencies.AndroidX.Room.compiler)
implementation(project(":lobsters-api"))
implementation(project(":model"))
implementation(Dependencies.AndroidX.coreKtx)
implementation(Dependencies.AndroidX.activityKtx)
implementation(Dependencies.AndroidX.appCompat)
implementation(Dependencies.AndroidX.browser)
implementation(Dependencies.AndroidX.Compose.foundation)
implementation(Dependencies.AndroidX.Compose.foundationLayout)
implementation(Dependencies.AndroidX.Compose.foundationText)
implementation(Dependencies.AndroidX.Compose.runtime)
implementation(Dependencies.AndroidX.Compose.material)
implementation(Dependencies.AndroidX.Compose.compiler)
implementation(Dependencies.AndroidX.Compose.ui)
implementation(Dependencies.AndroidX.Compose.uiTooling)
implementation(Dependencies.AndroidX.Compose.uiText)
implementation(Dependencies.AndroidX.Compose.uiTextAndroid)
implementation(Dependencies.AndroidX.Compose.uiUnit)
implementation(Dependencies.AndroidX.Hilt.hiltLifecycleViewmodel)
implementation(Dependencies.AndroidX.Lifecycle.runtimeKtx)
implementation(Dependencies.AndroidX.Lifecycle.viewmodelKtx)
implementation(Dependencies.AndroidX.Compose.navigation)
implementation(Dependencies.AndroidX.Room.runtime)
implementation(Dependencies.AndroidX.Room.ktx)
implementation(Dependencies.ThirdParty.Roomigrant.runtime)
implementation(Dependencies.AndroidX.material)
implementation(Dependencies.AndroidX.Hilt.dagger)
implementation(Dependencies.ThirdParty.Moshi.lib)
implementation(Dependencies.ThirdParty.accompanist)
implementation(Dependencies.Kotlin.Coroutines.android)
implementation(Dependencies.ThirdParty.customtabs)
androidTestImplementation(Dependencies.Testing.daggerHilt)
testImplementation(Dependencies.Testing.junit)
androidTestImplementation(Dependencies.Testing.uiTest)
}