Skip to content

Commit

Permalink
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
rickclephas committed Sep 29, 2024
2 parents 8f80a19 + 69d3aca commit b7f01c5
Show file tree
Hide file tree
Showing 47 changed files with 449 additions and 208 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
branches:
- master
# pull_request:
# branches:
# - master
jobs:
qodana:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-idea-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
fail-fast: false
matrix:
ide: [ IC, IU, AI ]
build: [ 241, 242 ]
build: [ 242 ]
name: ${{ format('{0}-{1}', matrix.ide, matrix.build) }}
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion KMPNativeCoroutinesAsync.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KMPNativeCoroutinesAsync'
s.version = '1.0.0-ALPHA-34'
s.version = '1.0.0-ALPHA-36'
s.summary = 'Swift library for Kotlin Coroutines with Swift Async/Await'

s.homepage = 'https://github.com/rickclephas/KMP-NativeCoroutines'
Expand Down
2 changes: 1 addition & 1 deletion KMPNativeCoroutinesCombine.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KMPNativeCoroutinesCombine'
s.version = '1.0.0-ALPHA-34'
s.version = '1.0.0-ALPHA-36'
s.summary = 'Swift library for Kotlin Coroutines with Combine'

s.homepage = 'https://github.com/rickclephas/KMP-NativeCoroutines'
Expand Down
2 changes: 1 addition & 1 deletion KMPNativeCoroutinesCore.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KMPNativeCoroutinesCore'
s.version = '1.0.0-ALPHA-34'
s.version = '1.0.0-ALPHA-36'
s.summary = 'Swift library for Kotlin Coroutines'

s.homepage = 'https://github.com/rickclephas/KMP-NativeCoroutines'
Expand Down
2 changes: 1 addition & 1 deletion KMPNativeCoroutinesRxSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KMPNativeCoroutinesRxSwift'
s.version = '1.0.0-ALPHA-34'
s.version = '1.0.0-ALPHA-36'
s.summary = 'Swift library for Kotlin Coroutines with RxSwift'

s.homepage = 'https://github.com/rickclephas/KMP-NativeCoroutines'
Expand Down
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,26 @@ This library solves both of these limitations 😄.

## Compatibility

The latest version of the library uses Kotlin version `2.0.10`.
The latest version of the library uses Kotlin version `2.0.20`.
Compatibility versions for older and/or preview Kotlin versions are also available:

| Version | Version suffix | Kotlin | KSP | Coroutines |
|----------------|--------------------|:----------:|:----------:|:----------:|
| _latest_ | -kotlin-2.0.20-RC | 2.0.20-RC | 1.0.24 | 1.9.0-RC |
| **_latest_** | **_no suffix_** | **2.0.10** | **1.0.24** | **1.8.1** |
| 1.0.0-ALPHA-33 | _no suffix_ | 2.0.0 | 1.0.24 | 1.8.1 |
| 1.0.0-ALPHA-30 | _no suffix_ | 1.9.24 | 1.0.20 | 1.8.1 |
| 1.0.0-ALPHA-28 | _no suffix_ | 1.9.23 | 1.0.20 | 1.8.0 |
| 1.0.0-ALPHA-25 | _no suffix_ | 1.9.22 | 1.0.17 | 1.8.0 |
| 1.0.0-ALPHA-23 | _no suffix_ | 1.9.21 | 1.0.16 | 1.7.3 |
| 1.0.0-ALPHA-21 | _no suffix_ | 1.9.20 | 1.0.14 | 1.7.3 |
| 1.0.0-ALPHA-18 | _no suffix_ | 1.9.10 | 1.0.13 | 1.7.3 |
| 1.0.0-ALPHA-17 | _no suffix_ | 1.9.0 | 1.0.12 | 1.7.3 |
| 1.0.0-ALPHA-12 | _no suffix_ | 1.8.22 | 1.0.11 | 1.7.2 |
| 1.0.0-ALPHA-10 | _no suffix_ | 1.8.21 | 1.0.11 | 1.7.1 |
| 1.0.0-ALPHA-7 | _no suffix_ | 1.8.20 | 1.0.10 | 1.6.4 |
| Version | Version suffix | Kotlin | KSP | Coroutines |
|----------------|---------------------|:-----------:|:----------:|:----------:|
| _latest_ | -kotlin-2.1.0-Beta1 | 2.1.0-Beta1 | 1.0.25 | 1.9.0 |
| **_latest_** | **_no suffix_** | **2.0.20** | **1.0.25** | **1.9.0** |
| 1.0.0-ALPHA-35 | _no suffix_ | 2.0.20 | 1.0.24 | 1.8.1 |
| 1.0.0-ALPHA-34 | _no suffix_ | 2.0.10 | 1.0.24 | 1.8.1 |
| 1.0.0-ALPHA-33 | _no suffix_ | 2.0.0 | 1.0.24 | 1.8.1 |
| 1.0.0-ALPHA-30 | _no suffix_ | 1.9.24 | 1.0.20 | 1.8.1 |
| 1.0.0-ALPHA-28 | _no suffix_ | 1.9.23 | 1.0.20 | 1.8.0 |
| 1.0.0-ALPHA-25 | _no suffix_ | 1.9.22 | 1.0.17 | 1.8.0 |
| 1.0.0-ALPHA-23 | _no suffix_ | 1.9.21 | 1.0.16 | 1.7.3 |
| 1.0.0-ALPHA-21 | _no suffix_ | 1.9.20 | 1.0.14 | 1.7.3 |
| 1.0.0-ALPHA-18 | _no suffix_ | 1.9.10 | 1.0.13 | 1.7.3 |
| 1.0.0-ALPHA-17 | _no suffix_ | 1.9.0 | 1.0.12 | 1.7.3 |
| 1.0.0-ALPHA-12 | _no suffix_ | 1.8.22 | 1.0.11 | 1.7.2 |
| 1.0.0-ALPHA-10 | _no suffix_ | 1.8.21 | 1.0.11 | 1.7.1 |
| 1.0.0-ALPHA-7 | _no suffix_ | 1.8.20 | 1.0.10 | 1.6.4 |

