gradle: reabstract package name

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2023-05-03 14:09:11 +02:00
parent cf4fca8086
commit dca96a52b4
3 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,7 @@
wireguardVersionCode=501
wireguardVersionName=1.0.20230502
wireguardPackageName=com.wireguard.android
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
@ -63,9 +67,6 @@ android.suppressUnsupportedOptionWarnings=android.keepWorkerActionServicesBetwee
android.enableAppCompileTimeRClass,\
android.suppressUnsupportedOptionWarnings
wireguardVersionCode=501
wireguardVersionName=1.0.20230502
# OSSRH sometimes struggles with slow deployments, so this makes Gradle
# more tolerant to those delays.
systemProp.org.gradle.internal.http.connectionTimeout=500000

View File

@ -1,6 +1,8 @@
@file:Suppress("UnstableApiUsage")
import org.gradle.api.tasks.testing.logging.TestLogEvent
val pkg: String = providers.gradleProperty("wireguardPackageName").get()
plugins {
alias(libs.plugins.android.library)
`maven-publish`
@ -13,7 +15,7 @@ android {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
namespace = "com.wireguard.android.tunnel"
namespace = "${pkg}.tunnel"
defaultConfig {
minSdk = 21
}
@ -37,14 +39,14 @@ android {
release {
externalNativeBuild {
cmake {
arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android")
arguments("-DANDROID_PACKAGE_NAME=${pkg}")
}
}
}
debug {
externalNativeBuild {
cmake {
arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android.debug")
arguments("-DANDROID_PACKAGE_NAME=${pkg}.debug")
}
}
}
@ -74,7 +76,7 @@ dependencies {
publishing {
publications {
register<MavenPublication>("release") {
groupId = "com.wireguard.android"
groupId = pkg
artifactId = "tunnel"
version = providers.gradleProperty("wireguardVersionName").get()
afterEvaluate {

View File

@ -2,6 +2,8 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val pkg: String = providers.gradleProperty("wireguardPackageName").get()
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
@ -15,9 +17,9 @@ android {
dataBinding = true
viewBinding = true
}
namespace = "com.wireguard.android"
namespace = pkg
defaultConfig {
applicationId = "com.wireguard.android"
applicationId = pkg
minSdk = 21
targetSdk = 33
versionCode = providers.gradleProperty("wireguardVersionCode").get().toInt()