google / flatbuffers

FlatBuffers: Memory Efficient Serialization Library
https://flatbuffers.dev/
Apache License 2.0
23.17k stars 3.24k forks source link

[kotlin-kmp] Enums only files skipped when multiple schemas are used as input #8218

Closed DadiBit closed 2 months ago

DadiBit commented 8 months ago

I have multiple fbs source files. Some of these have tables, some others have enums, which are included and used in those tables. When I run flatc --kotlin-kmp schema/*.fbs I see that MyEnum.kt is always "empty": the file doesn't have any enum, just the "head":

// automatically generated by the FlatBuffers compiler, do not modify

package com.openmeteo.flatbuffers.forecast

import com.google.flatbuffers.kotlin.*
import kotlin.jvm.JvmInline

But (!), when I run flatc --kotlin-kmp schema/model.fbs everything is fixed.

"Actually, you could just run a loop as workaround" - strangely, looping over each single file doesn't fix the issue: I suspect there's some async/caching stuff not getting properly set/cleaned-up, or at the very least something time-related.

Can anyone else replicate the issue with the latest repo source code?

If needed, I can share my fbs files.

My finds so far:

Kind regards :smile:

DadiBit commented 8 months ago

Found a workaround: Comment out the if (enum_def.generated) return; check at L383: https://github.com/google/flatbuffers/blob/129ef422e8a4e89d87a7216a865602673a6d0bf3/src/idl_gen_kotlin_kmp.cpp#L380-L381

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.

github-actions[bot] commented 2 months ago

This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.