Simplify gradle build configuration

This commit is contained in:
Shinokuni 2024-07-04 17:37:03 +02:00
parent e909eaf656
commit b2f89b4471
4 changed files with 56 additions and 81 deletions

View File

@ -5,15 +5,6 @@ plugins {
android {
namespace = "com.readrops.api"
compileSdkVersion(34)
defaultConfig {
minSdkVersion(21)
targetSdkVersion(34)
buildToolsVersion("34.0.0")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
sourceSets {
getByName("androidTest") {
@ -21,33 +12,16 @@ android {
}
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
debug {
isMinifyEnabled = false
isTestCoverageEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf("-Xstring-concat=inline")
}
lint {
abortOnError = false
}
}
dependencies {
//implementation fileTree(dir: "libs", include: ["*.jar"])
implementation(project(":db"))
testImplementation("junit:junit:4.13")

View File

@ -3,18 +3,15 @@ plugins {
kotlin("android")
}
android {
namespace = "com.readrops.app"
compileSdk = 34
defaultConfig {
applicationId = "com.readrops.app"
minSdk = 21
targetSdk = 34
versionCode = 15
versionName = "2.0-beta01"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
@ -33,17 +30,6 @@ android {
}
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
buildConfig = true
compose = true

View File

@ -1,4 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.BaseExtension
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript {
val kotlin_version = "1.8.0"
@ -7,8 +11,9 @@ buildscript {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.1.1")
classpath("com.android.tools.build:gradle:8.1.4")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
classpath("org.jacoco:org.jacoco.core:0.8.7")
}
@ -29,11 +34,51 @@ allprojects {
}*/
}
ext {
val compileSdkVersion = 34
val minSdkVersion = 21
val targetSdkVersion = 34
val buildToolsVersion = "34.0.0"
subprojects {
afterEvaluate {
tasks.withType<KotlinJvmCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
plugins.withType<AppPlugin> {
configure<BaseExtension> {
configure(this)
}
}
plugins.withType<LibraryPlugin> {
configure<LibraryExtension> {
configure(this)
}
}
}
}
fun configure(extension: BaseExtension) = with(extension) {
compileSdkVersion(34)
defaultConfig {
minSdk = 21
targetSdk = 34
buildToolsVersion = "34.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}
lintOptions.isAbortOnError = false
/*dependencies {
add("coreLibraryDesugaring", libs.jdk.desugar)
}*/
}
tasks.register<Delete>("clean") {
@ -66,7 +111,7 @@ tasks.register("jacocoFullReport", JacocoReport) {
//dependsOn ":app:connectedAndroidTest"
dependsOn ":db:connectedAndroidTest"*/
//final fileFilter = ["**/R.class", "**/R\$*.class", "**/BuildConfig.*", "**/Manifest*.*", "android/**/*.*"]
//final fileFilter = ["**/R.class", "**/R\$*.class", "**/BuildConfig.*", "**/Manifest*.*", "android/**/*.*"]
/* classDirectories.setFrom files([
//fileTree(dir: "$project.rootDir/app/build/intermediates/javac/debug", excludes: fileFilter),

View File

@ -7,13 +7,8 @@ plugins {
android {
namespace = "com.readrops.db"
compileSdk = 34
defaultConfig {
minSdk = 21
targetSdk = 34
buildToolsVersion ="34.0.0"
javaCompileOptions {
annotationProcessorOptions {
arguments += mapOf(
@ -23,7 +18,6 @@ android {
}
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
@ -33,30 +27,6 @@ android {
}
}
buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
debug {
isMinifyEnabled = false
isTestCoverageEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
lint {
abortOnError = false
}