Skip to content

Conversation

@zibet27
Copy link
Collaborator

@zibet27 zibet27 commented Oct 31, 2025

Subsystem
WebRTC Client

Motivation
Publishing Apple artifacts fails on the CI.

Solution
Add extra compiler options.

@zibet27 zibet27 self-assigned this Oct 31, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

Adds a compiler option -DTARGET_OS_VISION=0 to the WebRTC CocoaPods pod configuration and introduces multiple new publication entries for the Ktor WebRTC client across Android Native, Darwin (iOS), JS (including wasm), JVM/Common, Linux, and Windows targets.

Changes

Cohort / File(s) Summary
WebRTC CocoaPods Configuration
ktor-client/ktor-client-webrtc/build.gradle.kts
Added compiler option -DTARGET_OS_VISION=0 to the pod("WebRTC-SDK") cocoapods configuration.
Android Native Publications
gradle/artifacts/publishAndroidNativePublications.txt
Added WebRTC Android Native publications for arm32, arm64, x64, x86 (.klib, javadoc.jar, sources.jar).
Darwin / iOS Publications
gradle/artifacts/publishDarwinPublications.txt
Added iOS WebRTC publications for iosArm64, iOS simulator arm64, iosX64 including cinterop-WebRTC.klib, .klib, javadoc.jar, metadata.jar, sources.jar.
JS & Wasm Publications
gradle/artifacts/publishJsPublications.txt
Added ktor-client-webrtc-js and ktor-client-webrtc-wasm-js publications (.klib, javadoc.jar, sources.jar).
JVM & Common Publications
gradle/artifacts/publishJvmAndCommonPublications.txt
Added JVM/Common WebRTC publications: ktor-client-webrtc-android (.aar), ktor-client-webrtc-jvm (.jar), and ktor-client-webrtc entries with associated artifacts.
Linux Publications
gradle/artifacts/publishLinuxPublications.txt
Added ktor-client-webrtc publications for linuxArm64 and linuxX64 (.klib, javadoc.jar, sources.jar).
Windows Publications
gradle/artifacts/publishWindowsPublications.txt
Added ktor-client-webrtc-mingwx64 publications (.klib, javadoc.jar, sources.jar).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Mostly repetitive additions of publication metadata across multiple artifact lists.
  • One small build script change (single-line compiler flag).
  • Files to check closely:
    • ktor-client/ktor-client-webrtc/build.gradle.kts (verify pod syntax and escaping)
    • Publication lists where artifact names/coordinates must match publishing logic.

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • osipxd
  • bjhham

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "WebRTC Client. Fix cinterop task on macOS x86" is directly related to the changeset and captures the core purpose of the pull request. The primary change involves adding a compiler option "-DTARGET_OS_VISION=0" to fix a cinterop compilation issue, which aligns with the title's focus on fixing the cinterop task. While the changeset includes additional artifact publication entries across multiple platforms, these additions are contextual to the core fix—enabling proper WebRTC publication after resolving the compilation issue. The title appropriately emphasizes the solution rather than enumerating all file changes.
Description Check ✅ Passed The pull request description fully adheres to the required template structure. All three mandatory sections are present and appropriately filled: the Subsystem is clearly identified as "WebRTC Client," the Motivation section references the specific CI build failure with a link for verification, and the Solution section concisely states "Add extra compiler options." The description provides sufficient information to understand the problem and approach without excessive verbosity.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zibet27/fix-webrtc-ios-client-compilation

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5697e07 and 40d0236.

📒 Files selected for processing (6)
  • gradle/artifacts/publishAndroidNativePublications.txt (1 hunks)
  • gradle/artifacts/publishDarwinPublications.txt (1 hunks)
  • gradle/artifacts/publishJsPublications.txt (1 hunks)
  • gradle/artifacts/publishJvmAndCommonPublications.txt (1 hunks)
  • gradle/artifacts/publishLinuxPublications.txt (1 hunks)
  • gradle/artifacts/publishWindowsPublications.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: osipxd
