Skip to content

Commit 718ce4d

Browse files
wkal-pubnubjguz-pubnubparfeonmarcin-cebopubnub-release-bot
authored
Merge kmp-dev to master (#283)
* Base KMP structure with no JS or iOS implementations. * Change Any to Map for custom in PNChannelMetadata * Add JS wrappers for some endpoints (#212) * Add JS wrappers for some endpoints * Fix exception due to non working expect/actual annotation * First tests for common code * Add Swift wrappers for some endpoints * Add unsubscribeAll * Allow running tests on iOS * Add back imports --------- Co-authored-by: jguz-pubnub <[email protected]> * Continue adding JS implementations for KMP (#215) * Add JS wrappers for some endpoints * First tests for common code * Add integrationTest gradle task * [JS] Fix JsonElement casts * We can run iOS tests now. * Configurable iOS simulator through gradle.properties * Make listeners work in JS and update PublishTest * Only run simulator tasks on macOs hosts * Add getState, deleteChannelGroup and grantToken for JS KMP * Add mapCatching to Result * Kotlin 2.0, keys in tests, more JS endpoints (#217) * [JS] Time and UUIDMetadata endpoints * Bump Kotlin version to 2.0.0 stable * Add buildKonfig for loading API keys in tests * Don't fail on missing test.properties * Added Swift wrappers for push notification methods (#216) * UUID & channel metadata (#218) * Tests for UUID metadata + setChannelMetadata test and impl * Channel metadata get & remove, tests & impl * Fix sort parameter * Added Swift wrappers for next endpoints (#221) * JS cleanups and membership related endpoints (#220) * [JS] membership related methods * [JS] Cleanup PN JS bindings file * [JS] Deduplicate data converters * [JS] Fixing memberships events and adding tests (WIP) * Tests continued * [IOS] catch exception in mapper + formatting * Wrapping next Swift endpoints (#224) * Message payloads, metadata & status code in exceptions (#223) * Use large GitHub runner (#219) build(runner): change runner groups * Get message payload and metadata working in iOS and tests * Disallow DTDs in XML parser (#222) * Disallow DTDs in XML parser * [Common] Add status code to PubNubException * delete unneeded codable * Fix build --------- Co-authored-by: Serhii Mamontov <[email protected]> * Add wrapException to Result * Wrapping status listener and some AppContext methods (#225) * Add creation of JsonElement to common code (#228) * Allow creation of JsonElement for tests * Merge changes from master * Add Swift git submodule (#230) * Added constructor for testing purpose. (#231) * Merge master changes to kmp branch (#234) * Use large GitHub runner (#219) build(runner): change runner groups * Disallow DTDs in XML parser (#222) * Disallow DTDs in XML parser * GCM to FCM migration in PushPayloadHelper (#227) * GCM to FCM migration in PushPayloadHelper * Mc/add integ test (#226) * v.9.2.0 release with FCMPayloadV2 * Enforce string-only values in data * Fix enum values and use deprecation instead of breaking change * PubNub SDK v9.2.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> --------- Co-authored-by: Serhii Mamontov <[email protected]> Co-authored-by: marcin-cebo <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]> * Wrapping next AppContext methods (#229) * [KMP] Move tests and make more tests work on iOS (#235) * [JS] Add files related methods (#236) * [JS] Add all file methods * PNFuture chaining methods * More PNFuture composing functions * PNFuture.awaitAll types fix * Merge fixes * Fix futures package * Wrapping remaining AppContext methods + Files API (#237) * Finish rest of required JS wrapper methods (basic entity/subscription support) (#238) * Commonize entities and subscriptions * Remove expect/actual PubNub interfaces * [JS] Basic channel entity and subscription * [JS] Add missing methods * Alias c.p.kmp.PubNub and import c.p.api.PubNub * File download + File upload (#239) * Wrapping entities and Subscription/SubscriptionSet (#241) * Add IncludeType, fix futures.awaitAll and listener classcastexception on JS (#240) * Changes for integration tests, add includeType * Add includeType and fix PNFuture * Listener fixes * Minor improvements for iosMain (#242) * Getting rid of warnings related to Maps * Ensuring that JsonImpl is used as expected * Added some missing implementations in PubNubImpl.kt * Updated submodule * Added secret key to configuration (#243) * Added secret key for tests (#244) * PNFuture variance fix (#245) * SubscriptionSetImpl in JS and PNFuture.remember() (#246) * Tests, fixes (#247) * Various JS test fixes * More JS tests * More tests * More KMP tests (#248) * More tests and fixing equality checks in JSONElement * Change GSON number strategy to lazily parsed (#250) All custom objects will contain Number in place of integers or doubles that need to be changed to desired concrete types with toLong etc. This is a breaking change. * Fixes for custom fields (AppContext) and push methods (#252) * Fixes for custom fields (AppContext) and push methods * Fix for SetChannelMembersImpl * Added missing changes from swift repository * Fix for factories.ios.kt * Some test fixes --------- Co-authored-by: Wojciech Kaliciński <[email protected]> * Change actionTimetoken to Long, ktlint, tests (#253) * More tests * Change timetokens to long * Re-add ktLint * parseToken and test fixture changes (#254) * Refactoring around PNConfiguration (#255) * Fixing integration tests for iOS (#256) * iOS test changes (#257) * Add JsonElement test * Changes for Chat project * Get rid of com.pubnub.kmp.PubNub (#261) * Using InputStream instead of URL in StreamUploadContent (#259) * Merge changes from master to kmp-dev (#263) * Use large GitHub runner (#219) build(runner): change runner groups * Disallow DTDs in XML parser (#222) * Disallow DTDs in XML parser * GCM to FCM migration in PushPayloadHelper (#227) * GCM to FCM migration in PushPayloadHelper * Mc/add integ test (#226) * v.9.2.0 release with FCMPayloadV2 * Enforce string-only values in data * Fix enum values and use deprecation instead of breaking change * PubNub SDK v9.2.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Added sorting to integ test. (#233) * Add missing auth_method to APNS2 configuration (#249) * Add missing auth_method to APNS2 configuration * PubNub SDK v9.2.1 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * SetState via Heartbeat fix. (#251) * PubNub SDK v9.2.2 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Fix RetryRemoteAction double callback (#262) * Fix RetryRemoteAction double callback * PubNub SDK v9.2.3 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * lint --------- Co-authored-by: Serhii Mamontov <[email protected]> Co-authored-by: marcin-cebo <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]> * Fix obvious typo in JS wrapper * Handling missing includeType parameter (AppContext) (#264) * Build scripts with non-JVM targets disabled (#265) * Selectively enable targets * Add test logging * Move integration tests * Revert configuration caching * Test utils for kmp-chat * [Kotlin] Change PNChannelMetadata and PNUUIDMetadata to contain partial update information (#266) * Add partial updates when querying channel metadata * Add partial updates when querying user metadata * Deprecate TTL parameter in PubNub.fire() * Partial updates for membership information (#267) * Added missing implementations for iOS target (#268) * Version bumps, test fixture fix (#273) * Handling missing ReceivePresenceEvents options (#274) * Updating Channel/UUID metadata with PatchValue (#271) * Fixes according to swift module changes (#276) * Fixed import statements in iosMain due to names refactor (adding the KMP prefix) in the swift submodule * Made changes in the swift submodule, replacing the product name with PubNubSDK * Changed module name in PubNubKotlinMultiplatformPlugin.kt due to the point mentioned above * Change dependencies so that Java SDK depends on Kotlin SDK (#269) * Use large GitHub runner (#219) build(runner): change runner groups * Disallow DTDs in XML parser (#222) * Disallow DTDs in XML parser * GCM to FCM migration in PushPayloadHelper (#227) * GCM to FCM migration in PushPayloadHelper * Mc/add integ test (#226) * v.9.2.0 release with FCMPayloadV2 * Enforce string-only values in data * Fix enum values and use deprecation instead of breaking change * PubNub SDK v9.2.0 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Added sorting to integ test. (#233) * Add missing auth_method to APNS2 configuration (#249) * Add missing auth_method to APNS2 configuration * PubNub SDK v9.2.1 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * SetState via Heartbeat fix. (#251) * PubNub SDK v9.2.2 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Fix RetryRemoteAction double callback (#262) * Fix RetryRemoteAction double callback * PubNub SDK v9.2.3 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Java SDK now depends on Kotlin SDK * java.Subscription should not inherint kotlin.Subscription * Some more minor changes, migration generator * Rename PubNubForJava to PubNub * Fix crash on Android in retry logic after destroy called (#270) * Fix crash on Android in retry logic after destroy called * PubNub SDK v9.2.4 release. --------- Co-authored-by: PubNub Release Bot <[email protected]> * Fix iOS build * Move checkstyle settings to plugin --------- Co-authored-by: Serhii Mamontov <[email protected]> Co-authored-by: marcin-cebo <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]> Co-authored-by: marcin.cebo <[email protected]> * Small fixes after merge * Updating swift submodule (#278) * Uploading swift submodule with recent changes from master * Setting uuid field in KMPPresenceChange.swift * Added @ObjCName annotation and helper constructor (iOS) (#280) * Add PatchValue to Java API (#281) * Add PatchValue to Java API * Change custom Object to Map in Java * Formatting --------- Co-authored-by: jguz-pubnub <[email protected]> Co-authored-by: jguz-pubnub <[email protected]> Co-authored-by: Serhii Mamontov <[email protected]> Co-authored-by: marcin-cebo <[email protected]> Co-authored-by: PubNub Release Bot <[email protected]> Co-authored-by: marcin.cebo <[email protected]>
1 parent 195c321 commit 718ce4d

File tree

1,460 files changed

+35273
-26266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,460 files changed

+35273
-26266
lines changed

.github/workflows/release/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"clearedSuffix": false
5555
}
5656
],
57-
"pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt": [
57+
"pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubImplTest.kt": [
5858
{
5959
"pattern": "assertEquals\\(\"(v?(\\d+\\.?){2,}([a-zA-Z0-9-]+(\\.?\\d+)?)?)\", version\\)$",
6060
"clearedPrefix": true,

.github/workflows/run-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
- name: Build and run tests
3232
run: |
3333
./gradlew check
34+
env:
35+
SDK_PUB_KEY: ${{ secrets.SDK_PUB_KEY }}
36+
SDK_SUB_KEY: ${{ secrets.SDK_SUB_KEY }}
37+
SDK_PAM_SUB_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
38+
SDK_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
39+
SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
3440
- name: Cancel workflow runs for commit on error
3541
if: failure()
3642
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure

.github/workflows/run-validations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
restore-keys: |
5050
${{ runner.os }}-gradle-
5151
- name: Validate clean build
52-
run: ./gradlew build
52+
run: ./gradlew ktlintFormat publishAllPublicationsToRepoRepository -PRELEASE_SIGNING_ENABLED=false
5353
- name: Cancel workflow runs for commit on error
5454
if: failure()
5555
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.kotlin
12
examples
23
.gradle/
34
.idea/

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "swift"]
2+
path = swift
3+
url = https://github.com/pubnub/swift
4+
branch = feat/kmp2

build-logic/gradle-plugins/build.gradle.kts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ plugins {
33
alias(libs.plugins.kotlin.jvm)
44
}
55

6-
kotlin {
7-
jvmToolchain(8)
8-
}
9-
106
dependencies {
117
compileOnly(gradleKotlinDsl())
128
compileOnly(libs.nexus.gradlePlugin)
@@ -30,5 +26,25 @@ gradlePlugin {
3026
id = "pubnub.integration-test"
3127
implementationClass = "com.pubnub.gradle.PubNubIntegrationTestPlugin"
3228
}
29+
register("pubnubTest") {
30+
id = "pubnub.test"
31+
implementationClass = "com.pubnub.gradle.PubNubTestPlugin"
32+
}
33+
register("pubnubJavaLibrary") {
34+
id = "pubnub.java-library"
35+
implementationClass = "com.pubnub.gradle.PubNubJavaLibraryPlugin"
36+
}
37+
register("pubnubKotlinLibrary") {
38+
id = "pubnub.kotlin-library"
39+
implementationClass = "com.pubnub.gradle.PubNubKotlinLibraryPlugin"
40+
}
41+
register("pubnubIosSimulatorTest") {
42+
id = "pubnub.ios-simulator-test"
43+
implementationClass = "com.pubnub.gradle.PubNubIosSimulatorTestPlugin"
44+
}
45+
register("pubnubMultiplatform") {
46+
id = "pubnub.multiplatform"
47+
implementationClass = "com.pubnub.gradle.PubNubKotlinMultiplatformPlugin"
48+
}
3349
}
3450
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
org.gradle.parallel=true
1+
org.gradle.parallel=false
22
org.gradle.caching=true
3-
org.gradle.configureondemand=true
3+
org.gradle.configuration-cache=true

build-logic/gradle-plugins/src/main/kotlin/com/pubnub/gradle/PubNubDokkaPlugin.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ class PubNubDokkaPlugin : Plugin<Project> {
1414
apply<DokkaPlugin>()
1515

1616
tasks.withType<DokkaTask>().configureEach { task ->
17-
task.dokkaSourceSets.configureEach {
18-
it.perPackageOption {
17+
task.notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
18+
task.dokkaSourceSets.configureEach { sourceSetBuilder ->
19+
sourceSetBuilder.perPackageOption {
1920
it.matchingRegex.set(".*internal.*")
2021
it.suppress.set(true)
2122
}
22-
it.skipEmptyPackages.set(true)
23+
sourceSetBuilder.skipEmptyPackages.set(true)
2324
}
2425
}
2526

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package com.pubnub.gradle
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.api.tasks.Exec
6+
import org.gradle.kotlin.dsl.apply
7+
import org.gradle.kotlin.dsl.configure
8+
import org.gradle.kotlin.dsl.register
9+
import org.gradle.kotlin.dsl.withType
10+
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
11+
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
12+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
13+
import org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable
14+
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
15+
import java.io.ByteArrayOutputStream
16+
17+
class PubNubIosSimulatorTestPlugin : Plugin<Project> {
18+
override fun apply(target: Project) {
19+
with(target) {
20+
apply<KotlinMultiplatformPluginWrapper>()
21+
22+
val deviceName = project.findProperty("IOS_SIMULATOR_ID") as? String ?: "iPhone 15 Pro"
23+
val isMacOs = providers.systemProperty("os.name").map { it.contains("mac", ignoreCase = true) }
24+
25+
val bootTask = tasks.register<Exec>("bootIOSSimulator") {
26+
onlyIf { isMacOs.get() }
27+
isIgnoreExitValue = true
28+
commandLine("xcrun", "simctl", "boot", deviceName)
29+
doLast {
30+
val result = executionResult.get()
31+
if (result.exitValue != 148 && result.exitValue != 149) { // ignoring device already booted errors
32+
result.assertNormalExitValue()
33+
}
34+
}
35+
}
36+
37+
// val shutdownTask = tasks.register<Exec>("shutdownIOSSimulator") {
38+
// onlyIf { isMacOs.get() }
39+
// commandLine("xcrun", "simctl", "shutdown", deviceName)
40+
// dependsOn(tasks.withType<KotlinNativeSimulatorTest>())
41+
// }
42+
43+
tasks.withType<KotlinNativeSimulatorTest>().configureEach {
44+
it.onlyIf { isMacOs.get() }
45+
it.standalone.set(false)
46+
it.device.set(deviceName)
47+
it.dependsOn(bootTask)
48+
// it.finalizedBy(shutdownTask)
49+
}
50+
51+
extensions.configure<KotlinMultiplatformExtension> {
52+
targets.withType<KotlinNativeTarget> {
53+
if (konanTarget.family.isAppleFamily) {
54+
binaries.withType<TestExecutable> {
55+
freeCompilerArgs += listOf("-e", "testlauncher.mainBackground")
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.pubnub.gradle
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.api.plugins.JavaLibraryPlugin
6+
import org.gradle.api.plugins.quality.Checkstyle
7+
import org.gradle.api.plugins.quality.CheckstyleExtension
8+
import org.gradle.api.plugins.quality.CheckstylePlugin
9+
import org.gradle.api.tasks.SourceSetContainer
10+
import org.gradle.api.tasks.compile.JavaCompile
11+
import org.gradle.kotlin.dsl.apply
12+
import org.gradle.kotlin.dsl.configure
13+
import org.gradle.kotlin.dsl.getByType
14+
import org.gradle.kotlin.dsl.withType
15+
16+
class PubNubJavaLibraryPlugin : Plugin<Project> {
17+
override fun apply(target: Project) {
18+
with(target) {
19+
apply<PubNubSharedPlugin>()
20+
apply<JavaLibraryPlugin>()
21+
apply<CheckstylePlugin>()
22+
23+
tasks.withType<JavaCompile>().configureEach {
24+
it.options.compilerArgs.add("-parameters")
25+
}
26+
27+
extensions.configure<CheckstyleExtension> {
28+
toolVersion = "8.14"
29+
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
30+
sourceSets = listOf(extensions.getByType<SourceSetContainer>().getByName("main"))
31+
}
32+
33+
tasks.withType<Checkstyle>().configureEach {
34+
it.exclude("**/vendor/**", "**/*Test*")
35+
36+
it.reports { report ->
37+
report.xml.required.set(true)
38+
report.html.required.set(true)
39+
}
40+
}
41+
42+
}
43+
}
44+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.pubnub.gradle
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.apply
6+
import org.gradle.kotlin.dsl.configure
7+
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
8+
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
9+
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
10+
11+
class PubNubKotlinLibraryPlugin : Plugin<Project> {
12+
override fun apply(target: Project) {
13+
with(target) {
14+
apply<PubNubSharedPlugin>()
15+
apply<KotlinPluginWrapper>()
16+
17+
// Kotlin
18+
extensions.configure<KotlinJvmProjectExtension> {
19+
jvmToolchain(8)
20+
}
21+
22+
tasks.named("compileKotlin", KotlinJvmCompile::class.java) {
23+
it.compilerOptions {
24+
javaParameters.set(true)
25+
freeCompilerArgs.add("-Xjvm-default=all")
26+
}
27+
}
28+
29+
}
30+
}
31+
}
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
package com.pubnub.gradle
2+
3+
import org.gradle.api.Plugin
4+
import org.gradle.api.Project
5+
import org.gradle.api.plugins.ExtensionAware
6+
import org.gradle.api.tasks.testing.AbstractTestTask
7+
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
8+
import org.gradle.kotlin.dsl.apply
9+
import org.gradle.kotlin.dsl.configure
10+
import org.gradle.kotlin.dsl.withType
11+
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
12+
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
13+
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension
14+
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin
15+
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
16+
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
17+
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn
18+
19+
class PubNubKotlinMultiplatformPlugin : Plugin<Project> {
20+
override fun apply(target: Project) {
21+
with(target) {
22+
apply<KotlinMultiplatformPluginWrapper>()
23+
if (enableAnyIosTarget) {
24+
apply<KotlinCocoapodsPlugin>()
25+
}
26+
27+
// Kotlin
28+
extensions.configure<KotlinMultiplatformExtension> {
29+
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
30+
jvmToolchain(8)
31+
32+
if (enableJsTarget) {
33+
js { ->
34+
useEsModules()
35+
browser {
36+
testTask {
37+
it.useMocha {
38+
timeout = "10s"
39+
}
40+
}
41+
}
42+
// nodejs {
43+
// testTask {
44+
// it.useMocha {
45+
// timeout = "5s"
46+
// }
47+
// }
48+
// }
49+
}
50+
}
51+
52+
jvm { ->
53+
compilations.configureEach { compilation ->
54+
compilation.compileTaskProvider.configure { task ->
55+
task.compilerOptions {
56+
javaParameters.set(true)
57+
freeCompilerArgs.add("-Xjvm-default=all")
58+
}
59+
}
60+
}
61+
}
62+
63+
64+
if (enableIosTarget) {
65+
iosArm64()
66+
}
67+
if (enableIosSimulatorTarget) {
68+
iosSimulatorArm64()
69+
}
70+
71+
applyDefaultHierarchyTemplate()
72+
with (sourceSets) {
73+
val commonMain = getByName("commonMain")
74+
75+
val nonJvm = create("nonJvm") {
76+
it.dependsOn(commonMain)
77+
}
78+
79+
if (enableJsTarget) {
80+
getByName("jsMain") {
81+
it.dependsOn(nonJvm)
82+
}
83+
}
84+
85+
if (enableAnyIosTarget) {
86+
getByName("iosMain") {
87+
it.dependsOn(nonJvm)
88+
}
89+
}
90+
}
91+
92+
if (enableAnyIosTarget) {
93+
(this as? ExtensionAware)?.extensions?.configure<CocoapodsExtension> {
94+
ios.deploymentTarget = "14"
95+
//
96+
// summary = "Some description for a Kotlin/Native module"
97+
// homepage = "Link to a Kotlin/Native module homepage"
98+
99+
// Maps custom Xcode configuration to NativeBuildType
100+
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
101+
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
102+
103+
framework {
104+
isStatic = true
105+
transitiveExport = true
106+
}
107+
108+
pod("PubNubSwift") {
109+
val swiftPath = project.findProperty("SWIFT_PATH") as? String ?: "swift"
110+
// source = git("https://github.com/pubnub/swift") {
111+
// branch = "feat/kmp"
112+
// }
113+
// version = "7.1.0"
114+
source = path(rootProject.file(swiftPath))
115+
moduleName = "PubNubSDK"
116+
extraOpts += listOf("-compiler-option", "-fmodules")
117+
}
118+
}
119+
}
120+
}
121+
if (enableJsTarget) {
122+
yarn.yarnLockMismatchReport = YarnLockMismatchReport.WARNING
123+
yarn.yarnLockAutoReplace = true
124+
}
125+
tasks.withType<AbstractTestTask> {
126+
testLogging {
127+
it.showStackTraces = true
128+
it.showCauses = true
129+
it.showExceptions = true
130+
it.exceptionFormat = TestExceptionFormat.FULL
131+
}
132+
// if (providers.environmentVariable("CI").isPresent && !providers.environmentVariable("CI_FORCE_RUN_INTEGRATION_TESTS").isPresent) {
133+
// filter.excludeTestsMatching("com.pubnub.test.integration.*")
134+
// }
135+
}
136+
}
137+
}
138+
}
139+
140+
val Project.enableJsTarget get() = project.findProperty("ENABLE_TARGET_JS") == "true"
141+
val Project.enableIosTarget get() = project.findProperty("ENABLE_TARGET_IOS") == "true"
142+
val Project.enableIosSimulatorTarget get() = project.findProperty("ENABLE_TARGET_IOS_SIMULATOR") == "true"
143+
val Project.enableAnyIosTarget get() = enableIosTarget || enableIosSimulatorTarget

0 commit comments

Comments
 (0)