133 lines
3.7 KiB
Plaintext
133 lines
3.7 KiB
Plaintext
import org.gradle.api.publish.maven.MavenPublication
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.library)
|
|
alias(libs.plugins.kotlin.android)
|
|
alias(libs.plugins.ksp)
|
|
id("maven-publish")
|
|
}
|
|
group = "com.yuanxuan"
|
|
version = "1.0.6"
|
|
|
|
|
|
val baseReleaseUrl: Provider<String> = providers.gradleProperty("baseReleaseUrl")
|
|
val baseDebugUrl: Provider<String> = providers.gradleProperty("baseDebugUrl")
|
|
val mavenReleaseRepoUrl: Provider<String> = providers.gradleProperty("mavenReleaseRepoUrl")
|
|
val mavenDebugRepoUrl: Provider<String> = providers.gradleProperty("mavenDebugRepoUrl")
|
|
val mavenUsername: Provider<String> = providers.gradleProperty("mavenUsername")
|
|
val mavenPassword: Provider<String> = providers.gradleProperty("mavenPassword")
|
|
|
|
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", "\"${baseDebugUrl.get()}\"")
|
|
}
|
|
release {
|
|
buildConfigField("String", "BASE_URL", "\"${baseReleaseUrl.get()}\"")
|
|
isMinifyEnabled = false
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro"
|
|
)
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
|
|
publishing {
|
|
singleVariant("debug")
|
|
singleVariant("release")
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(11)
|
|
}
|
|
|
|
ksp {
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
}
|
|
|
|
afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
register<MavenPublication>("debug") {
|
|
groupId = project.group.toString()
|
|
artifactId = "tracking_point"
|
|
version = "${project.version}-SNAPSHOT"
|
|
|
|
from(components["debug"])
|
|
}
|
|
|
|
register<MavenPublication>("release") {
|
|
groupId = project.group.toString()
|
|
artifactId = "tracking_point"
|
|
version = "${project.version}"
|
|
|
|
from(components["release"])
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "debugRepo"
|
|
url = uri(mavenDebugRepoUrl.get())
|
|
isAllowInsecureProtocol = true
|
|
credentials {
|
|
username = mavenUsername.get()
|
|
password = mavenPassword.get()
|
|
}
|
|
}
|
|
maven {
|
|
name = "releaseRepo"
|
|
url = uri(mavenReleaseRepoUrl.get())
|
|
isAllowInsecureProtocol = true
|
|
credentials {
|
|
username = mavenUsername.get()
|
|
password = mavenPassword.get()
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
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)
|
|
}
|
|
|
|
tasks.register("publishAll") {
|
|
group = "publishing"
|
|
description = "Publish both Debug and Release artifacts to their repositories."
|
|
|
|
dependsOn(
|
|
"publishDebugPublicationToDebugRepoRepository",
|
|
"publishReleasePublicationToReleaseRepoRepository"
|
|
)
|
|
}
|