Repo: ktorio/ktor PR: 4970
File: build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts:67-72
Timestamp: 2025-07-01T10:54:53.751Z
Learning: In build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts, the KT-70915 and KT-77609 workarounds that limit parallelism for KotlinNativeLink and CInteropCommonizerTask should remain unconditional (not gated behind CI flag) as these limits are beneficial for both local and CI builds.
📚 Learning: 2025-04-22T12:33:16.705Z
Learnt from: osipxd
Repo: ktorio/ktor PR: 4805
File: build-logic/src/main/kotlin/ktorbuild/internal/publish/ValidatePublishedArtifactsTask.kt:74-82
Timestamp: 2025-04-22T12:33:16.705Z
Learning: The ValidatePublishedArtifactsTask in the Ktor build system is designed to collect artifacts from all PublishToMavenRepository tasks in the task graph, not just from the specifically named publish task. This is intentional to validate all publications triggered by a task, including those from task dependencies.

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishWindowsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
📚 Learning: 2025-08-26T06:07:28.352Z
Learnt from: CR
Repo: ktorio/ktor PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T06:07:28.352Z
Learning: Applies to **/*.{kt,kts} : Use star imports for io.ktor.* packages

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishWindowsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
  • gradle/artifacts/publishDarwinPublications.txt
📚 Learning: 2025-08-14T15:17:11.466Z
Learnt from: zibet27
Repo: ktorio/ktor PR: 5044
File: ktor-client/ktor-client-webrtc/ktor-client-webrtc-rs/build.gradle.kts:12-12
Timestamp: 2025-08-14T15:17:11.466Z
Learning: The Cargo plugin (dev.gobley.cargo) used in the Ktor WebRTC RS module depends on the kotlin("plugin.atomicfu") plugin, so atomicfu should not be removed even if there are no direct kotlinx.atomicfu imports in the module's source code.

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishWindowsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
  • gradle/artifacts/publishDarwinPublications.txt
📚 Learning: 2025-08-14T15:17:11.466Z
Learnt from: zibet27
Repo: ktorio/ktor PR: 5044
File: ktor-client/ktor-client-webrtc/ktor-client-webrtc-rs/build.gradle.kts:12-12
Timestamp: 2025-08-14T15:17:11.466Z
Learning: The Gobley Cargo plugin (dev.gobley.cargo) used in the Ktor WebRTC RS module requires the kotlin("plugin.atomicfu") plugin as a dependency, so the atomicfu plugin should not be removed even if there are no direct kotlinx.atomicfu imports in the module's source code.

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishWindowsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
  • gradle/artifacts/publishDarwinPublications.txt
📚 Learning: 2025-08-26T06:07:28.352Z
Learnt from: CR
Repo: ktorio/ktor PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T06:07:28.352Z
Learning: Project is Kotlin Multiplatform (JVM, JS, Native)

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
  • gradle/artifacts/publishDarwinPublications.txt
📚 Learning: 2025-05-07T09:12:14.293Z
Learnt from: osipxd
Repo: ktorio/ktor PR: 4836
File: ktor-utils/build.gradle.kts:35-35
Timestamp: 2025-05-07T09:12:14.293Z
Learning: The Ktor project maintains a flat Gradle project structure (where projects are referenced without nested paths like `:ktor-test-base`) while keeping a hierarchical directory organization on disk.

Applied to files:

  • gradle/artifacts/publishLinuxPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
📚 Learning: 2025-08-26T06:07:28.352Z
Learnt from: CR
Repo: ktorio/ktor PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T06:07:28.352Z
Learning: Applies to **/*.kt : Document all public Kotlin APIs, including parameters, return types, and exceptions

Applied to files:

  • gradle/artifacts/publishJsPublications.txt
  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishWindowsPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
📚 Learning: 2025-05-16T13:11:28.416Z
Learnt from: osipxd
Repo: ktorio/ktor PR: 4860
File: ktor-server/ktor-server-plugins/ktor-server-di/api/ktor-server-di.api:24-26
Timestamp: 2025-05-16T13:11:28.416Z
Learning: Binary incompatible changes (such as constructor signature changes) are acceptable in the ktor-server-di module when the version is not yet released, as confirmed by the development team.

