summaryrefslogtreecommitdiffhomepage
path: root/tunnel/build.gradle.kts
blob: 63535199f3f0f9110bf18ea0078f2e0aeba3f8a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@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_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    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")
                }
            }
        }
        create("googleplay") {
            initWith(getByName("release"))
        }
    }
    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)
}