Wire project infrastructure

This commit is contained in:
2026-04-24 15:27:17 +02:00
parent 68e4a5637a
commit 015d8d51d0
66 changed files with 7276 additions and 211 deletions

View File

@@ -1,42 +1,22 @@
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.kotlinMultiplatform)
// AGP must apply BEFORE recipe.kotlin.multiplatform — the latter calls androidTarget(),
// which requires the Android Gradle Plugin to already be on the project.
alias(libs.plugins.androidLibrary)
id("recipe.kotlin.multiplatform")
id("recipe.quality")
}
kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
explicitApi()
iosArm64()
iosSimulatorArm64()
jvm {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
}
js {
browser()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
}
// No iOS framework here — composeApp's umbrella `ComposeApp.framework`
// transitively exports shared. Producing a second framework would double-bundle
// the Kotlin stdlib at link time (PITFALL: duplicate-framework collision).
sourceSets {
commonMain.dependencies {
// put your Multiplatform dependencies here
}
commonTest.dependencies {
implementation(libs.kotlin.test)
// Phase 1: intentionally empty. Domain models + DTOs land Phase 2+.
// D-19 / INFRA-06: No Ktor, Compose, SQLDelight, Koin, or Kermit here — EVER.
}
}
}

View File

@@ -2,8 +2,8 @@ package dev.ulfrx.recipe
import android.os.Build
class AndroidPlatform : Platform {
public class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
public actual fun getPlatform(): Platform = AndroidPlatform()

View File

@@ -1,3 +1,3 @@
package dev.ulfrx.recipe
const val SERVER_PORT = 8080
public const val SERVER_PORT: Int = 8080

View File

@@ -1,9 +1,7 @@
package dev.ulfrx.recipe
class Greeting {
public class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}
public fun greet(): String = "Hello, ${platform.name}!"
}

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
interface Platform {
val name: String
public interface Platform {
public val name: String
}
expect fun getPlatform(): Platform
public expect fun getPlatform(): Platform

View File

@@ -4,9 +4,8 @@ import kotlin.test.Test
import kotlin.test.assertEquals
class SharedCommonTest {
@Test
fun example() {
assertEquals(3, 1 + 2)
}
}
}

View File

@@ -2,8 +2,8 @@ package dev.ulfrx.recipe
import platform.UIKit.UIDevice
class IOSPlatform : Platform {
public class IOSPlatform : Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}
actual fun getPlatform(): Platform = IOSPlatform()
public actual fun getPlatform(): Platform = IOSPlatform()

View File

@@ -1,7 +0,0 @@
package dev.ulfrx.recipe
class JsPlatform : Platform {
override val name: String = "Web with Kotlin/JS"
}
actual fun getPlatform(): Platform = JsPlatform()

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
class JVMPlatform : Platform {
public class JVMPlatform : Platform {
override val name: String = "Java ${System.getProperty("java.version")}"
}
actual fun getPlatform(): Platform = JVMPlatform()
public actual fun getPlatform(): Platform = JVMPlatform()

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
class WasmPlatform : Platform {
public class WasmPlatform : Platform {
override val name: String = "Web with Kotlin/Wasm"
}
actual fun getPlatform(): Platform = WasmPlatform()
public actual fun getPlatform(): Platform = WasmPlatform()