Skip to content

Commit 20d2f1d

Browse files
Updating Wasm implementation and Updating to Kotlin 2.0.21 (#413)
* Updating Wasm * updating workflows * Update .gitignore * updating gradle version * Update yarn.lock * Some updates related to Wasm and JS (#414) --------- Co-authored-by: Jigar Brahmbhatt <[email protected]>
1 parent 760a81e commit 20d2f1d

File tree

34 files changed

+1219
-2076
lines changed

34 files changed

+1219
-2076
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build
1+
name: build Mac
22
on:
33
pull_request:
44
push:
@@ -8,24 +8,14 @@ on:
88

99
jobs:
1010
build:
11-
strategy:
12-
matrix:
13-
os: [macOS-latest, windows-latest]
14-
runs-on: ${{matrix.os}}
11+
runs-on: macOS-latest
1512
steps:
1613
- name: Checkout the repo
1714
uses: actions/checkout@v2
1815
- uses: actions/setup-java@v2
1916
with:
2017
distribution: "adopt"
2118
java-version: "17"
22-
- name: Install msys2
23-
if: matrix.os == 'windows-latest'
24-
uses: msys2/setup-msys2@v2
25-
with:
26-
msystem: MINGW64
27-
update: true
28-
install: git mingw-w64-x86_64-toolchain
2919
- name: Validate Gradle Wrapper
3020
uses: gradle/wrapper-validation-action@v1
3121
- name: Cache gradle
@@ -42,26 +32,15 @@ jobs:
4232
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
4333
restore-keys: |
4434
${{ runner.os }}-gradle-
45-
- name: Build for MacOS
46-
if: matrix.os == 'macOS-latest'
35+
- name: Build
4736
run: ./gradlew build --no-daemon --stacktrace --build-cache
4837
env:
4938
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
5039
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
5140
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
5241
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
5342
CI: "true"
54-
- name: Build for Windows
55-
if: matrix.os == 'windows-latest'
56-
run: ./gradlew kotlinUpgradeYarnLock build -PenableWasm=false --no-daemon --stacktrace --build-cache
57-
env:
58-
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
59-
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
60-
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
61-
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
62-
CI: "true"
6343
- name: Local Publish For Samples
64-
if: matrix.os == 'macOS-latest'
6544
run: ./gradlew publishToMavenLocal --no-daemon --stacktrace --build-cache -PRELEASE_SIGNING_ENABLED=false
6645
env:
6746
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
@@ -70,7 +49,6 @@ jobs:
7049
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
7150
CI: "true"
7251
- name: script
73-
if: matrix.os == 'macOS-latest'
7452
env:
7553
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
7654
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
@@ -81,4 +59,4 @@ jobs:
8159
shell: bash
8260

8361
env:
84-
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"
62+
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"

.github/workflows/build_win.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: build Windows
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
steps:
13+
- name: Checkout the repo
14+
uses: actions/checkout@v2
15+
- uses: actions/setup-java@v2
16+
with:
17+
distribution: "adopt"
18+
java-version: "17"
19+
- name: Install msys2
20+
uses: msys2/setup-msys2@v2
21+
with:
22+
msystem: MINGW64
23+
update: true
24+
install: git mingw-w64-x86_64-toolchain
25+
- name: Validate Gradle Wrapper
26+
uses: gradle/wrapper-validation-action@v1
27+
- name: Cache gradle
28+
uses: actions/cache@v2
29+
with:
30+
path: ~/.gradle/caches
31+
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
32+
restore-keys: |
33+
${{ runner.os }}-gradle-
34+
- name: Cache konan
35+
uses: actions/cache@v2
36+
with:
37+
path: ~/.konan
38+
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
39+
restore-keys: |
40+
${{ runner.os }}-gradle-
41+
- name: Build
42+
run: ./gradlew mingwX64Test --no-daemon --stacktrace --build-cache
43+
env:
44+
S3_BUILD_CACHE_AWS_REGION: ${{ secrets.S3_BUILD_CACHE_AWS_REGION }}
45+
S3_BUILD_CACHE_BUCKET_NAME: ${{ secrets.S3_BUILD_CACHE_BUCKET_NAME }}
46+
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
47+
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
48+
CI: "true"
49+
50+
env:
51+
GRADLE_OPTS: -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ build/
1717

1818
local.properties
1919

20-
Pods
20+
Pods
21+
22+
# Intermediate klibs
23+
.kotlin

convention-plugins/src/main/kotlin/wasm-setup.gradle.kts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
99
*/
1010

11-
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
12-
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
13-
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
11+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
12+
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
1413

1514
plugins {
1615
kotlin("multiplatform")
@@ -21,18 +20,7 @@ kotlin {
2120
if (wasmEnabled) {
2221
@OptIn(ExperimentalWasmDsl::class)
2322
wasmJs {
24-
browser {
25-
commonWebpackConfig {
26-
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
27-
static = (static ?: mutableListOf()).apply {
28-
add(project.rootDir.path)
29-
}
30-
}
31-
}
32-
}
3323
nodejs()
34-
d8()
35-
binaries.executable()
3624
}
3725
}
3826

@@ -42,16 +30,15 @@ kotlin {
4230
group("jsAndWasmJs") {
4331
withJs()
4432
if (wasmEnabled) {
45-
withWasm()
33+
withWasmJs()
4634
}
4735
}
4836
}
4937
}
5038
}
5139

52-
if (project.findProperty("enableWasm") == "true") {
53-
rootProject.the<NodeJsRootExtension>().apply {
54-
nodeVersion = "21.0.0-v8-canary202309143a48826a08"
55-
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
40+
tasks.withType(KotlinCompilationTask::class).configureEach {
41+
compilerOptions {
42+
freeCompilerArgs.add("-Xexpect-actual-classes")
5643
}
5744
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ POM_DEVELOPER_URL=https://touchlab.co/
2525

2626
kotlin.js.ir.output.granularity=whole-program
2727
enableWasm=true
28-
kotlin.mpp.enableCInteropCommonization=true
28+
kotlin.mpp.enableCInteropCommonization=true
29+
kotlin.mpp.commonizerLogLevel=info

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ minSdk = "21"
44
compileSdk = "34"
55

66
# Dependencies
7-
kotlin = "1.9.22"
7+
kotlin = "2.0.21"
88
binaryCompatability = "0.13.2"
99

1010
androidx-core = "1.12.0"

gradle/wrapper/gradle-wrapper.jar

-19.4 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

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

gradlew.bat

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

0 commit comments

Comments
 (0)