Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge kmp-dev to master #283

Merged
merged 65 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
caed317
Base KMP structure with no JS or iOS implementations.
wkal-pubnub May 16, 2024
ec5ea3e
Change Any to Map for custom in PNChannelMetadata
wkal-pubnub May 17, 2024
72a9aa2
Add JS wrappers for some endpoints (#212)
wkal-pubnub May 20, 2024
9855387
Continue adding JS implementations for KMP (#215)
wkal-pubnub May 21, 2024
d5071b1
Add mapCatching to Result
wkal-pubnub May 22, 2024
9bff718
Kotlin 2.0, keys in tests, more JS endpoints (#217)
wkal-pubnub May 22, 2024
47c28a5
Added Swift wrappers for push notification methods (#216)
jguz-pubnub May 22, 2024
f63464f
UUID & channel metadata (#218)
wkal-pubnub May 24, 2024
32e2577
Added Swift wrappers for next endpoints (#221)
jguz-pubnub May 28, 2024
9bb68bb
JS cleanups and membership related endpoints (#220)
wkal-pubnub May 28, 2024
ebab495
Merge remote-tracking branch 'origin/master' into kmp-dev
wkal-pubnub May 28, 2024
c80d72c
Wrapping next Swift endpoints (#224)
jguz-pubnub Jun 4, 2024
69d6570
Message payloads, metadata & status code in exceptions (#223)
wkal-pubnub Jun 4, 2024
9a0d5b8
Add wrapException to Result
wkal-pubnub Jun 6, 2024
833299c
Wrapping status listener and some AppContext methods (#225)
jguz-pubnub Jun 7, 2024
8761c08
Add creation of JsonElement to common code (#228)
wkal-pubnub Jun 7, 2024
46939f1
Add Swift git submodule (#230)
wkal-pubnub Jun 10, 2024
9db073a
Added constructor for testing purpose. (#231)
marcin-cebo Jun 10, 2024
625b536
Merge master changes to kmp branch (#234)
wkal-pubnub Jun 11, 2024
14d3348
Wrapping next AppContext methods (#229)
jguz-pubnub Jun 12, 2024
161c608
[KMP] Move tests and make more tests work on iOS (#235)
wkal-pubnub Jun 12, 2024
49a46c3
[JS] Add files related methods (#236)
wkal-pubnub Jun 14, 2024
730aa28
Fix futures package
wkal-pubnub Jun 14, 2024
461fd45
Wrapping remaining AppContext methods + Files API (#237)
jguz-pubnub Jun 18, 2024
dbdecb0
Finish rest of required JS wrapper methods (basic entity/subscription…
wkal-pubnub Jun 18, 2024
340db40
File download + File upload (#239)
jguz-pubnub Jun 19, 2024
482c1b5
Wrapping entities and Subscription/SubscriptionSet (#241)
jguz-pubnub Jun 24, 2024
539be21
Add IncludeType, fix futures.awaitAll and listener classcastexception…
wkal-pubnub Jun 25, 2024
52e2711
Minor improvements for iosMain (#242)
jguz-pubnub Jun 25, 2024
85fdec8
Added secret key to configuration (#243)
marcin-cebo Jun 26, 2024
17cf9a0
Added secret key for tests (#244)
marcin-cebo Jun 26, 2024
0ded656
PNFuture variance fix (#245)
wkal-pubnub Jun 26, 2024
dc79c26
SubscriptionSetImpl in JS and PNFuture.remember() (#246)
wkal-pubnub Jun 28, 2024
a5d7525
Tests, fixes (#247)
wkal-pubnub Jul 1, 2024
adac6f0
More KMP tests (#248)
wkal-pubnub Jul 2, 2024
4656ca4
Change GSON number strategy to lazily parsed (#250)
wkal-pubnub Jul 4, 2024
20d8ecc
Fixes for custom fields (AppContext) and push methods (#252)
jguz-pubnub Jul 8, 2024
365be72
Change actionTimetoken to Long, ktlint, tests (#253)
wkal-pubnub Jul 9, 2024
49f2c29
parseToken and test fixture changes (#254)
wkal-pubnub Jul 10, 2024
c6c3c62
Refactoring around PNConfiguration (#255)
wkal-pubnub Jul 16, 2024
b10a4f4
Fixing integration tests for iOS (#256)
jguz-pubnub Jul 18, 2024
6a433a3
iOS test changes (#257)
wkal-pubnub Jul 19, 2024
b140847
Add JsonElement test
wkal-pubnub Jul 23, 2024
e8d77b5
Changes for Chat project
wkal-pubnub Jul 25, 2024
2d29625
Get rid of com.pubnub.kmp.PubNub (#261)
wkal-pubnub Jul 29, 2024
9cf07bb
Using InputStream instead of URL in StreamUploadContent (#259)
jguz-pubnub Jul 29, 2024
108c726
Merge changes from master to kmp-dev (#263)
wkal-pubnub Jul 30, 2024
55f86ce
Fix obvious typo in JS wrapper
wkal-pubnub Jul 31, 2024
cff96bb
Handling missing includeType parameter (AppContext) (#264)
jguz-pubnub Aug 1, 2024
3e82af3
Build scripts with non-JVM targets disabled (#265)
wkal-pubnub Aug 5, 2024
f5d37b8
[Kotlin] Change PNChannelMetadata and PNUUIDMetadata to contain parti…
wkal-pubnub Aug 6, 2024
6919320
Partial updates for membership information (#267)
wkal-pubnub Aug 8, 2024
22a7566
Added missing implementations for iOS target (#268)
jguz-pubnub Aug 13, 2024
d02cefb
Version bumps, test fixture fix (#273)
wkal-pubnub Sep 5, 2024
2ce7724
Handling missing ReceivePresenceEvents options (#274)
jguz-pubnub Sep 9, 2024
0f11994
Updating Channel/UUID metadata with PatchValue (#271)
jguz-pubnub Sep 10, 2024
f59b6e6
Fixes according to swift module changes (#276)
jguz-pubnub Sep 12, 2024
1c54fa4
Change dependencies so that Java SDK depends on Kotlin SDK (#269)
wkal-pubnub Sep 16, 2024
cb56629
Merge remote-tracking branch 'origin/master' into kmp-dev
wkal-pubnub Sep 16, 2024
c05c337
Small fixes after merge
wkal-pubnub Sep 16, 2024
e6ce060
Updating swift submodule (#278)
jguz-pubnub Sep 17, 2024
0d6b7ef
Added @ObjCName annotation and helper constructor (iOS) (#280)
jguz-pubnub Sep 19, 2024
88e29b1
Add PatchValue to Java API (#281)
wkal-pubnub Sep 20, 2024
05232ae
Merge remote-tracking branch 'origin/master' into kmp-dev
wkal-pubnub Sep 20, 2024
16a9de9
Formatting
wkal-pubnub Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/release/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"clearedSuffix": false
}
],
"pubnub-core/pubnub-core-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubCoreTest.kt": [
"pubnub-kotlin/pubnub-kotlin-impl/src/test/kotlin/com/pubnub/api/legacy/PubNubImplTest.kt": [
{
"pattern": "assertEquals\\(\"(v?(\\d+\\.?){2,}([a-zA-Z0-9-]+(\\.?\\d+)?)?)\", version\\)$",
"clearedPrefix": true,
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
- name: Build and run tests
run: |
./gradlew check
env:
SDK_PUB_KEY: ${{ secrets.SDK_PUB_KEY }}
SDK_SUB_KEY: ${{ secrets.SDK_SUB_KEY }}
SDK_PAM_SUB_KEY: ${{ secrets.SDK_PAM_SUB_KEY }}
SDK_PAM_PUB_KEY: ${{ secrets.SDK_PAM_PUB_KEY }}
SDK_PAM_SEC_KEY: ${{ secrets.SDK_PAM_SEC_KEY }}
- name: Cancel workflow runs for commit on error
if: failure()
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-validations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Validate clean build
run: ./gradlew build
run: ./gradlew ktlintFormat publishAllPublicationsToRepoRepository -PRELEASE_SIGNING_ENABLED=false
- name: Cancel workflow runs for commit on error
if: failure()
uses: ./.github/.release/actions/actions/utils/fast-jobs-failure
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.kotlin
examples
.gradle/
.idea/
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "swift"]
path = swift
url = https://github.com/pubnub/swift
branch = feat/kmp2
24 changes: 20 additions & 4 deletions build-logic/gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ plugins {
alias(libs.plugins.kotlin.jvm)
}

kotlin {
jvmToolchain(8)
}

dependencies {
compileOnly(gradleKotlinDsl())
compileOnly(libs.nexus.gradlePlugin)
Expand All @@ -30,5 +26,25 @@ gradlePlugin {
id = "pubnub.integration-test"
implementationClass = "com.pubnub.gradle.PubNubIntegrationTestPlugin"
}
register("pubnubTest") {
id = "pubnub.test"
implementationClass = "com.pubnub.gradle.PubNubTestPlugin"
}
register("pubnubJavaLibrary") {
id = "pubnub.java-library"
implementationClass = "com.pubnub.gradle.PubNubJavaLibraryPlugin"
}
register("pubnubKotlinLibrary") {
id = "pubnub.kotlin-library"
implementationClass = "com.pubnub.gradle.PubNubKotlinLibraryPlugin"
}
register("pubnubIosSimulatorTest") {
id = "pubnub.ios-simulator-test"
implementationClass = "com.pubnub.gradle.PubNubIosSimulatorTestPlugin"
}
register("pubnubMultiplatform") {
id = "pubnub.multiplatform"
implementationClass = "com.pubnub.gradle.PubNubKotlinMultiplatformPlugin"
}
}
}
4 changes: 2 additions & 2 deletions build-logic/gradle-plugins/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.parallel=true
org.gradle.parallel=false
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ class PubNubDokkaPlugin : Plugin<Project> {
apply<DokkaPlugin>()

tasks.withType<DokkaTask>().configureEach { task ->
task.dokkaSourceSets.configureEach {
it.perPackageOption {
task.notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
task.dokkaSourceSets.configureEach { sourceSetBuilder ->
sourceSetBuilder.perPackageOption {
it.matchingRegex.set(".*internal.*")
it.suppress.set(true)
}
it.skipEmptyPackages.set(true)
sourceSetBuilder.skipEmptyPackages.set(true)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.pubnub.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Exec
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.TestExecutable
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
import java.io.ByteArrayOutputStream

class PubNubIosSimulatorTestPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply<KotlinMultiplatformPluginWrapper>()

val deviceName = project.findProperty("IOS_SIMULATOR_ID") as? String ?: "iPhone 15 Pro"
val isMacOs = providers.systemProperty("os.name").map { it.contains("mac", ignoreCase = true) }

val bootTask = tasks.register<Exec>("bootIOSSimulator") {
onlyIf { isMacOs.get() }
isIgnoreExitValue = true
commandLine("xcrun", "simctl", "boot", deviceName)
doLast {
val result = executionResult.get()
if (result.exitValue != 148 && result.exitValue != 149) { // ignoring device already booted errors
result.assertNormalExitValue()
}
}
}

// val shutdownTask = tasks.register<Exec>("shutdownIOSSimulator") {
// onlyIf { isMacOs.get() }
// commandLine("xcrun", "simctl", "shutdown", deviceName)
// dependsOn(tasks.withType<KotlinNativeSimulatorTest>())
// }

tasks.withType<KotlinNativeSimulatorTest>().configureEach {
it.onlyIf { isMacOs.get() }
it.standalone.set(false)
it.device.set(deviceName)
it.dependsOn(bootTask)
// it.finalizedBy(shutdownTask)
}

extensions.configure<KotlinMultiplatformExtension> {
targets.withType<KotlinNativeTarget> {
if (konanTarget.family.isAppleFamily) {
binaries.withType<TestExecutable> {
freeCompilerArgs += listOf("-e", "testlauncher.mainBackground")
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.pubnub.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaLibraryPlugin
import org.gradle.api.plugins.quality.Checkstyle
import org.gradle.api.plugins.quality.CheckstyleExtension
import org.gradle.api.plugins.quality.CheckstylePlugin
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType

class PubNubJavaLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply<PubNubSharedPlugin>()
apply<JavaLibraryPlugin>()
apply<CheckstylePlugin>()

tasks.withType<JavaCompile>().configureEach {
it.options.compilerArgs.add("-parameters")
}

extensions.configure<CheckstyleExtension> {
toolVersion = "8.14"
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
sourceSets = listOf(extensions.getByType<SourceSetContainer>().getByName("main"))
}

tasks.withType<Checkstyle>().configureEach {
it.exclude("**/vendor/**", "**/*Test*")

it.reports { report ->
report.xml.required.set(true)
report.html.required.set(true)
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.pubnub.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

class PubNubKotlinLibraryPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply<PubNubSharedPlugin>()
apply<KotlinPluginWrapper>()

// Kotlin
extensions.configure<KotlinJvmProjectExtension> {
jvmToolchain(8)
}

tasks.named("compileKotlin", KotlinJvmCompile::class.java) {
it.compilerOptions {
javaParameters.set(true)
freeCompilerArgs.add("-Xjvm-default=all")
}
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
package com.pubnub.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.testing.AbstractTestTask
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
import org.jetbrains.kotlin.gradle.plugin.cocoapods.CocoapodsExtension
import org.jetbrains.kotlin.gradle.plugin.cocoapods.KotlinCocoapodsPlugin
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.yarn

class PubNubKotlinMultiplatformPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply<KotlinMultiplatformPluginWrapper>()
if (enableAnyIosTarget) {
apply<KotlinCocoapodsPlugin>()
}

// Kotlin
extensions.configure<KotlinMultiplatformExtension> {
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
jvmToolchain(8)

if (enableJsTarget) {
js { ->
useEsModules()
browser {
testTask {
it.useMocha {
timeout = "10s"
}
}
}
// nodejs {
// testTask {
// it.useMocha {
// timeout = "5s"
// }
// }
// }
}
}

jvm { ->
compilations.configureEach { compilation ->
compilation.compileTaskProvider.configure { task ->
task.compilerOptions {
javaParameters.set(true)
freeCompilerArgs.add("-Xjvm-default=all")
}
}
}
}


if (enableIosTarget) {
iosArm64()
}
if (enableIosSimulatorTarget) {
iosSimulatorArm64()
}

applyDefaultHierarchyTemplate()
with (sourceSets) {
val commonMain = getByName("commonMain")

val nonJvm = create("nonJvm") {
it.dependsOn(commonMain)
}

if (enableJsTarget) {
getByName("jsMain") {
it.dependsOn(nonJvm)
}
}

if (enableAnyIosTarget) {
getByName("iosMain") {
it.dependsOn(nonJvm)
}
}
}

if (enableAnyIosTarget) {
(this as? ExtensionAware)?.extensions?.configure<CocoapodsExtension> {
ios.deploymentTarget = "14"
//
// summary = "Some description for a Kotlin/Native module"
// homepage = "Link to a Kotlin/Native module homepage"

// Maps custom Xcode configuration to NativeBuildType
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE

framework {
isStatic = true
transitiveExport = true
}

pod("PubNubSwift") {
val swiftPath = project.findProperty("SWIFT_PATH") as? String ?: "swift"
// source = git("https://github.com/pubnub/swift") {
// branch = "feat/kmp"
// }
// version = "7.1.0"
source = path(rootProject.file(swiftPath))
moduleName = "PubNubSDK"
extraOpts += listOf("-compiler-option", "-fmodules")
}
}
}
}
if (enableJsTarget) {
yarn.yarnLockMismatchReport = YarnLockMismatchReport.WARNING
yarn.yarnLockAutoReplace = true
}
tasks.withType<AbstractTestTask> {
testLogging {
it.showStackTraces = true
it.showCauses = true
it.showExceptions = true
it.exceptionFormat = TestExceptionFormat.FULL
}
// if (providers.environmentVariable("CI").isPresent && !providers.environmentVariable("CI_FORCE_RUN_INTEGRATION_TESTS").isPresent) {
// filter.excludeTestsMatching("com.pubnub.test.integration.*")
// }
}
}
}
}

val Project.enableJsTarget get() = project.findProperty("ENABLE_TARGET_JS") == "true"
val Project.enableIosTarget get() = project.findProperty("ENABLE_TARGET_IOS") == "true"
val Project.enableIosSimulatorTarget get() = project.findProperty("ENABLE_TARGET_IOS_SIMULATOR") == "true"
val Project.enableAnyIosTarget get() = enableIosTarget || enableIosSimulatorTarget
Loading
Loading