Skip to content

Commit

Permalink
Create :io:gtfs module
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz committed Feb 22, 2025
1 parent 73e93e1 commit a3e9539
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
4 changes: 4 additions & 0 deletions IO/gtfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Wire - Protobuf

Run `./gradlew generateCommonMainProtos`, to generate Kotlin files form .proto files.
The files will be generated in the following dir: `build/generated/source/wire/`
70 changes: 70 additions & 0 deletions IO/gtfs/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
android {
namespace = "xyz.ksharma.krail.io.gtfs"
}

plugins {
alias(libs.plugins.krail.android.library)
alias(libs.plugins.krail.kotlin.multiplatform)
alias(libs.plugins.krail.compose.multiplatform)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.wire)
}

kotlin {
applyDefaultHierarchyTemplate()

androidTarget()
iosArm64()
iosSimulatorArm64()

sourceSets {
androidMain.dependencies {
api(libs.di.koinAndroid)
}

commonMain {
dependencies {
implementation(projects.core.log)
implementation(projects.core.di)

implementation(libs.kotlinx.serialization.json)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.auth)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.kotlinx.datetime)
implementation(compose.runtime)

api(libs.di.koinComposeViewmodel)
}
}

iosMain {
dependencies {
}
}

commonTest {
dependencies {
implementation(libs.test.kotlin)
implementation(libs.test.turbine)
implementation(libs.test.kotlinxCoroutineTest)
}
}
}
}


wire {
kotlin {
javaInterop = true
out = "$projectDir/build/generated/source/wire"
}
protoPath {
srcDir("src/commonMain/proto")
}
sourcePath {
srcDir("src/commonMain/proto")
}
}
22 changes: 22 additions & 0 deletions IO/gtfs/src/commonMain/proto/NswStop.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";

package app.krail.kgtfs.proto;

message NswStop {

/** The stop ID is a unique identifier for the stop. */
string stopId = 1;

// The stop name is the name of the stop.
string stopName = 2;

double lat = 3;
double lon = 4;

// The product class is a list of transport modes that the stop is associated with.
repeated int32 productClass = 5;
}

message NswStopList {
repeated NswStop nswStops = 1;
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ plugins {
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.firebase.crashlyticsPlugin) apply false
alias(libs.plugins.firebase.performancePlugin) apply false
alias(libs.plugins.wire) apply false
}
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android-lifecycle = "2.8.7"
activity-compose = "1.9.3"
kotlinxCollectionsImmutable = "0.3.8"
kotlinxDatetime = "0.6.2"
kotlinxIoCore = "0.6.0"
lifecycleViewmodelCompose = "2.8.4"
navigationCompose = "2.8.0-alpha10"
kotlinxSerializationJson = "1.8.0"
Expand All @@ -32,6 +33,7 @@ activity-compose = { group = "androidx.activity", name = "activity-compose", ver

kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-io-core = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinxIoCore" }
lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "android-lifecycle" }
navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" }
Expand Down Expand Up @@ -97,6 +99,7 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref =
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqlDelight" }
firebase-crashlyticsPlugin = { id = "com.google.firebase.crashlytics", version = "3.0.3" }
firebase-performancePlugin = { id ="com.google.firebase.firebase-perf", version = "1.4.2" }
wire = { id = "com.squareup.wire", version = "5.3.0" }

#Convention Plugins
krail-android-application = { id = "krail.android.application", version = "unspecified" }
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ include(":feature:trip-planner:state")
include(":feature:trip-planner:network")
include(":sandook")
include(":gtfs-static")
include(":io:gtfs")

0 comments on commit a3e9539

Please sign in to comment.