107 lines
3.0 KiB
Plaintext
107 lines
3.0 KiB
Plaintext
import org.gradle.api.tasks.Delete
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.library)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.ksp)
|
|
}
|
|
|
|
version = "1.0.0"
|
|
|
|
android {
|
|
namespace = "com.yuanxuan.tracking_point.library"
|
|
compileSdk = 36
|
|
|
|
defaultConfig {
|
|
minSdk = 23
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
consumerProguardFiles("consumer-rules.pro")
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
buildConfigField("String", "BASE_URL", "\"http://192.168.2.7:18828\"")
|
|
}
|
|
release {
|
|
buildConfigField("String", "BASE_URL", "\"https://track.23544.com\"")
|
|
isMinifyEnabled = false
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
kotlinOptions {
|
|
jvmTarget = "11"
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation(libs.junit)
|
|
androidTestImplementation(libs.androidx.junit)
|
|
androidTestImplementation(libs.androidx.espresso.core)
|
|
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.work.ktx)
|
|
implementation(libs.retrofit)
|
|
implementation(libs.retrofit.converter.moshi)
|
|
implementation(libs.okhttp.logging.interceptor)
|
|
implementation(libs.moshi)
|
|
ksp(libs.moshi.kotlin.codegen)
|
|
implementation(libs.androidx.room)
|
|
implementation(libs.androidx.room.ktx)
|
|
ksp(libs.androidx.room.ksp)
|
|
}
|
|
|
|
// Task to clean the 'aar' directory
|
|
tasks.register<Delete>("cleanAar") {
|
|
group = "build"
|
|
description = "Deletes the root 'aar' directory to ensure a clean build."
|
|
delete(rootProject.file("aar"))
|
|
}
|
|
|
|
tasks.register("buildAar") {
|
|
group = "build"
|
|
description = "Cleans, builds, and copies release and debug AARs."
|
|
|
|
// This task depends on 'cleanAar', which will run first.
|
|
dependsOn("cleanAar", "assembleDebug", "assembleRelease")
|
|
|
|
doLast {
|
|
val releaseDestDir = rootProject.file("aar/release")
|
|
val debugDestDir = rootProject.file("aar/debug")
|
|
val aarVersion = project.version
|
|
|
|
// Copy release AAR
|
|
copy {
|
|
from(layout.buildDirectory.file("outputs/aar/library-release.aar"))
|
|
into(releaseDestDir)
|
|
rename { "trackingPoint-release-$aarVersion.aar" }
|
|
}
|
|
|
|
// Copy debug AAR
|
|
copy {
|
|
from(layout.buildDirectory.file("outputs/aar/library-debug.aar"))
|
|
into(debugDestDir)
|
|
rename { "trackingPoint-debug-$aarVersion.aar" }
|
|
}
|
|
|
|
println(
|
|
"""
|
|
AARs have been built and copied:
|
|
- Release: ${releaseDestDir.absolutePath}/trackingPoint-release-$aarVersion.aar
|
|
- Debug: ${debugDestDir.absolutePath}/trackingPoint-debug-$aarVersion.aar
|
|
""".trimIndent()
|
|
)
|
|
}
|
|
}
|