Skip to content

Commit 06c1f96

Browse files
msfjarviszx2c4
authored andcommitted
gradle: convert build files to Kotlin
Signed-off-by: Harsh Shandilya <[email protected]>
1 parent 455fcc0 commit 06c1f96

12 files changed

+278
-302
lines changed

build.gradle

Lines changed: 0 additions & 33 deletions
This file was deleted.

build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
alias(libs.plugins.android.application) apply false
3+
alias(libs.plugins.android.library) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.kotlin.kapt) apply false
6+
}
7+
8+
tasks {
9+
wrapper {
10+
gradleVersion = "8.1.1"
11+
distributionSha256Sum = "e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f"
12+
}
13+
}

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ android.suppressUnsupportedOptionWarnings=android.keepWorkerActionServicesBetwee
6363
android.enableAppCompileTimeRClass,\
6464
android.suppressUnsupportedOptionWarnings
6565

66+
wireguardVersionCode=501
67+
wireguardVersionName=1.0.20230502
68+
6669
# OSSRH sometimes struggles with slow deployments, so this makes Gradle
6770
# more tolerant to those delays.
6871
systemProp.org.gradle.internal.http.connectionTimeout=500000

gradle/libs.versions.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[versions]
2+
agp = "8.0.0"
3+
kotlin = "1.8.0"
4+
5+
[libraries]
6+
androidx-activity-ktx = "androidx.activity:activity-ktx:1.7.1"
7+
androidx-annotation = "androidx.annotation:annotation:1.6.0"
8+
androidx-appcompat = "androidx.appcompat:appcompat:1.6.1"
9+
androidx-biometric = "androidx.biometric:biometric:1.1.0"
10+
androidx-collection = "androidx.collection:collection:1.2.0"
11+
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
12+
androidx-coordinatorlayout = "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
13+
androidx-core-ktx = "androidx.core:core-ktx:1.10.0"
14+
androidx-datastore-preferences = "androidx.datastore:datastore-preferences:1.0.0"
15+
androidx-fragment-ktx = "androidx.fragment:fragment-ktx:1.5.7"
16+
androidx-lifecycle-runtime-ktx = "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
17+
androidx-preference-ktx = "androidx.preference:preference-ktx:1.2.0"
18+
desugarJdkLibs = "com.android.tools:desugar_jdk_libs:1.1.5"
19+
google-material = "com.google.android.material:material:1.8.0"
20+
jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
21+
junit = "junit:junit:4.13.2"
22+
kotlinx-coroutines-android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
23+
zxing-android-embedded = "com.journeyapps:zxing-android-embedded:4.3.0"
24+
25+
[plugins]
26+
android-application = { id = "com.android.application", version.ref = "agp" }
27+
android-library = { id = "com.android.library", version.ref = "agp" }
28+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
29+
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }

settings.gradle

Lines changed: 0 additions & 28 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@file:Suppress("UnstableApiUsage")
2+
3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
google()
7+
mavenCentral()
8+
}
9+
}
10+
11+
dependencyResolutionManagement {
12+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
13+
repositories {
14+
google()
15+
mavenCentral()
16+
}
17+
}
18+
19+
rootProject.name = "wireguard-android"
20+
21+
include(":tunnel")
22+
include(":ui")

tunnel/build.gradle

Lines changed: 0 additions & 72 deletions
This file was deleted.

tunnel/build.gradle.kts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
@file:Suppress("UnstableApiUsage")
2+
import org.gradle.api.tasks.testing.logging.TestLogEvent
3+
4+
plugins {
5+
alias(libs.plugins.android.library)
6+
`maven-publish`
7+
signing
8+
}
9+
10+
android {
11+
compileSdk = 33
12+
compileOptions {
13+
sourceCompatibility = JavaVersion.VERSION_1_8
14+
targetCompatibility = JavaVersion.VERSION_1_8
15+
}
16+
namespace = "com.wireguard.android.tunnel"
17+
defaultConfig {
18+
minSdk = 21
19+
}
20+
externalNativeBuild {
21+
cmake {
22+
path("tools/CMakeLists.txt")
23+
}
24+
}
25+
testOptions.unitTests.all {
26+
it.testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) }
27+
}
28+
buildTypes {
29+
all {
30+
externalNativeBuild {
31+
cmake {
32+
targets("libwg-go.so", "libwg.so", "libwg-quick.so")
33+
arguments("-DGRADLE_USER_HOME=${project.gradle.gradleUserHomeDir}")
34+
}
35+
}
36+
}
37+
release {
38+
externalNativeBuild {
39+
cmake {
40+
arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android")
41+
}
42+
}
43+
}
44+
debug {
45+
externalNativeBuild {
46+
cmake {
47+
arguments("-DANDROID_PACKAGE_NAME=com.wireguard.android.debug")
48+
}
49+
}
50+
}
51+
}
52+
lint {
53+
disable.add("LongLogTag")
54+
disable.add("NewApi")
55+
}
56+
publishing {
57+
singleVariant("release") {
58+
withJavadocJar()
59+
withSourcesJar()
60+
}
61+
}
62+
}
63+
64+
dependencies {
65+
implementation(libs.androidx.annotation)
66+
implementation(libs.androidx.collection)
67+
compileOnly(libs.jsr305)
68+
testImplementation(libs.junit)
69+
}
70+
71+
publishing {
72+
publications {
73+
register<MavenPublication>("release") {
74+
groupId = "com.wireguard.android"
75+
artifactId = "tunnel"
76+
version = providers.gradleProperty("wireguardVersionName").get()
77+
afterEvaluate {
78+
from(components["release"])
79+
}
80+
pom {
81+
name.set("WireGuard Tunnel Library")
82+
description.set("Embeddable tunnel library for WireGuard for Android")
83+
url.set("https://www.wireguard.com/")
84+
85+
licenses {
86+
license {
87+
name.set("The Apache Software License, Version 2.0")
88+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
89+
distribution.set("repo")
90+
}
91+
}
92+
scm {
93+
connection.set("scm:git:https://git.zx2c4.com/wireguard-android")
94+
developerConnection.set("scm:git:https://git.zx2c4.com/wireguard-android")
95+
url.set("https://git.zx2c4.com/wireguard-android")
96+
}
97+
developers {
98+
organization {
99+
name.set("WireGuard")
100+
url.set("https://www.wireguard.com/")
101+
}
102+
developer {
103+
name.set("WireGuard")
104+
email.set("[email protected]")
105+
}
106+
}
107+
}
108+
}
109+
}
110+
repositories {
111+
maven {
112+
name = "sonatype"
113+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
114+
credentials {
115+
username = providers.gradleProperty("SONATYPE_USER")
116+
.orElse(providers.environmentVariable("SONATYPE_USER"))
117+
.orNull
118+
password = providers.gradleProperty("SONATYPE_PASSWORD")
119+
.orElse(providers.environmentVariable("SONATYPE_PASSWORD"))
120+
.orNull
121+
}
122+
}
123+
}
124+
}
125+
126+
signing {
127+
useGpgCmd()
128+
sign(publishing.publications)
129+
}

0 commit comments

Comments
 (0)