diff options
Diffstat (limited to 'tunnel/build.gradle.kts')
-rw-r--r-- | tunnel/build.gradle.kts | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/tunnel/build.gradle.kts b/tunnel/build.gradle.kts new file mode 100644 index 00000000..1039923a --- /dev/null +++ b/tunnel/build.gradle.kts @@ -0,0 +1,129 @@ +@file:Suppress("UnstableApiUsage") +import org.gradle.api.tasks.testing.logging.TestLogEvent + +plugins { + alias(libs.plugins.android.library) + `maven-publish` + signing +} + +android { + compileSdk = 33 + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + namespace = "com.wireguard.android.tunnel" + defaultConfig { + minSdk = 21 + } + externalNativeBuild { + cmake { + path("tools/CMakeLists.txt") + } + } + testOptions.unitTests.all { + it.testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) } + } + buildTypes { + all { + externalNativeBuild { + cmake { + targets("libwg-go.so", "libwg.so", "libwg-quick.so") + arguments("-DGRADLE_USER_HOME=${project.gradle.gradleUserHomeDir}") + } + } + } + release { + externalNativeBuild { + cmake { + arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android") + } + } + } + debug { + externalNativeBuild { + cmake { + arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android.debug") + } + } + } + } + lint { + disable.add("LongLogTag") + disable.add("NewApi") + } + publishing { + singleVariant("release") { + withJavadocJar() + withSourcesJar() + } + } +} + +dependencies { + implementation(libs.androidx.annotation) + implementation(libs.androidx.collection) + compileOnly(libs.jsr305) + testImplementation(libs.junit) +} + +publishing { + publications { + register<MavenPublication>("release") { + groupId = "com.wireguard.android" + artifactId = "tunnel" + version = providers.gradleProperty("wireguardVersionName").get() + afterEvaluate { + from(components["release"]) + } + pom { + name.set("WireGuard Tunnel Library") + description.set("Embeddable tunnel library for WireGuard for Android") + url.set("https://www.wireguard.com/") + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + scm { + connection.set("scm:git:https://git.zx2c4.com/wireguard-android") + developerConnection.set("scm:git:https://git.zx2c4.com/wireguard-android") + url.set("https://git.zx2c4.com/wireguard-android") + } + developers { + organization { + name.set("WireGuard") + url.set("https://www.wireguard.com/") + } + developer { + name.set("WireGuard") + email.set("team@wireguard.com") + } + } + } + } + } + repositories { + maven { + name = "sonatype" + url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = providers.gradleProperty("SONATYPE_USER") + .orElse(providers.environmentVariable("SONATYPE_USER")) + .orNull + password = providers.gradleProperty("SONATYPE_PASSWORD") + .orElse(providers.environmentVariable("SONATYPE_PASSWORD")) + .orNull + } + } + } +} + +signing { + useGpgCmd() + sign(publishing.publications) +} |