Last active
June 17, 2024 08:45
-
-
Save sasssass/6cd1d397fa4a7c8e669d62804a46f2ee to your computer and use it in GitHub Desktop.
NodeProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun generateCode(symbol: KSFunctionDeclaration, route: String, args: ArrayList<String>, | |
optionalArgs: ArrayList<String>) { | |
val functionName = symbol.simpleName.asString() | |
val packageName = symbol.packageName.asString() | |
val fileName = "${functionName}GraphNode" | |
val typeBuilder = TypeSpec.objectBuilder(fileName) | |
// add properties and functions to typeBuilder | |
val fileSpec = FileSpec.builder(packageName, fileName).addType(typeBuilder.build()).build() | |
val dependencies = Dependencies(false, symbol.containingFile!!) | |
val file = codeGenerator.createNewFile(dependencies, packageName, fileName) | |
file.bufferedWriter().use { fileSpec.writeTo(it) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment