diff --git a/composeApp/src/jvmMain/kotlin/com/zaneschepke/wireguardautotunnel/desktop/ui/state/TunnelsUiState.kt b/composeApp/src/jvmMain/kotlin/com/zaneschepke/wireguardautotunnel/desktop/ui/state/TunnelsUiState.kt index b4bd142..c6877a3 100644 --- a/composeApp/src/jvmMain/kotlin/com/zaneschepke/wireguardautotunnel/desktop/ui/state/TunnelsUiState.kt +++ b/composeApp/src/jvmMain/kotlin/com/zaneschepke/wireguardautotunnel/desktop/ui/state/TunnelsUiState.kt @@ -16,7 +16,10 @@ data class TunnelsUiState( data class TunnelUiItem(val config: TunnelConfig, val status: TunnelStatus? = null) { val isRunning: Boolean - get() = status?.state != TunnelState.DOWN && status?.state != TunnelState.STOPPING && status != null + get() = + status?.state != TunnelState.DOWN && + status?.state != TunnelState.STOPPING && + status != null val stateColor: Color get() = status?.state?.asColor() ?: TunnelState.DOWN.asColor() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c966d2c..1b38a28 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -50,6 +50,8 @@ androidx-room = "2.8.4" androidx-sqlite = "2.6.2" lang3 = "3.20.0" +humanReadable = "1.12.3" +datetime = "0.7.1" [bundles] ktor-client-jvm = ["ktor-client-core-jvm", "ktor-client-cio-jvm", "ktor-client-content-negotiation-jvm", "ktor-serialization-json-jvm", "ktor-client-okhttp", "ktor-client-websockets-jvm"] @@ -184,6 +186,9 @@ filekit-dialogs-compose = { module = "io.github.vinceglb:filekit-dialogs-compose multiplatform-settings = { module = "com.russhwolf:multiplatform-settings", version.ref = "mps" } +human-readable = { module = "nl.jacobras:Human-Readable", version.ref = "humanReadable" } +kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "datetime" } + [plugins] composeHotReload = { id = "org.jetbrains.compose.hot-reload", version.ref = "composeHotReload" } @@ -198,4 +203,3 @@ buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" } licensee = { id = "app.cash.licensee", version.ref = "licensee" } aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" } -resources = { id = "org.jetbrains.compose.resources", version.ref = "kotlin" } diff --git a/parser/build.gradle.kts b/parser/build.gradle.kts index 4835965..e9b9c52 100644 --- a/parser/build.gradle.kts +++ b/parser/build.gradle.kts @@ -1,6 +1,8 @@ plugins { kotlin("jvm") alias(libs.plugins.serialization) + `maven-publish` + signing } dependencies { @@ -11,8 +13,57 @@ dependencies { implementation(libs.crypto.rand) implementation(libs.curve25519.kotlin) - implementation("nl.jacobras:Human-Readable:1.12.3") - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1") + implementation(libs.human.readable) + implementation(libs.kotlinx.datetime) } tasks.test { useJUnitPlatform() } + +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + publications { + register("release") { + groupId = "com.zaneschepke.wireguardautotunnel" + artifactId = "amneziawg-parser" + version = "1.0.0" + from(components["java"]) + pom { + name.set("AmneziaWG Parser") + description.set("An AmneziaWG parser") + url.set("https://wgtunnel.com/") + + licenses { + license { + name.set("MIT") + url.set("https://opensource.org/licenses/MIT") + distribution.set("repo") + } + } + scm { + connection.set("scm:git:git://github.com/wgtunnel/desktop.git") + developerConnection.set("scm:git:ssh://github.com/wgtunnel/desktop.git") + url.set("https://github.com/wgtunnel/desktop") + } + developers { + developer { + name.set("Zane Schepke") + email.set("support@zaneschepke.com") + } + } + } + } + } +} + + +signing { + useInMemoryPgpKeys( + LocalProperties.get("SECRET_KEY") ?: System.getenv("SECRET_KEY"), + LocalProperties.get("PASSWORD") ?: System.getenv("PASSWORD") + ) + sign(publishing.publications) +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 21bb608..2c14ccc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties + rootProject.name = "wgtunnel" enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") @@ -18,7 +20,27 @@ dependencyResolutionManagement { } plugins { + id("com.gradleup.nmcp.settings").version("1.4.4") id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } +fun localProperty(name: String): String? { + val props = Properties() + val file = rootDir.resolve("local.properties") + + if (file.exists()) { + file.inputStream().use { props.load(it) } + } + + return props.getProperty(name) ?: System.getenv(name) +} + +nmcpSettings { + centralPortal { + username = localProperty("MAVEN_CENTRAL_USER") + password = localProperty("MAVEN_CENTRAL_PASS") + publishingType = "AUTOMATIC" + } +} + include(":composeApp", ":parser", ":daemon", ":tunnel", ":cli", ":client", ":keyring", ":shared")