Skip to content

Commit

Permalink
Make kotlin-runtime a multi-module project (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
wesbillman authored Sep 6, 2023
1 parent 5825249 commit 0070255
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 75 deletions.
15 changes: 8 additions & 7 deletions examples/echo-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
repositories {
flatDir {
dirs("../../kotlin-runtime/ftl-plugin/build/libs")
}
mavenCentral()
}

plugins {
kotlin("jvm") version "1.9.0"
// Apply the java-library plugin for API and implementation separation.
`java-library`
id("xyz.block.ftl")
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

dependencies {
implementation("xyz.block.ftl:ftl-runtime")
implementation("xyz.block:ftl-runtime")
}

ftl {
Expand Down
9 changes: 1 addition & 8 deletions examples/echo-kotlin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
plugins {}

rootProject.name = "echo"
includeBuild("../../kotlin-runtime/ftl-runtime") {
dependencySubstitution {
substitute(module("xyz.block.ftl:ftl-runtime")).using(project(":"))
}
}

includeBuild("../../kotlin-runtime/ftl-plugin")
includeBuild("../../kotlin-runtime")
9 changes: 9 additions & 0 deletions kotlin-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
allprojects {
repositories {
mavenCentral()
}
}

plugins {
kotlin("jvm") version "1.9.0"
}
13 changes: 1 addition & 12 deletions kotlin-runtime/ftl-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
buildscript {
dependencies {
classpath("com.squareup.wire:wire-gradle-plugin:4.7.2")
}
}

plugins {
kotlin("jvm") version "1.9.0"
kotlin("jvm")
id("java-gradle-plugin")
id("com.squareup.wire") version "4.7.2"
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

group = "xyz.block"
version = "1.0-SNAPSHOT"

Expand Down
24 changes: 0 additions & 24 deletions kotlin-runtime/ftl-plugin/settings.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class FTLClient(ftlEndpoint: String) {
}

fun getSchema(): Schema? {
val schemas = mutableListOf<PullSchemaResponse>()
val client = grpcClient.create(ControllerServiceClient::class)
return client.GetSchema().executeBlocking(GetSchemaRequest()).schema
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ModuleGenerator() {
val file = FileSpec.builder(namespace, className)
.addFileComment("Code generated by FTL-Plugin, do not edit.")

schema.comments?.let {
schema.comments.let {
file.addFileComment("\n")
file.addFileComment(it.joinToString("\n"))
}
Expand All @@ -51,10 +51,10 @@ class ModuleGenerator() {
FunSpec.constructorBuilder().build()
)

val types = schema.decls?.mapNotNull { it.data_ } ?: listOf()
val types = schema.decls.mapNotNull { it.data_ }
types.forEach { file.addType(buildDataClass(it)) }

val verbs = schema.decls?.mapNotNull { it.verb } ?: listOf()
val verbs = schema.decls.mapNotNull { it.verb }
verbs.forEach { moduleClass.addFunction(buildVerbFunction(className, it)) }

file.addType(moduleClass.build())
Expand Down
2 changes: 1 addition & 1 deletion kotlin-runtime/ftl-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version = "0.1.0-SNAPSHOT"

plugins {
id("com.squareup.wire") version "4.7.2"
kotlin("jvm") version "1.9.0"
kotlin("jvm")
// Apply the java-library plugin for API and implementation separation.
`java-library`
}
Expand Down
19 changes: 0 additions & 19 deletions kotlin-runtime/ftl-runtime/settings.gradle.kts

This file was deleted.

2 changes: 2 additions & 0 deletions kotlin-runtime/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = "kotlin-runtime"
include(":ftl-plugin", ":ftl-runtime")

0 comments on commit 0070255

Please sign in to comment.