Skip to content

Commit

Permalink
write schema to schema.pb (#515)
Browse files Browse the repository at this point in the history
  • Loading branch information
worstell authored Oct 20, 2023
1 parent eef7f10 commit ef71d34
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/common/moduleconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type ModuleConfig struct {
Language string `toml:"language"`
Module string `toml:"module"`
Deploy []string `toml:"deploy"`
Schema string `toml:"schema"`
}

// LoadConfig from a directory.
Expand Down
2 changes: 1 addition & 1 deletion cmd/ftl/cmd_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (d *deployCmd) Run(ctx context.Context, client ftlv1connect.ControllerServi
return errors.WithStack(err)
}

schema, err := findFiles(d.Base, []string{config.Module})
schema, err := findFiles(d.Base, []string{config.Schema})
if err != nil {
return errors.WithStack(err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@ class ModuleGenerator() {

Path.of(buildDir, "ftl.toml").writeText(
"""
module = "${module}"
module = "$module"
language = "kotlin"
deploy = ["main", "classes", "dependency", "classpath.txt"]
schema = "schema.pb"
""".trimIndent()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class SchemaExtractor(val logger: KSPLogger, val options: Map<String, String>) :
modules.map {
Module(name = it.key, decls = it.value.decls.sortedBy { it.data_ == null }, comments = it.value.comments)
}.forEach {
val file = File(outputDirectory.absolutePath, it.name)
val file = File(outputDirectory.absolutePath, "schema.pb")
file.createNewFile()
val os = FileOutputStream(file)
os.write(it.encode())
Expand Down

0 comments on commit ef71d34

Please sign in to comment.