Skip to content

Commit 0078733

Browse files
authored
Ktor (#2)
* Multiplatform compile migration started, missing Linux build for curl * Start trying to add ktor dependencies to multiplatform build * Complete multiplatform migration to build on Linux and Macos targets Migrate to Ktor instead of libcurl Change publication to kotlinMultiplatform Unit tests for aws interactions
1 parent e68bce2 commit 0078733

File tree

33 files changed

+351
-305
lines changed

33 files changed

+351
-305
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- run:
1010
name: Build runtime
1111
command: |
12-
./gradlew clean build LambdaRuntimeTest
12+
./gradlew clean build linuxTest
1313
- deploy:
1414
name: Publish to Bintray
1515
command: |

build.gradle

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import org.gradle.internal.os.OperatingSystem
21
plugins {
3-
id 'kotlin-multiplatform' version '1.3.21'
2+
id 'org.jetbrains.kotlin.multiplatform' version '1.3.31'
43
id 'maven-publish'
54
id "com.jfrog.bintray" version "1.8.4"
65
}
@@ -11,39 +10,43 @@ version project.findProperty('buildNum') ?: '0.0.1_SNAPSHOT'
1110
repositories {
1211
mavenCentral()
1312
jcenter()
13+
maven { url "https://kotlin.bintray.com/kotlinx" }
14+
maven { url "https://kotlin.bintray.com/ktor" }
1415
}
1516

1617
kotlin {
17-
targets {
18-
if (OperatingSystem.current().isMacOsX()) {
19-
println("Building for Mac")
20-
fromPreset(presets.macosX64, 'LambdaRuntime')
21-
}
22-
else {
23-
println("Building for Linux")
24-
fromPreset(presets.linuxX64, 'LambdaRuntime')
25-
}
18+
macosX64("macos")
19+
linuxX64("linux")
20+
}
2621

27-
configure([LambdaRuntime]) {
28-
compilations.main.cinterops {
29-
libcurl
30-
}
31-
}
32-
}
33-
sourceSets {
34-
// Note: To enable common source sets please comment out 'kotlin.import.noCommonSourceSets' property
35-
// in gradle.properties file and re-import your project in IDE.
36-
LambdaRuntimeMain {
37-
}
38-
LambdaRuntimeTest {
39-
}
40-
}
22+
dependencies {
23+
commonMainImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.2.1"
24+
commonMainImplementation "io.ktor:ktor-client-core:$ktor_version"
25+
26+
commonTestImplementation "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
27+
commonTestImplementation "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
28+
commonTestImplementation "io.ktor:ktor-client-mock:$ktor_version"
29+
commonTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.2.1"
30+
31+
macosMainImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.1'
32+
macosMainImplementation "io.ktor:ktor-client-core-native:$ktor_version"
33+
macosMainImplementation "io.ktor:ktor-client-curl:$ktor_version"
34+
35+
macosTestApi "io.ktor:ktor-client-mock-native:$ktor_version"
36+
macosTestApi 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.1'
37+
38+
linuxMainImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.1'
39+
linuxMainImplementation "io.ktor:ktor-client-core-native:$ktor_version"
40+
linuxMainImplementation "io.ktor:ktor-client-curl:$ktor_version"
41+
42+
linuxTestApi "io.ktor:ktor-client-mock-native:$ktor_version"
43+
linuxTestApi 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.1'
4144
}
4245

46+
4347
publishing {
4448
publications {
45-
LambdaRuntime {
46-
artifactId = "lambda-runtime-kotlin-native"
49+
kotlinMultiplatform {
4750
groupId = 'com.batchofcode'
4851
artifactId = 'lambda-runtime-kotlin-native'
4952
version = project.findProperty('buildNum') ?: '0.0.1_SNAPSHOT'

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
kotlin.code.style=official
2-
kotlin.import.noCommonSourceSets=true
3-
kotlin_version=1.3.20
2+
kotlin.import.noCommonSourceSets=false
3+
kotlin_version=1.3.30
4+
ktor_version=1.2.0-rc
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.3.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/LambdaRuntimeMain/kotlin/httprekwest/HttpRekwest.kt

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/LambdaRuntimeMain/kotlin/httprekwest/HttpResponse.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/LambdaRuntimeMain/kotlin/httprekwest/KUrlHttpRekwest.kt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/LambdaRuntimeMain/kotlin/kurl/KUrl.kt

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/LambdaRuntimeMain/kotlin/kurl/RequestType.kt

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/LambdaRuntimeMain/kotlin/runtime/client/EnvironmentConfiguration.kt

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)