Applied to files:

  • gradle/artifacts/publishJvmAndCommonPublications.txt
  • gradle/artifacts/publishAndroidNativePublications.txt
📚 Learning: 2025-07-01T10:54:53.751Z
Learnt from: osipxd
Repo: ktorio/ktor PR: 4970
File: build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts:67-72
Timestamp: 2025-07-01T10:54:53.751Z
Learning: In build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts, the KT-70915 and KT-77609 workarounds that limit parallelism for KotlinNativeLink and CInteropCommonizerTask should remain unconditional (not gated behind CI flag) as these limits are beneficial for both local and CI builds.

Applied to files:

  • gradle/artifacts/publishAndroidNativePublications.txt
📚 Learning: 2025-08-26T06:07:28.352Z
Learnt from: CR
Repo: ktorio/ktor PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-08-26T06:07:28.352Z
Learning: Binary compatibility is enforced via Kotlin Gradle Plugin ABI validation

Applied to files:

  • gradle/artifacts/publishAndroidNativePublications.txt
🔇 Additional comments (6)
gradle/artifacts/publishWindowsPublications.txt (1)

44-46: Windows mingwX64 WebRTC entries confirmed correct.

The mingwX64 target is definitively declared and active. The compiled artifact metadata (ktor-client-webrtc.klib.api) explicitly lists mingwX64 in its targets list, confirming that all three published artifacts (.klib, javadoc.jar, sources.jar) are properly produced and their entries in publishWindowsPublications.txt (lines 44-46) are correct and alphabetically ordered.

gradle/artifacts/publishJsPublications.txt (1)

85-90: Both js and wasm-js targets are enabled; entries in publishJsPublications.txt are valid.

The webrtc module confirms both targets via the jsAndWasmSharedMain sourceSet at ktor-client/ktor-client-webrtc/build.gradle.kts:42, which only exists when both js and wasmJs targets are declared. The wasmJs target has explicit compiler configuration at line 46. The triplet artifacts (.klib, javadoc.jar, sources.jar) for both ktor-client-webrtc-js and ktor-client-webrtc-wasm-js in the file are correct.

gradle/artifacts/publishJvmAndCommonPublications.txt (1)

179-188: Android artifact type is correct — no action needed.

The module uses the com.android.kotlin.multiplatform.library plugin, which correctly produces .aar files for Android variants in Kotlin Multiplatform projects. The artifact list is properly structured: .aar for the android target, .jar for jvm and multiplatform root, with appropriate metadata. No changes required.

gradle/artifacts/publishDarwinPublications.txt (1)

843-857: All verification checks pass—iOS WebRTC configuration is correct.

Confirmed:

  • Cocoapods pod("WebRTC-SDK") is declared with moduleName = "WebRTC" (matching cinterop-WebRTC.klib artifacts)
  • The -DTARGET_OS_VISION=0 compiler flag is applied via extraOpts in the pod configuration
  • The cocoapods block is top-level and applies to all iOS variants (iosArm64, iosSimulatorArm64, iosX64)
  • Published artifacts confirm all three iOS variants successfully generate the cinterop and metadata artifacts
gradle/artifacts/publishAndroidNativePublications.txt (1)

157-168: Verification complete: Android Native WebRTC publications are correctly configured.

All four androidNative* target variants (Arm32, Arm64, X64, X86) are properly published with corresponding .klib, javadoc.jar, and sources.jar artifacts. The main webrtc module inherits androidNative targets from KtorTargets defaults, while the webrtc-rs submodule correctly opts out. Kotlin/Native parallelism workarounds for KT-70915 and KT-77609 remain unconditional as required.

gradle/artifacts/publishLinuxPublications.txt (1)

87-92: No changes required—WebRTC artifacts are correct and complete.

The new WebRTC entries correctly follow the standard pattern for Linux publications (.klib, javadoc.jar, sources.jar for each architecture). No cinterop artifacts are needed because WebRTC uses Rust/Uniffi for FFI instead of traditional C interop via kotlinx.cinterop (which is why modules like ktor-client-curl have additional cinterop-libcurl.klib entries, but WebRTC does not).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
ktor-client/ktor-client-webrtc/build.gradle.kts (1)

