From bed2f2e5d61ab8a4d3c0e4dabe6d60ffc3d1c1ec Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 3 May 2023 00:43:18 +0530 Subject: gradle: convert build files to Kotlin Signed-off-by: Harsh Shandilya --- tunnel/build.gradle | 72 --------------------------- tunnel/build.gradle.kts | 129 ++++++++++++++++++++++++++++++++++++++++++++++++ tunnel/publish.gradle | 82 ------------------------------ 3 files changed, 129 insertions(+), 154 deletions(-) delete mode 100644 tunnel/build.gradle create mode 100644 tunnel/build.gradle.kts delete mode 100644 tunnel/publish.gradle (limited to 'tunnel') diff --git a/tunnel/build.gradle b/tunnel/build.gradle deleted file mode 100644 index 894762c9..00000000 --- a/tunnel/build.gradle +++ /dev/null @@ -1,72 +0,0 @@ -plugins { - id 'com.android.library' -} - -version wireguardVersionName -group groupName - -android { - compileSdk 33 - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - namespace 'com.wireguard.android.tunnel' - defaultConfig { - minSdkVersion 21 - targetSdkVersion 33 - versionCode wireguardVersionCode - versionName wireguardVersionName - } - externalNativeBuild { - cmake { - path 'tools/CMakeLists.txt' - } - } - testOptions.unitTests.all { - testLogging { - events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' - } - } - 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=${groupName}" - } - } - } - debug { - externalNativeBuild { - cmake { - arguments "-DANDROID_PACKAGE_NAME=${groupName}.debug" - } - } - } - } - lint { - disable 'LongLogTag', 'NewApi' - } - publishing { - multipleVariants("release") { - allVariants() - } - } -} - -dependencies { - implementation "androidx.annotation:annotation:$annotationsVersion" - implementation "androidx.collection:collection:$collectionVersion" - compileOnly "com.google.code.findbugs:jsr305:$jsr305Version" - testImplementation "junit:junit:$junitVersion" -} - -apply from: "publish.gradle" 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("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) +} diff --git a/tunnel/publish.gradle b/tunnel/publish.gradle deleted file mode 100644 index fd4ef18b..00000000 --- a/tunnel/publish.gradle +++ /dev/null @@ -1,82 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -afterEvaluate { - publishing { - publications { - release(MavenPublication) { - groupId = groupName - artifactId = 'tunnel' - version wireguardVersionName - - artifact sourcesJar - artifact javadocJar - - from components.getByName("release") - - pom { - name = 'WireGuard Tunnel Library' - description = 'Embeddable tunnel library for WireGuard for Android' - url = 'https://www.wireguard.com/' - - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - scm { - connection = 'scm:git:https://git.zx2c4.com/wireguard-android' - developerConnection = 'scm:git:https://git.zx2c4.com/wireguard-android' - url = 'https://git.zx2c4.com/wireguard-android' - } - developers { - organization { - name = 'WireGuard' - url = 'https://www.wireguard.com/' - } - developer { - name = 'WireGuard' - email = 'team@wireguard.com' - } - } - } - } - } - repositories { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = hasProperty('SONATYPE_USER') ? getProperty('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = hasProperty('SONATYPE_PASSWORD') ? getProperty('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } -} - -android.libraryVariants.all { variant -> - if (variant.name == 'release') { - task javadoc(type: Javadoc) { - source = variant.javaCompileProvider.get().source - classpath = files((android.bootClasspath.join(File.pathSeparator))) - classpath += variant.javaCompileProvider.get().classpath - title = 'Embeddable WireGuard Tunnel for Android v$wireguardVersionName' - } - task javadocJar(type: Jar, dependsOn: javadoc) { - archiveClassifier = 'javadoc' - from javadoc.destinationDir - } - task sourcesJar(type: Jar) { - archiveClassifier = 'sources' - from android.sourceSets.main.java.srcDirs - } - } -} - -signing { - useGpgCmd() - sign publishing.publications -} -- cgit v1.2.3