Skip to content

Commit

Permalink
auto generated functions are now located in the same package as annot…
Browse files Browse the repository at this point in the history
…ated class
  • Loading branch information
Intex32 committed Oct 16, 2022
1 parent e87e719 commit 2e254ab
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions processor/src/main/kotlin/ron/ModelMapperProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ class ModelMapperProcessor(
if (!symbols.iterator().hasNext())
return emptyList()

val file = codeGenerator.createNewFile(
dependencies = Dependencies(false, *resolver.getAllFiles().toList().toTypedArray()),
packageName = "ron",
fileName = "GeneratedMapperFunctions"
)

file += "package ron\n\n"
symbols.forEach { it.accept(Visitor(file), Unit) }
file.close()
symbols.forEach { classDeclaration ->
val file = codeGenerator.createNewFile(
dependencies = Dependencies(false, *resolver.getAllFiles().toList().toTypedArray()),
packageName = classDeclaration.packageName.asString(),
fileName = "AutoGeneratedMappers"
)
file += "package ${classDeclaration.packageName.asString()}\n"
classDeclaration.accept(Visitor(file), Unit)
file.close()
}

return symbols
.filterNot { it.validate() }
Expand Down

0 comments on commit 2e254ab

Please sign in to comment.