Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Build and test
run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
- name: Install pods with kotlin
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
- name: Publish library
run: ./gradlew publish
java-version: 17
- name: Prebuild library
run: ./gradlew publishToMavenLocal
- name: Publish
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

release:
name: Create release
needs: publish
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.classpath
.vscode
.idea
.kotlin
build
*.iml
Pods
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
![moko-javascript](https://user-images.githubusercontent.com/5010169/128704305-df9c8e9e-200c-4d34-801e-a5b01c80f0cb.png)
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/javascript) ](https://repo1.maven.org/maven2/dev/icerock/moko/javascript) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko&name=javascript)

# Mobile Kotlin javascript
Expand All @@ -18,8 +19,8 @@ This is a Kotlin MultiPlatform library that allows you to run JavaScript code fr
- Pass objects to JavaScript as global vars

## Requirements
- Gradle version 6.0+
- Android API 16+
- Gradle version 8.0+
- Android API 21+
- iOS version 9.0+

## Installation
Expand All @@ -35,7 +36,7 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:javascript:0.3.0")
commonMainApi("dev.icerock.moko:javascript:0.4.0")
}
```

Expand Down
20 changes: 0 additions & 20 deletions build.gradle

This file was deleted.

34 changes: 34 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2025 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
apply(plugin = "dev.icerock.moko.gradle.publication.nexus")

buildscript {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath(libs.mokoGradlePlugin)
classpath("app.cash.zipline:zipline-gradle-plugin:1.23.0")
classpath(":javascript-build-logic")
}
}

val mokoVersion = moko.versions.mokoJavascriptVersion.get()
allprojects {
group = "dev.icerock.moko"
version = mokoVersion
}

tasks.register("clean", Delete::class).configure {
group = "build"
delete(rootProject.layout.buildDirectory)
}
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ org.gradle.configureondemand=false
org.gradle.parallel=true

kotlin.code.style=official
kotlin.native.enableDependencyPropagation=false
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.enableCompatibilityMetadataVariant=true

android.useAndroidX=true

mobile.multiplatform.iosTargetWarning=false
kotlin.mpp.defaultHierarchies.template.enabled=false
38 changes: 23 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
[versions]
kotlinTestVersion = "1.6.21"
androidAppCompatVersion = "1.2.0"
materialDesignVersion = "1.0.0"
androidLifecycleVersion = "2.1.0"
androidCoreTestingVersion = "1.3.0"
testJUnitExtVersion = "1.1.2"
quickjsVersion = "0.9.2"
coroutinesVersion = "1.6.0-native-mt"
kotlinxSerializationVersion = "1.3.3"
kotlinVersion = "2.2.10"
androidAppCompatVersion = "1.7.1"
materialDesignVersion = "1.13.0"
androidLifecycleVersion = "2.2.0"
androidCoreTestingVersion = "1.7.0"
testJUnitExtVersion = "1.3.0"
coroutinesVersion = "1.10.2"
kotlinxSerializationVersion = "1.9.0"
mokoTestVersion = "0.6.1"
mokoJavascriptVersion = "0.3.0"

ziplineVersion = "1.23.0"
mokoMultiplatformVersion = "0.14.4"
androidGradleVersion = "8.12.3"
detektVersion = "1.23.8"

[libraries]
appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }
material = { module = "com.google.android.material:material", version.ref = "materialDesignVersion" }
lifecycle = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "androidLifecycleVersion" }
kotlinTestJUnit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlinTestVersion" }
kotlinTestJUnit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlinVersion" }
testRunner = { module = "androidx.test:runner", version.ref = "androidCoreTestingVersion" }
testRules = { module = "androidx.test:rules", version.ref = "androidCoreTestingVersion" }
testJUnitExt = { module = "androidx.test.ext:junit", version.ref = "testJUnitExtVersion" }
testJUnitExtKtx = { module = "androidx.test.ext:junit-ktx", version.ref = "testJUnitExtVersion" }
quickjs = { module = "app.cash.quickjs:quickjs-android", version.ref = "quickjsVersion" }
ziplineAndroid = { module = "app.cash.zipline:zipline-android", version.ref = "ziplineVersion" }
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutinesVersion" }
kotlinSerialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationVersion" }
kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlinTestVersion" }
kotlinTestAnnotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlinTestVersion" }
kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlinVersion" }
kotlinTestAnnotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlinVersion" }
mokoTest = { module = "dev.icerock.moko:test-core", version.ref = "mokoTestVersion" }

mokoMultiplatform = { module = "dev.icerock:mobile-multiplatform", version.ref = "mokoMultiplatformVersion" }
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradleVersion" }
detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detektVersion" }
detektPlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detektVersion" }
mokoGradlePlugin = { module = "dev.icerock.moko:moko-gradle-plugin", version = "0.5.1" }
2 changes: 2 additions & 0 deletions gradle/moko.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[versions]
mokoJavascriptVersion = "0.4.0"
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Mon Sep 15 18:35:34 NOVT 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
17 changes: 11 additions & 6 deletions javascript-build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ plugins {
}

repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
google()

gradlePluginPortal()
}

dependencies {
api("dev.icerock:mobile-multiplatform:0.14.1")
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
api("com.android.tools.build:gradle:7.0.1")
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0")
api(libs.mokoMultiplatform)
api(libs.kotlinGradlePlugin)
api(libs.androidGradlePlugin)
api(libs.detektPlugin)
}
25 changes: 25 additions & 0 deletions javascript-build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2025 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

rootProject.name = "javascript-build-logic"

dependencyResolutionManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}

mavenCentral()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ plugins {
}

android {
dexOptions {
javaMaxHeapSize = "2g"
}

buildTypes {
getByName("release") {
isMinifyEnabled = true
Expand All @@ -24,9 +20,13 @@ android {
}
}

packagingOptions {
exclude("META-INF/*.kotlin_module")
exclude("META-INF/AL2.0")
exclude("META-INF/LGPL2.1")
packaging {
resources {
excludes += listOf(
"META-INF/*.kotlin_module",
"META-INF/AL2.0",
"META-INF/LGPL2.1"
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
import com.android.build.gradle.BaseExtension

configure<BaseExtension> {
compileSdkVersion(30)
compileSdkVersion(36)

defaultConfig {
minSdkVersion(18)
targetSdkVersion(30)
minSdk = 21
targetSdk = 36
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ plugins {
}

detekt {
input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin", "src/main/kotlin")
source.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin", "src/main/kotlin")
}

dependencies {
"detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.8")
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,50 @@ plugins {
}

kotlin {
ios()
iosX64()
iosArm64()
iosSimulatorArm64()
android {
androidTarget {
publishLibraryVariants("release", "debug")
}

sourceSets {
val commonMain by getting
val iosX64Main by getting
val iosArm64Main by getting
val iosSimulatorArm64Main by getting
val iosSimulatorArm64Test by getting

val mobileDeviceTest by creating

val commonTest by getting
val iosMain by getting
val iosTest by getting
val androidAndroidTest by getting
val iosMain by creating {
iosX64Main.dependsOn(this)
iosArm64Main.dependsOn(this)
iosSimulatorArm64Main.dependsOn(this)
}
iosMain.dependsOn(commonMain)

iosSimulatorArm64Main.dependsOn(iosMain)
iosSimulatorArm64Test.dependsOn(iosTest)
val iosX64Test by getting
val iosArm64Test by getting
val iosSimulatorArm64Test by getting

mobileDeviceTest.dependsOn(commonTest)
iosTest.dependsOn(mobileDeviceTest)
androidAndroidTest.dependsOn(mobileDeviceTest)
val commonTest by getting

val mobileDeviceTestNative by creating {
kotlin.srcDir("src/mobileDeviceTest/kotlin")
dependsOn(commonTest)
}

val iosTest by creating {
iosX64Test.dependsOn(this)
iosArm64Test.dependsOn(this)
iosSimulatorArm64Test.dependsOn(this)
dependsOn(mobileDeviceTestNative)
}

val mobileDeviceTestAndroid by creating {
kotlin.srcDir("src/mobileDeviceTest/kotlin")
}

val androidInstrumentedTest by getting {
dependsOn(mobileDeviceTestAndroid)
}
}
}

Loading
Loading