70-70: Fix for macOS x86 cinterop compilation looks correct.

The addition of the -DTARGET_OS_VISION=0 compiler option follows the existing pattern and syntax. However, consider adding an inline comment explaining why this define is necessary for future maintainers.

Example enhancement:

                extraOpts += listOf("-compiler-option", "-fmodules")
-                extraOpts += listOf("-compiler-option", "-DTARGET_OS_VISION=0")
+                // Disable Vision OS target to fix cinterop task on macOS x86
+                extraOpts += listOf("-compiler-option", "-DTARGET_OS_VISION=0")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fcffc2 and 5697e07.

📒 Files selected for processing (1)
  • ktor-client/ktor-client-webrtc/build.gradle.kts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{kt,kts}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{kt,kts}: Follow Kotlin official style guide for all Kotlin source and build scripts
Use star imports for io.ktor.* packages
Max line length is 120 characters
Indent with 4 spaces in Kotlin code
Include a copyright header in new Kotlin files

Files:

  • ktor-client/ktor-client-webrtc/build.gradle.kts
🧠 Learnings (4)
📓 Common learnings
Learnt from: osipxd
Repo: ktorio/ktor PR: 4970
File: build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts:67-72
Timestamp: 2025-07-01T10:54:53.751Z
Learning: In build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts, the KT-70915 and KT-77609 workarounds that limit parallelism for KotlinNativeLink and CInteropCommonizerTask should remain unconditional (not gated behind CI flag) as these limits are beneficial for both local and CI builds.
📚 Learning: 2025-07-01T10:54:53.751Z
Learnt from: osipxd
Repo: ktorio/ktor PR: 4970
File: build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts:67-72
Timestamp: 2025-07-01T10:54:53.751Z
Learning: In build-logic/src/main/kotlin/ktorbuild.kmp.gradle.kts, the KT-70915 and KT-77609 workarounds that limit parallelism for KotlinNativeLink and CInteropCommonizerTask should remain unconditional (not gated behind CI flag) as these limits are beneficial for both local and CI builds.

Applied to files:

  • ktor-client/ktor-client-webrtc/build.gradle.kts
📚 Learning: 2025-08-14T15:17:11.466Z
Learnt from: zibet27
Repo: ktorio/ktor PR: 5044
File: ktor-client/ktor-client-webrtc/ktor-client-webrtc-rs/build.gradle.kts:12-12
Timestamp: 2025-08-14T15:17:11.466Z
Learning: The Cargo plugin (dev.gobley.cargo) used in the Ktor WebRTC RS module depends on the kotlin("plugin.atomicfu") plugin, so atomicfu should not be removed even if there are no direct kotlinx.atomicfu imports in the module's source code.

Applied to files:

  • ktor-client/ktor-client-webrtc/build.gradle.kts
📚 Learning: 2025-08-14T15:17:11.466Z
Learnt from: zibet27
Repo: ktorio/ktor PR: 5044
File: ktor-client/ktor-client-webrtc/ktor-client-webrtc-rs/build.gradle.kts:12-12
Timestamp: 2025-08-14T15:17:11.466Z
Learning: The Gobley Cargo plugin (dev.gobley.cargo) used in the Ktor WebRTC RS module requires the kotlin("plugin.atomicfu") plugin as a dependency, so the atomicfu plugin should not be removed even if there are no direct kotlinx.atomicfu imports in the module's source code.

Applied to files:

  • ktor-client/ktor-client-webrtc/build.gradle.kts

@zibet27 zibet27 requested a review from osipxd November 3, 2025 09:23
Copy link
Member

@osipxd osipxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@zibet27 zibet27 enabled auto-merge (squash) November 3, 2025 11:05
@zibet27 zibet27 merged commit 7462890 into main Nov 3, 2025
17 of 19 checks passed
@zibet27 zibet27 deleted the zibet27/fix-webrtc-ios-client-compilation branch November 3, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants