-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for KMP/JVM targets (#196)
- Loading branch information
Showing
26 changed files
with
211 additions
and
12 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
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
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
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
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,34 @@ | ||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension | ||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin | ||
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension | ||
|
||
plugins { | ||
alias(libs.plugins.android.lib) | ||
alias(libs.plugins.kotlin.multiplatform) | ||
} | ||
|
||
afterEvaluate { | ||
rootProject.the<NodeJsRootExtension>().download = false | ||
rootProject.the<YarnRootExtension>().download = false | ||
} | ||
|
||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(11)) | ||
|
||
android { | ||
namespace = "com.example.login" | ||
|
||
compileSdk = libs.versions.android.compileSDK.get().toInt() | ||
defaultConfig { | ||
minSdk = libs.versions.android.minSDK.get().toInt() | ||
} | ||
} | ||
|
||
kotlin { | ||
androidTarget() | ||
jvm() | ||
js { nodejs() } | ||
} | ||
|
||
dependencies { | ||
commonTestImplementation(libs.kotlin.test) | ||
} |
7 changes: 7 additions & 0 deletions
7
demo-project/kmp/src/androidMain/kotlin/com/example/kmp/KMPObjectAndroid.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 com.example.kmp | ||
|
||
object KMPObjectAndroid { | ||
|
||
val platform = PLATFORM | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
demo-project/kmp/src/androidMain/kotlin/com/example/kmp/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,3 @@ | ||
package com.example.kmp | ||
|
||
internal actual val PLATFORM = "android" |
13 changes: 13 additions & 0 deletions
13
demo-project/kmp/src/androidUnitTest/kotlin/com/example/kmp/KMPObjectAndroidTest.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,13 @@ | ||
package com.example.kmp | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class KMPObjectAndroidTest { | ||
|
||
@Test | ||
fun testKMPObject() { | ||
assertEquals(PLATFORM, KMPObjectAndroid.platform) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
demo-project/kmp/src/commonMain/kotlin/com/example/kmp/KMPObject.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 com.example.kmp | ||
|
||
object KMPObject { | ||
|
||
val platform = PLATFORM | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
demo-project/kmp/src/commonMain/kotlin/com/example/kmp/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,3 @@ | ||
package com.example.kmp | ||
|
||
internal expect val PLATFORM: String |
13 changes: 13 additions & 0 deletions
13
demo-project/kmp/src/commonTest/kotlin/com/example/kmp/KMPObjectTest.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,13 @@ | ||
package com.example.kmp | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class KMPObjectTest { | ||
|
||
@Test | ||
fun testKMPObject() { | ||
assertEquals(PLATFORM, KMPObject.platform) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
demo-project/kmp/src/jsMain/kotlin/com/example/kmp/KMPObjectJS.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 com.example.kmp | ||
|
||
object KMPObjectJS { | ||
|
||
val platform = PLATFORM | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
demo-project/kmp/src/jsMain/kotlin/com/example/kmp/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,3 @@ | ||
package com.example.kmp | ||
|
||
internal actual val PLATFORM = "js" |
13 changes: 13 additions & 0 deletions
13
demo-project/kmp/src/jsTest/kotlin/com/example/kmp/KMPObjectJSTest.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,13 @@ | ||
package com.example.kmp | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class KMPObjectJSTest { | ||
|
||
@Test | ||
fun testKMPObject() { | ||
assertEquals(PLATFORM, KMPObjectJS.platform) | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
demo-project/kmp/src/jvmMain/kotlin/com/example/kmp/KMPObjectJVM.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 com.example.kmp | ||
|
||
object KMPObjectJVM { | ||
|
||
val platform = PLATFORM | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
demo-project/kmp/src/jvmMain/kotlin/com/example/kmp/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,3 @@ | ||
package com.example.kmp | ||
|
||
internal actual val PLATFORM = "jvm" |
13 changes: 13 additions & 0 deletions
13
demo-project/kmp/src/jvmTest/kotlin/com/example/kmp/KMPObjectJVMTest.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,13 @@ | ||
package com.example.kmp | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class KMPObjectJVMTest { | ||
|
||
@Test | ||
fun testKMPObject() { | ||
assertEquals(PLATFORM, KMPObjectJVM.platform) | ||
} | ||
|
||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.