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. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # 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 # 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.enableAppCompileTimeRClass,\
android.suppressUnsupportedOptionWarnings android.suppressUnsupportedOptionWarnings
wireguardVersionCode=501
wireguardVersionName=1.0.20230502
# OSSRH sometimes struggles with slow deployments, so this makes Gradle # OSSRH sometimes struggles with slow deployments, so this makes Gradle
# more tolerant to those delays. # more tolerant to those delays.
systemProp.org.gradle.internal.http.connectionTimeout=500000 systemProp.org.gradle.internal.http.connectionTimeout=500000

View File

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

View File

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