Skip to content

Commit ee5446e

Browse files
committed
restructure transport modules
* rename ktor-websocket to ktor-websocket-internal and make it an implementation dependency (not exposed) * move all transports under `rsocket-transports` folder * drop empty modules * implement small DSL for including projects
1 parent cd050d5 commit ee5446e

File tree

52 files changed

+96
-139
lines changed

Some content is hidden

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

52 files changed

+96
-139
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2015-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package rsocketsettings
18+
19+
import org.gradle.api.initialization.*
20+
21+
fun Settings.projects(block: ProjectsScope.() -> Unit) {
22+
ProjectsScope(settings, emptyList(), emptyList()).apply(block)
23+
}
24+
25+
class ProjectsScope(
26+
private val settings: Settings,
27+
private val pathParts: List<String>,
28+
private val prefixParts: List<String>,
29+
) {
30+
31+
fun module(name: String) {
32+
val moduleName = (prefixParts + name).joinToString("-")
33+
val modulePath = (pathParts + name).joinToString("/")
34+
35+
settings.include(moduleName)
36+
settings.project(":$moduleName").projectDir = settings.rootDir.resolve(modulePath)
37+
}
38+
39+
fun module(name: String, prefix: String = name, nested: ProjectsScope.() -> Unit = {}) {
40+
module(name)
41+
folder(name, prefix, nested)
42+
}
43+
44+
fun folder(name: String, prefix: String = name, block: ProjectsScope.() -> Unit) {
45+
ProjectsScope(settings, pathParts + name, prefixParts + prefix).apply(block)
46+
}
47+
}

rsocket-ktor/api/rsocket-ktor.api

Whitespace-only changes.

rsocket-ktor/build.gradle.kts

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

rsocket-ktor/rsocket-ktor-client/build.gradle.kts renamed to rsocket-ktor/client/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ kotlin {
2929

3030
sourceSets {
3131
commonMain.dependencies {
32-
api(projects.rsocketKtor)
32+
implementation(projects.rsocketTransportKtorWebsocketInternal)
33+
api(projects.rsocketCore)
3334
api(libs.ktor.client.websockets)
3435
}
3536
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import io.ktor.client.request.*
2323
import io.ktor.http.*
2424
import io.rsocket.kotlin.*
2525
import io.rsocket.kotlin.transport.*
26-
import io.rsocket.kotlin.transport.ktor.websocket.*
26+
import io.rsocket.kotlin.transport.ktor.websocket.internal.*
2727
import kotlin.coroutines.*
2828

2929
public suspend fun HttpClient.rSocket(

rsocket-ktor/rsocket-ktor-server/build.gradle.kts renamed to rsocket-ktor/server/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ kotlin {
2828

2929
sourceSets {
3030
commonMain.dependencies {
31-
api(projects.rsocketKtor)
31+
implementation(projects.rsocketTransportKtorWebsocketInternal)
32+
api(projects.rsocketCore)
3233
api(libs.ktor.server.websockets)
3334
}
3435
commonTest.dependencies {
35-
implementation(projects.rsocketKtor.rsocketKtorClient)
36+
implementation(projects.rsocketKtorClient)
3637
implementation(projects.rsocketTransportTests) //port provider
3738
implementation(libs.ktor.client.cio)
3839
implementation(libs.ktor.server.cio)

0 commit comments

Comments
 (0)