You can choose from a couple of Swift implementations.
Depending on the implementation you can support as low as iOS 9, macOS 10.9, tvOS 9 and watchOS 3:
Expand All @@ -64,8 +66,8 @@ Make sure to always use the same versions for all the libraries!
For Kotlin just add the plugin to your `build.gradle.kts`:
```kotlin
plugins {
id("com.google.devtools.ksp") version "2.0.10-1.0.24"
id("com.rickclephas.kmp.nativecoroutines") version "1.0.0-ALPHA-34"
id("com.google.devtools.ksp") version "2.0.20-1.0.25"
id("com.rickclephas.kmp.nativecoroutines") version "1.0.0-ALPHA-36"
}
```
and make sure to opt in to the experimental `@ObjCName` annotation:
Expand All @@ -81,7 +83,7 @@ The Swift implementations are available via the Swift Package Manager.
Just add it to your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/rickclephas/KMP-NativeCoroutines.git", exact: "1.0.0-ALPHA-34")
.package(url: "https://github.com/rickclephas/KMP-NativeCoroutines.git", exact: "1.0.0-ALPHA-36")
],
targets: [
.target(
Expand Down Expand Up @@ -113,9 +115,9 @@ Or add it in Xcode by going to `File` > `Add Packages...` and providing the URL:

If you use CocoaPods add one or more of the following libraries to your `Podfile`:
```ruby
pod 'KMPNativeCoroutinesAsync', '1.0.0-ALPHA-34' # Swift Concurrency implementation
pod 'KMPNativeCoroutinesCombine', '1.0.0-ALPHA-34' # Combine implementation
pod 'KMPNativeCoroutinesRxSwift', '1.0.0-ALPHA-34' # RxSwift implementation
pod 'KMPNativeCoroutinesAsync', '1.0.0-ALPHA-36' # Swift Concurrency implementation
pod 'KMPNativeCoroutinesCombine', '1.0.0-ALPHA-36' # Combine implementation
pod 'KMPNativeCoroutinesRxSwift', '1.0.0-ALPHA-36' # RxSwift implementation
```
> [!NOTE]
> The version for CocoaPods should not contain the Kotlin version suffix (e.g. `-new-mm` or `-kotlin-1.6.0`).
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {

allprojects {
group = "com.rickclephas.kmp"
version = "1.0.0-ALPHA-34"
version = "1.0.0-ALPHA-36"

repositories {
mavenCentral()
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
kotlin = "2.0.10"
kotlinx-coroutines = "1.8.1"
kotlinx-binary-compatibility-validator = "0.15.0-Beta.2"
ksp = "2.0.10-1.0.24"
kotlin = "2.0.20"
kotlinx-coroutines = "1.9.0"
kotlinx-binary-compatibility-validator = "0.16.3"
ksp = "2.0.20-1.0.25"
kotlinpoet = "1.18.1"
junit = "5.9.1"

Expand Down Expand Up @@ -35,7 +35,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa

[plugins]
gradle-plugin-publish = { id = "com.gradle.plugin-publish", version = "1.2.0" }
intellij-platform = { id = "org.jetbrains.intellij.platform", version = "2.0.0" }
intellij-platform = { id = "org.jetbrains.intellij.platform", version = "2.1.0" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-binary-compatibility-validator" }
Expand Down
2 changes: 1 addition & 1 deletion kmp-nativecoroutines-annotations/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
alias(libs.plugins.kotlin.multiplatform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ private fun FirAnnotation.getArguments(vararg names: Name): Map<Name, FirExpress
}

private inline fun <reified T> FirExpression.getLiteralValue(): T? =
(this as? FirLiteralExpression<*>)?.value as? T
(this as? FirLiteralExpression)?.value as? T
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.fir.extensions.FirExtension
import org.jetbrains.kotlin.fir.moduleData
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef
import org.jetbrains.kotlin.name.CallableId

internal fun FirExtension.buildNativeFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.fir.extensions.FirExtension
import org.jetbrains.kotlin.fir.moduleData
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef
import org.jetbrains.kotlin.name.CallableId

internal fun FirExtension.buildNativeProperty(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.jetbrains.kotlin.fir.declarations.FirReceiverParameter
import org.jetbrains.kotlin.fir.declarations.builder.buildReceiverParameter
import org.jetbrains.kotlin.fir.extensions.FirExtension
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.types.toFirResolvedTypeRef
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef

internal fun FirExtension.buildReceiverParameterCopy(
originalParameter: FirReceiverParameter?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.extensions.FirExtension
import org.jetbrains.kotlin.fir.moduleData
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.StandardClassIds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.extensions.FirExtension
import org.jetbrains.kotlin.fir.moduleData
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.*
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.utils.addToStdlib.applyIf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.name.StandardClassIds
internal fun FirSession.buildTodoCall(reason: String): FirFunctionCall = buildFunctionCall {
val callableId = CallableIds.todo
val todoSymbol = symbolProvider.getTopLevelFunctionSymbols(callableId.packageName, callableId.callableName)
.single { it.valueParameterSymbols.size == 1 }
.first { it.valueParameterSymbols.size == 1 } // we have 2 symbols in IDE (K/N and Gradle stdlib)
coneTypeOrNull = StandardClassIds.Nothing.constructClassLikeType()
@OptIn(SymbolInternals::class)
val reasonParameter = todoSymbol.valueParameterSymbols.first().fir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap
import org.jetbrains.kotlin.fir.scopes.impl.toConeType
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef
import org.jetbrains.kotlin.fir.types.coneType
import org.jetbrains.kotlin.fir.types.toFirResolvedTypeRef

internal data class TypeParameters(
val parameters: List<FirTypeParameter>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol
import org.jetbrains.kotlin.fir.types.toFirResolvedTypeRef
import org.jetbrains.kotlin.fir.toFirResolvedTypeRef

internal fun FirExtension.buildValueParametersCopy(
originalParameters: List<FirValueParameterSymbol>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression
import org.jetbrains.kotlin.fir.expressions.builder.buildLiteralExpression
import org.jetbrains.kotlin.types.ConstantValueKind

internal fun String.asFirExpression(): FirLiteralExpression<String> =
internal fun String.asFirExpression(): FirLiteralExpression =
buildLiteralExpression(null, ConstantValueKind.String, this, setType = true)
Loading

0 comments on commit b7f01c5

Please sign in to comment.