Skip to content

Commit 2aca8b2

Browse files
authored
Merge pull request #14 from icerockdev/develop
Release 0.3.0
2 parents c2099c7 + f9698c9 commit 2aca8b2

File tree

15 files changed

+348
-76
lines changed

15 files changed

+348
-76
lines changed

.github/workflows/compilation-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
- name: Install pods with kotlin
2222
run: cd sample/ios-app && pod install
2323
- name: build ios sample
24-
run: cd sample/ios-app && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty
24+
run: cd sample/ios-app && set -o pipefail && xcodebuild -scheme ios-app -workspace ios-app.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty

.idea/copyright/IceRock.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ allprojects {
3636
project build.gradle
3737
```groovy
3838
dependencies {
39-
commonMainApi("dev.icerock.moko:javascript:0.2.0")
39+
commonMainApi("dev.icerock.moko:javascript:0.3.0")
4040
}
4141
```
4242

gradle/libs.versions.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[versions]
2-
kotlinTestVersion = "1.5.20"
2+
kotlinTestVersion = "1.6.21"
33
androidAppCompatVersion = "1.2.0"
44
materialDesignVersion = "1.0.0"
55
androidLifecycleVersion = "2.1.0"
66
androidCoreTestingVersion = "1.3.0"
77
testJUnitExtVersion = "1.1.2"
8-
quickjsVersion = "0.9.0"
9-
coroutinesVersion = "1.5.0-native-mt"
10-
kotlinxSerializationVersion = "1.1.0"
11-
mokoTestVersion = "0.4.0"
12-
mokoJavascriptVersion = "0.2.0"
8+
quickjsVersion = "0.9.2"
9+
coroutinesVersion = "1.6.0-native-mt"
10+
kotlinxSerializationVersion = "1.3.3"
11+
mokoTestVersion = "0.6.1"
12+
mokoJavascriptVersion = "0.3.0"
1313

1414

1515
[libraries]

javascript-build-logic/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ repositories {
1010
}
1111

1212
dependencies {
13-
api("dev.icerock:mobile-multiplatform:0.12.0")
14-
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20")
15-
api("com.android.tools.build:gradle:4.2.1")
13+
api("dev.icerock:mobile-multiplatform:0.14.1")
14+
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
15+
api("com.android.tools.build:gradle:7.0.1")
1616
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0")
1717
}

javascript-build-logic/src/main/kotlin/multiplatform-library-convention.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,23 @@ plugins {
1111

1212
kotlin {
1313
ios()
14+
iosSimulatorArm64()
1415
android {
1516
publishLibraryVariants("release", "debug")
1617
}
1718
sourceSets {
19+
val iosSimulatorArm64Main by getting
20+
val iosSimulatorArm64Test by getting
21+
1822
val mobileDeviceTest by creating
1923

2024
val commonTest by getting
25+
val iosMain by getting
2126
val iosTest by getting
2227
val androidAndroidTest by getting
2328

29+
iosSimulatorArm64Main.dependsOn(iosMain)
30+
iosSimulatorArm64Test.dependsOn(iosTest)
2431

2532
mobileDeviceTest.dependsOn(commonTest)
2633
iosTest.dependsOn(mobileDeviceTest)

javascript/build.gradle.kts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,29 @@
22
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
6+
import org.gradle.api.tasks.testing.logging.TestLogEvent
7+
58
plugins {
69
id("multiplatform-library-convention")
710
id("dev.icerock.mobile.multiplatform.android-manifest")
811
id("publication-convention")
912
}
1013

14+
android {
15+
testOptions.unitTests.isIncludeAndroidResources = true
16+
defaultConfig {
17+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
sourceSets {
21+
getByName("androidTest").java.srcDirs(
22+
file("src/androidAndroidTest/kotlin"),
23+
file("src/mobileDeviceTest/kotlin")
24+
)
25+
}
26+
}
27+
1128
dependencies {
1229
androidMainImplementation(libs.quickjs)
1330
commonMainImplementation(libs.kotlinSerialization)
@@ -20,3 +37,16 @@ dependencies {
2037
androidTestImplementation(libs.testJUnitExt)
2138
androidTestImplementation(libs.testJUnitExtKtx)
2239
}
40+
41+
tasks.withType<AbstractTestTask> {
42+
testLogging {
43+
exceptionFormat = TestExceptionFormat.FULL
44+
events = setOf(
45+
TestLogEvent.SKIPPED,
46+
TestLogEvent.PASSED,
47+
TestLogEvent.FAILED
48+
)
49+
showStandardStreams = true
50+
}
51+
outputs.upToDateWhen { false }
52+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2022 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package dev.icerock.moko.javascript
6+
7+
internal interface ContextProvider {
8+
fun getBool(name: String): Boolean
9+
fun getDouble(name: String): Double
10+
11+
fun getString(name: String): String
12+
13+
fun getScript(): String
14+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2022 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package dev.icerock.moko.javascript
6+
7+
internal class ContextProviderDynamic : ContextProvider {
8+
var context: Map<String, JsType> = emptyMap()
9+
var activeScript: String = ""
10+
11+
override fun getBool(name: String): Boolean {
12+
return context[name]!!.boolValue()
13+
}
14+
15+
override fun getDouble(name: String): Double {
16+
return context[name]!!.doubleValue()
17+
}
18+
19+
override fun getString(name: String): String {
20+
val jsType: JsType = context[name]!!
21+
return when (jsType) {
22+
is JsType.Bool, is JsType.DoubleNum, JsType.Null -> throw IllegalArgumentException()
23+
is JsType.Json -> jsType.value.toString()
24+
is JsType.Str -> jsType.value
25+
}
26+
}
27+
28+
override fun getScript(): String = activeScript
29+
}

0 commit comments

Comments
 (0)