Skip to content

Commit

Permalink
Migrate to connect-rpc (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
skhugh authored Apr 12, 2024
1 parent 7e66ba0 commit 163fb39
Show file tree
Hide file tree
Showing 32 changed files with 571 additions and 526 deletions.
1 change: 0 additions & 1 deletion .idea/gradle.xml

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

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.

10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("com.android.application") version libs.versions.agp apply false
id("com.android.library") version libs.versions.agp apply false
id("org.jetbrains.kotlin.android") version "1.9.22" apply false
id("org.jetbrains.kotlin.android") version "1.9.23" apply false
id("com.google.protobuf") version "0.9.4" apply false
id("org.jmailen.kotlinter") version "4.1.1" apply true
id("org.jetbrains.dokka") version "1.9.10" apply false
Expand All @@ -21,11 +21,15 @@ subprojects {
afterEvaluate {
if (tasks.names.contains("formatKotlinMain")) {
tasks.named<SourceTask>("formatKotlinMain") {
exclude("**/generated/**")
exclude {
it.file.path.contains("generated/")
}
}

tasks.named<SourceTask>("lintKotlinMain") {
exclude("**/generated/**")
exclude {
it.file.path.contains("generated/")
}
}
}
}
Expand Down
25 changes: 4 additions & 21 deletions docker/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,14 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy-ci.yaml']
depends_on:
- yorkie
yorkie:
image: 'yorkieteam/yorkie:0.4.10'
image: 'yorkieteam/yorkie:0.4.15'
container_name: 'yorkie'
command: [
'server',
'--mongo-connection-uri',
'mongodb://mongo:27017',
]
command: ['server', '--mongo-connection-uri', 'mongodb://mongo:27017']
restart: always
ports:
- '11101:11101'
- '11102:11102'
- '8080:8080'
- '8081:8081'
depends_on:
- mongo
mongo:
Expand Down
31 changes: 4 additions & 27 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
version: '3.3'

services:
envoy:
build:
context: ./
dockerfile: ./envoy.Dockerfile
image: 'grpcweb:envoy'
container_name: 'envoy'
restart: always
ports:
- '8080:8080'
- '9901:9901'
command: ['/etc/envoy/envoy.yaml']
depends_on:
- yorkie
# If you're using Mac or Windows, this special domain name("host.docker.internal" which makes containers able to connect to the host)
# is supported by default.
# But if you're using Linux and want an envoy container to communicate with the host,
# it may help to define "host.docker.internal" in extra_hosts.
# (Actually, other hostnames are available, but in that case you should update clusters[].host configurations of envoy.yaml)
extra_hosts:
- "host.docker.internal:host-gateway"
yorkie:
image: 'yorkieteam/yorkie:0.4.10'
image: 'yorkieteam/yorkie:0.4.15'
container_name: 'yorkie'
command: [
'server',
'--enable-pprof',
]
command: ['server', '--enable-pprof']
restart: always
ports:
- '11101:11101'
- '11102:11102'
- '8080:8080'
- '8081:8081'
54 changes: 0 additions & 54 deletions docker/envoy-ci.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions docker/envoy.Dockerfile

This file was deleted.

59 changes: 0 additions & 59 deletions docker/envoy.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions examples/kanban/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ android {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
kotlinCompilerExtensionVersion = libs.versions.androidxComposeCompiler.get()
}
packagingOptions {
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class KanbanBoardActivity : ComponentActivity() {
private val viewModel: KanbanBoardViewModel by viewModels {
viewModelFactory {
initializer {
val client = Client(this@KanbanBoardActivity, "api.yorkie.dev", 443)
val client = Client("https://api.yorkie.dev")
KanbanBoardViewModel(client)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MainActivity : AppCompatActivity() {
private val viewModel: EditorViewModel by viewModels {
viewModelFactory {
initializer {
val client = Client(this@MainActivity, "api.yorkie.dev", 443)
val client = Client("https://api.yorkie.dev")
EditorViewModel(client)
}
}
Expand Down
57 changes: 23 additions & 34 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,38 @@
minSdk = "24"
compileSdk = "34"
targetSdk = "34"
agp = "8.2.1"
protobuf = "3.25.2"
grpc = "1.61.0"
grpc-kotlin = "1.4.1"
kotlinx-coroutines = "1.7.3"
androidx-activity = "1.8.2"
androidx-lifecycle = "2.7.0"
androidx-benchmark = "1.2.3"
androidx-compose-compiler = "1.5.8"
agp = "8.3.2"
connectKotlin = "0.6.0"
okhttp = "4.12.0"
coroutines = "1.8.0"
androidxActivity = "1.8.2"
androidxLifecycle = "2.7.0"
androidxBenchmark = "1.2.3"
androidxComposeCompiler = "1.5.11"

[libraries]
grpc-stub = { group = "io.grpc", name = "grpc-stub", version.ref = "grpc" }
grpc-protobuf = { group = "io.grpc", name = "grpc-protobuf-lite", version.ref = "grpc" }
grpc-kotlin = { group = "io.grpc", name = "grpc-kotlin-stub", version.ref = "grpc-kotlin" }
grpc-android = { group = "io.grpc", name = "grpc-android", version.ref = "grpc" }
grpc-okhttp = { group = "io.grpc", name = "grpc-okhttp", version.ref = "grpc" }
androidx-annotation = { module = "androidx.annotation:annotation", version = "1.7.1" }
connect-kotlin-google-javalite-ext = { module = "com.connectrpc:connect-kotlin-google-javalite-ext", version.ref = "connectKotlin" }
connect-kotlin-okhttp = { module = "com.connectrpc:connect-kotlin-okhttp", version.ref = "connectKotlin" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }

protobuf-kotlin = { group = "com.google.protobuf", name = "protobuf-kotlin-lite", version.ref = "protobuf" }
guava = { module = "com.google.guava:guava", version = "33.1.0-android" }

kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version = "0.3.5" }

apache-commons-collections = { group = "org.apache.commons", name = "commons-collections4", version = "4.4" }

androidx-core = { group = "androidx.core", name = "core-ktx", version = "1.12.0" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version = "1.6.1" }
androidx-activity = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidx-activity" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidx-activity" }
androidx-activity = { group = "androidx.activity", name = "activity-ktx", version.ref = "androidxActivity" }
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version = "2.1.4" }
androidx-lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-benchmark = { group = "androidx.benchmark", name = "benchmark-junit4", version.ref = "androidx-benchmark" }
androidx-lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "androidxLifecycle" }
androidx-lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "androidxLifecycle" }
androidx-benchmark = { group = "androidx.benchmark", name = "benchmark-junit4", version.ref = "androidxBenchmark" }

androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version = "2024.01.00" }
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version = "2024.04.00" }
androidx-compose-ui = { module = "androidx.compose.ui:ui" }
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
Expand All @@ -46,9 +44,7 @@ material = { group = "com.google.android.material", name = "material", version =

gson = { group = "com.google.code.gson", name = "gson", version = "2.10.1" }

grpc-testing = { group = "io.grpc", name = "grpc-testing", version.ref = "grpc" }
grpc-inprocess = { group = "io.grpc", name = "grpc-inprocess", version.ref = "grpc" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" }
junit = { group = "junit", name = "junit", version = "4.13.2" }
androidx-test-runner = { group = "androidx.test", name = "runner", version = "1.5.2" }
androidx-test-junit = { group = "androidx.test.ext", name = "junit-ktx", version = "1.1.5" }
Expand All @@ -57,14 +53,7 @@ androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espres
mockito-kotlin = { group = "org.mockito.kotlin", name = "mockito-kotlin", version = "4.1.0" }

[bundles]
grpc = [
"grpc-stub",
"grpc-protobuf",
"grpc-kotlin",
"grpc-android",
"grpc-okhttp",
"protobuf-kotlin",
]
rpc = ["okhttp", "connect-kotlin-okhttp", "connect-kotlin-google-javalite-ext"]

[plugins]
androidx-benchmark = { id = "androidx.benchmark", version.ref = "androidx-benchmark" }
androidx-benchmark = { id = "androidx.benchmark", version.ref = "androidxBenchmark" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Jun 16 11:23:01 KST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ dependencyResolutionManagement {
}
}
rootProject.name = "Yorkie Android SDK"
include(":examples:kanban", ":examples:texteditor", ":yorkie", ":yorkie:proto", ":microbenchmark")
include(":examples:kanban", ":examples:texteditor", ":yorkie", ":microbenchmark")
11 changes: 11 additions & 0 deletions yorkie/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: v1
plugins:
- plugin: buf.build/connectrpc/kotlin:v0.6.0
out: kotlin
opt: lite
- plugin: buf.build/protocolbuffers/kotlin
out: kotlin
opt: lite
- plugin: buf.build/protocolbuffers/java
out: java
opt: lite
3 changes: 3 additions & 0 deletions yorkie/buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- proto
4 changes: 4 additions & 0 deletions yorkie/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1
lint:
use:
- DEFAULT
Loading

0 comments on commit 163fb39

Please sign in to comment.