-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
||
plugins { | ||
alias(libs.plugins.kotlinMultiplatform) | ||
alias(libs.plugins.androidLibrary) | ||
} | ||
|
||
kotlin { | ||
androidTarget { | ||
compilations.all { | ||
kotlinOptions { | ||
jvmTarget = JvmTarget.JVM_11.target | ||
} | ||
} | ||
} | ||
|
||
val xcf = XCFramework() | ||
listOf( | ||
iosX64(), | ||
iosArm64(), | ||
iosSimulatorArm64() | ||
).forEach { | ||
it.binaries.framework { | ||
baseName = "domain" | ||
xcf.add(this) | ||
isStatic = true | ||
} | ||
} | ||
|
||
sourceSets { | ||
commonMain.dependencies { | ||
//put your multiplatform dependencies here | ||
} | ||
commonTest.dependencies { | ||
implementation(libs.kotlin.test) | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "dev.hicka04.pokedex.core.domain" | ||
compileSdk = libs.versions.android.compileSdk.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.android.minSdk.get().toInt() | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
core/domain/src/androidMain/kotlin/dev/hicka04/pokedex/core/domain/Platform.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
class AndroidPlatform : Platform { | ||
override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" | ||
} | ||
|
||
actual fun getPlatform(): Platform = AndroidPlatform() |
12 changes: 12 additions & 0 deletions
12
core/domain/src/androidUnitTest/kotlin/dev/hicka04/pokedex/core/domain/Test.android.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
import org.junit.Assert.assertTrue | ||
import org.junit.Test | ||
|
||
class AndroidGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue("Check Android is mentioned", Greeting().greet().contains("Android")) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
core/domain/src/commonMain/kotlin/dev/hicka04/pokedex/core/domain/Greeting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
class Greeting { | ||
private val platform: Platform = getPlatform() | ||
|
||
fun greet(): String { | ||
return "Hello, ${platform.name}!" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
core/domain/src/commonMain/kotlin/dev/hicka04/pokedex/core/domain/Platform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
interface Platform { | ||
val name: String | ||
} | ||
|
||
expect fun getPlatform(): Platform |
12 changes: 12 additions & 0 deletions
12
core/domain/src/commonTest/kotlin/dev/hicka04/pokedex/core/domain/Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class CommonGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue(Greeting().greet().contains("Hello"), "Check 'Hello' is mentioned") | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
core/domain/src/iosMain/kotlin/dev/hicka04/pokedex/core/domain/Platform.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
import platform.UIKit.UIDevice | ||
|
||
class IOSPlatform: Platform { | ||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion | ||
} | ||
|
||
actual fun getPlatform(): Platform = IOSPlatform() |
12 changes: 12 additions & 0 deletions
12
core/domain/src/iosTest/kotlin/dev/hicka04/pokedex/core/domain/Test.ios.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.hicka04.pokedex.core.domain | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class IosGreetingTest { | ||
|
||
@Test | ||
fun testExample() { | ||
assertTrue(Greeting().greet().contains("iOS"), "Check iOS is mentioned") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters