Skip to content

Commit

Permalink
added missing wasm targets
Browse files Browse the repository at this point in the history
  • Loading branch information
DatL4g committed Jan 21, 2024
1 parent fa0b8fa commit 08034e3
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
105 changes: 105 additions & 0 deletions annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
alias(libs.plugins.multiplatform)
alias(libs.plugins.android.library)
// `maven-publish`
// signing
// alias(libs.plugins.vanniktech.publish)
alias(libs.plugins.osdetector)
}

val artifact = VersionCatalog.artifactName()
group = artifact
version = libVersion

kotlin {
androidNativeX86()
androidNativeX64()
androidNativeArm32()
androidNativeArm64()

linuxX64()
linuxArm64()
mingwX64()

if (getHost() == Host.MAC) {
macosX64()
macosArm64()

iosX64()
iosArm64()
iosSimulatorArm64()

tvosX64()
tvosArm64()
tvosSimulatorArm64()

watchosX64()
watchosArm32()
watchosArm64()
watchosSimulatorArm64()
watchosDeviceArm64()
}

androidTarget()
jvm()

js(IR) {
browser()
nodejs()
binaries.executable()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
nodejs()
binaries.executable()
}
@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
binaries.executable()
}

applyDefaultHierarchyTemplate()
}

android {
compileSdk = Configuration.compileSdk
namespace = artifact

defaultConfig {
minSdk = Configuration.minSdk
}

compileOptions {
sourceCompatibility = CompileOptions.sourceCompatibility
targetCompatibility = CompileOptions.targetCompatibility
}
}

fun getHost(): Host {
return when (osdetector.os) {
"linux" -> Host.Linux
"osx" -> Host.MAC
"windows" -> Host.Windows
else -> {
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")

when {
hostOs == "Linux" -> Host.Linux
hostOs == "Mac OS X" -> Host.MAC
isMingwX64 -> Host.Windows
else -> throw IllegalStateException("Unknown OS: ${osdetector.classifier}")
}
}
}
}

enum class Host(val label: String) {
Linux("linux"),
Windows("win"),
MAC("mac");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dev.datlag.sekret

@Target(AnnotationTarget.TYPE, AnnotationTarget.CLASS)
annotation class Obfuscate
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

repositories {
Expand Down
13 changes: 13 additions & 0 deletions sekret/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
alias(libs.plugins.multiplatform)
Expand Down Expand Up @@ -71,6 +72,18 @@ kotlin {
js(IR) {
browser()
nodejs()
binaries.executable()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
nodejs()
binaries.executable()
}
@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()
binaries.executable()
}

applyDefaultHierarchyTemplate()
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ rootProject.name = "sekret"

include(":gradle-plugin")
include(":sekret")
include(":annotations")
include(":sample", ":sample:sekret")

pluginManagement {
Expand Down

0 comments on commit 08034e3

Please sign in to comment.