Skip to content

Commit 1863562

Browse files
feat: publish iosX64 & iosSimulatorArm64 artifacts
Closes #15
1 parent 2dc325b commit 1863562

File tree

4 files changed

+47
-6
lines changed

4 files changed

+47
-6
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ jobs:
4343
- os: windows-latest
4444
platform: Windows
4545
targets: mingwX64Test
46+
- os: macos-13
47+
platform: macOS/iOS (x64)
48+
targets: macosX64Test iosX64Test
4649
- os: macos-14
47-
platform: macOS/iOS
48-
targets: macosX64Test macosArm64Test iosSimulatorArm64Test
50+
platform: macOS/iOS (arm64)
51+
targets: macosArm64Test iosSimulatorArm64Test
4952
steps:
5053
- name: Checkout repository
5154
uses: actions/checkout@v4

.github/workflows/publish.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111
jobs:
1212
build:
1313
runs-on: ${{matrix.os}}
14-
name: Build ${{matrix.platform}} packages
14+
name: Build ${{matrix.platform}}${{matrix.arch != '' && format(' ({0})', matrix.arch) || ''}}) packages
1515
strategy:
1616
fail-fast: false
1717
matrix:
@@ -36,12 +36,19 @@ jobs:
3636
- os: windows-latest
3737
platform: Windows
3838
targets: publishMingwX64PublicationToLocalRepository
39-
- os: macos-14
39+
- os: macos-13
4040
platform: macOS/iOS
41+
arch: x64
4142
targets: >-
4243
publishMacosX64PublicationToLocalRepository
44+
publishIosX64PublicationToLocalRepository
45+
- os: macos-14
46+
platform: macOS/iOS
47+
arch: arm64
48+
targets: >-
4349
publishMacosArm64PublicationToLocalRepository
4450
publishIosArm64PublicationToLocalRepository
51+
publishIosSimulatorArm64PublicationToLocalRepository
4552
steps:
4653
- name: Checkout repository
4754
uses: actions/checkout@v4
@@ -86,7 +93,7 @@ jobs:
8693
- name: Upload artifacts
8794
uses: actions/upload-artifact@v4
8895
with:
89-
name: kbigint-${{matrix.platform == 'macOS/iOS' && 'macOS-iOS' || matrix.platform}}
96+
name: kbigint-${{matrix.platform == 'macOS/iOS' && format('macOS-iOS-{0}', matrix.arch) || matrix.platform}}
9097
path: |
9198
build/repo/**
9299
!build/repo/**/maven-metadata.*

kbigint-serialization/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ kotlin {
6060
macosX64 {}
6161
macosArm64 {}
6262
iosArm64 {}
63+
iosX64 {}
6364
iosSimulatorArm64 {}
6465
}
6566

kbigint/build.gradle.kts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ kotlin {
7373
macosArm64 { libtommath() }
7474
macosX64 { libtommath() }
7575
iosArm64 { libtommath() }
76+
iosX64 { libtommath() }
7677
iosSimulatorArm64 { libtommath() }
7778
}
7879

@@ -296,14 +297,43 @@ if (os.isLinux) {
296297
}
297298
}
298299

300+
tasks.getByName<CInteropProcess>("cinteropTommathIosX64") {
301+
outputs.file(libsDir.dir(konanTarget.name).file("libtommath.a"))
302+
303+
doFirst {
304+
val output = ByteArrayOutputStream()
305+
exec {
306+
standardOutput = output
307+
commandLine("xcrun", "--sdk", "iphonesimulator", "--show-sdk-path")
308+
}
309+
val sysroot = output.use { it.toString().trimEnd() }
310+
311+
exec {
312+
executable = "make"
313+
workingDir = libtommathDir
314+
args("clean", "libtommath.a")
315+
316+
environment["ARFLAGS"] = "rcs"
317+
environment["CFLAGS"] = "-O2 -DMP_NO_FILE -DMP_USE_ENUMS" +
318+
" --target=x86_64-apple-ios-simulator -isysroot $sysroot -Wno-unused-but-set-variable"
319+
environment["CC"] = "clang"
320+
}
321+
322+
copy {
323+
from(libtommathDir.resolve("libtommath.a"))
324+
into(libsDir.dir(konanTarget.name))
325+
}
326+
}
327+
}
328+
299329
tasks.getByName<CInteropProcess>("cinteropTommathIosSimulatorArm64") {
300330
outputs.file(libsDir.dir(konanTarget.name).file("libtommath.a"))
301331

302332
doFirst {
303333
val output = ByteArrayOutputStream()
304334
exec {
305335
standardOutput = output
306-
commandLine("xcrun", "--sdk", "iphoneos", "--show-sdk-path")
336+
commandLine("xcrun", "--sdk", "iphonesimulator", "--show-sdk-path")
307337
}
308338
val sysroot = output.use { it.toString().trimEnd() }
309339

0 commit comments

Comments
 (0)