Add documentation to definitions
This commit is contained in:
parent
8dc8db1866
commit
fcc4d87610
@ -10,6 +10,10 @@ expect class Sha512State
|
|||||||
expect class GenericHashState
|
expect class GenericHashState
|
||||||
|
|
||||||
expect class Crypto internal constructor() {
|
expect class Crypto internal constructor() {
|
||||||
|
/**
|
||||||
|
* Initialize the SHA256 hash
|
||||||
|
* returns sha 256 state
|
||||||
|
*/
|
||||||
fun crypto_hash_sha256_init(): Sha256State
|
fun crypto_hash_sha256_init(): Sha256State
|
||||||
|
|
||||||
fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray)
|
fun crypto_hash_sha256_update(state: Sha256State, input: UByteArray)
|
||||||
|
@ -14,6 +14,10 @@ actual typealias Sha512State = Any
|
|||||||
actual typealias GenericHashState = Any
|
actual typealias GenericHashState = Any
|
||||||
|
|
||||||
actual class Crypto internal actual constructor() {
|
actual class Crypto internal actual constructor() {
|
||||||
|
/**
|
||||||
|
* Initialize the SHA256 hash
|
||||||
|
* returns sha 256 state
|
||||||
|
*/
|
||||||
actual fun crypto_hash_sha256_init(): dynamic {
|
actual fun crypto_hash_sha256_init(): dynamic {
|
||||||
println("Debug crypto_hash_sha256_init")
|
println("Debug crypto_hash_sha256_init")
|
||||||
val result = js("getSodium().crypto_hash_sha256_init()")
|
val result = js("getSodium().crypto_hash_sha256_init()")
|
||||||
|
@ -15,6 +15,10 @@ actual typealias Sha512State = Hash.State512
|
|||||||
actual typealias GenericHashState = ByteArray
|
actual typealias GenericHashState = ByteArray
|
||||||
|
|
||||||
actual class Crypto internal actual constructor() {
|
actual class Crypto internal actual constructor() {
|
||||||
|
/**
|
||||||
|
* Initialize the SHA256 hash
|
||||||
|
* returns sha 256 state
|
||||||
|
*/
|
||||||
actual fun crypto_hash_sha256_init(): Sha256State {
|
actual fun crypto_hash_sha256_init(): Sha256State {
|
||||||
val state = debug.test.Sha256State()
|
val state = debug.test.Sha256State()
|
||||||
println("Debug crypto_hash_sha256_init")
|
println("Debug crypto_hash_sha256_init")
|
||||||
|
@ -27,6 +27,10 @@ actual class Crypto internal actual constructor() {
|
|||||||
|
|
||||||
val _emitByteArray: ByteArray = ByteArray(0)
|
val _emitByteArray: ByteArray = ByteArray(0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the SHA256 hash
|
||||||
|
* returns sha 256 state
|
||||||
|
*/
|
||||||
actual fun crypto_hash_sha256_init(): Sha256State {
|
actual fun crypto_hash_sha256_init(): Sha256State {
|
||||||
val allocated = sodium_malloc(debug.test.Sha256State.size.convert())!!
|
val allocated = sodium_malloc(debug.test.Sha256State.size.convert())!!
|
||||||
val state = allocated.reinterpret<debug.test.Sha256State>().pointed
|
val state = allocated.reinterpret<debug.test.Sha256State>().pointed
|
||||||
|
@ -25,6 +25,7 @@ class KotlinFileDefinition(
|
|||||||
|
|
||||||
class ClassDefinition(
|
class ClassDefinition(
|
||||||
val name: String,
|
val name: String,
|
||||||
|
val codeDocumentation: String = "",
|
||||||
val innerClasses: MutableList<InnerClassDefinition> = mutableListOf(),
|
val innerClasses: MutableList<InnerClassDefinition> = mutableListOf(),
|
||||||
val methods: MutableList<FunctionDefinition> = mutableListOf()
|
val methods: MutableList<FunctionDefinition> = mutableListOf()
|
||||||
) {
|
) {
|
||||||
@ -46,6 +47,7 @@ class InnerClassDefinition(
|
|||||||
val javaName: String,
|
val javaName: String,
|
||||||
val jsName: String,
|
val jsName: String,
|
||||||
val nativeName: String,
|
val nativeName: String,
|
||||||
|
val codeDocumentation: String = "",
|
||||||
val functions: MutableList<FunctionDefinition> = mutableListOf()
|
val functions: MutableList<FunctionDefinition> = mutableListOf()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,6 +56,7 @@ class FunctionDefinition(
|
|||||||
val javaName: String,
|
val javaName: String,
|
||||||
val jsName: String,
|
val jsName: String,
|
||||||
val nativeName: String,
|
val nativeName: String,
|
||||||
|
val codeDocumentation: String = "",
|
||||||
val parameterList: MutableList<ParameterDefinition> = mutableListOf(),
|
val parameterList: MutableList<ParameterDefinition> = mutableListOf(),
|
||||||
val returnType: GeneralTypeDefinition,
|
val returnType: GeneralTypeDefinition,
|
||||||
val dynamicJsReturn: Boolean = false,
|
val dynamicJsReturn: Boolean = false,
|
||||||
@ -75,6 +78,10 @@ class ParameterDefinition(
|
|||||||
val specificJvmInitializer: String? = null,
|
val specificJvmInitializer: String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class CodeBlockDefinition(
|
||||||
|
codeBlock: String
|
||||||
|
)
|
||||||
|
|
||||||
interface GeneralTypeDefinition {
|
interface GeneralTypeDefinition {
|
||||||
val typeName: TypeName
|
val typeName: TypeName
|
||||||
}
|
}
|
||||||
@ -98,17 +105,24 @@ fun fileDef(name: String, body: KotlinFileDefinition.() -> Unit): KotlinFileDefi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun classDef(name: String, body: ClassDefinition.() -> Unit): ClassDefinition {
|
fun classDef(name: String, codeDocumentation: String = "",body: ClassDefinition.() -> Unit): ClassDefinition {
|
||||||
val commonClass = ClassDefinition(name)
|
val commonClass = ClassDefinition(name, codeDocumentation)
|
||||||
commonClass.body()
|
commonClass.body()
|
||||||
return commonClass
|
return commonClass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun codeBlock(codeBlock: String) : CodeBlockDefinition {
|
||||||
|
val codeBlockDefinition = CodeBlockDefinition(codeBlock)
|
||||||
|
return codeBlockDefinition
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fun innerClassDef(
|
fun innerClassDef(
|
||||||
name: String,
|
name: String,
|
||||||
javaName: String,
|
javaName: String,
|
||||||
jsName: String,
|
jsName: String,
|
||||||
nativeName: String,
|
nativeName: String,
|
||||||
|
codeDocumentation: String = "",
|
||||||
specificConstructor : String? = null,
|
specificConstructor : String? = null,
|
||||||
body: InnerClassDefinition.() -> Unit = {}
|
body: InnerClassDefinition.() -> Unit = {}
|
||||||
): InnerClassDefinition {
|
): InnerClassDefinition {
|
||||||
@ -116,7 +130,8 @@ fun innerClassDef(
|
|||||||
name,
|
name,
|
||||||
javaName,
|
javaName,
|
||||||
jsName,
|
jsName,
|
||||||
nativeName
|
nativeName,
|
||||||
|
codeDocumentation
|
||||||
)
|
)
|
||||||
genClass.body()
|
genClass.body()
|
||||||
return genClass
|
return genClass
|
||||||
@ -127,6 +142,7 @@ fun funcDef(
|
|||||||
javaName: String,
|
javaName: String,
|
||||||
jsName: String,
|
jsName: String,
|
||||||
nativeName: String,
|
nativeName: String,
|
||||||
|
codeDocumentation: String = "",
|
||||||
returnType: GeneralTypeDefinition,
|
returnType: GeneralTypeDefinition,
|
||||||
dynamicJsReturn: Boolean = false,
|
dynamicJsReturn: Boolean = false,
|
||||||
isStateCreationFunction: Boolean = false,
|
isStateCreationFunction: Boolean = false,
|
||||||
@ -138,6 +154,7 @@ fun funcDef(
|
|||||||
javaName,
|
javaName,
|
||||||
jsName,
|
jsName,
|
||||||
nativeName,
|
nativeName,
|
||||||
|
codeDocumentation,
|
||||||
returnType = returnType,
|
returnType = returnType,
|
||||||
dynamicJsReturn = dynamicJsReturn,
|
dynamicJsReturn = dynamicJsReturn,
|
||||||
isStateCreationFunction = isStateCreationFunction,
|
isStateCreationFunction = isStateCreationFunction,
|
||||||
@ -149,6 +166,7 @@ fun funcDef(
|
|||||||
|
|
||||||
fun funcDef(
|
fun funcDef(
|
||||||
name: String,
|
name: String,
|
||||||
|
codeDocumentation: String = "",
|
||||||
returnType: GeneralTypeDefinition,
|
returnType: GeneralTypeDefinition,
|
||||||
dynamicJsReturn: Boolean = false,
|
dynamicJsReturn: Boolean = false,
|
||||||
isStateCreationFunction: Boolean = false,
|
isStateCreationFunction: Boolean = false,
|
||||||
@ -161,6 +179,7 @@ fun funcDef(
|
|||||||
name,
|
name,
|
||||||
name,
|
name,
|
||||||
name,
|
name,
|
||||||
|
codeDocumentation,
|
||||||
returnType = returnType,
|
returnType = returnType,
|
||||||
dynamicJsReturn = dynamicJsReturn,
|
dynamicJsReturn = dynamicJsReturn,
|
||||||
isStateCreationFunction = isStateCreationFunction,
|
isStateCreationFunction = isStateCreationFunction,
|
||||||
|
@ -21,8 +21,8 @@ fun ClassDefinition.defineGenericHashFunctions() {
|
|||||||
|
|
||||||
+funcDef(
|
+funcDef(
|
||||||
"crypto_generichash_init",
|
"crypto_generichash_init",
|
||||||
CustomTypeDefinition(ClassName(packageName, "GenericHashState")),
|
returnType = CustomTypeDefinition(ClassName(packageName, "GenericHashState")),
|
||||||
true,
|
dynamicJsReturn = true,
|
||||||
isStateCreationFunction = true
|
isStateCreationFunction = true
|
||||||
) {
|
) {
|
||||||
+ParameterDefinition(
|
+ParameterDefinition(
|
||||||
|
@ -19,7 +19,11 @@ fun ClassDefinition.defineHashFunctions() {
|
|||||||
)
|
)
|
||||||
+funcDef(
|
+funcDef(
|
||||||
"crypto_hash_sha256_init",
|
"crypto_hash_sha256_init",
|
||||||
CustomTypeDefinition(ClassName(packageName, "Sha256State")),
|
codeDocumentation = """
|
||||||
|
Initialize the SHA256 hash
|
||||||
|
returns sha 256 state
|
||||||
|
""".trimIndent(),
|
||||||
|
returnType = CustomTypeDefinition(ClassName(packageName, "Sha256State")),
|
||||||
dynamicJsReturn = true,
|
dynamicJsReturn = true,
|
||||||
isStateCreationFunction = true
|
isStateCreationFunction = true
|
||||||
) {
|
) {
|
||||||
@ -31,7 +35,7 @@ fun ClassDefinition.defineHashFunctions() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
+funcDef("crypto_hash_sha256_update", TypeDefinition.UNIT) {
|
+funcDef("crypto_hash_sha256_update", returnType = TypeDefinition.UNIT) {
|
||||||
+ParameterDefinition(
|
+ParameterDefinition(
|
||||||
"state",
|
"state",
|
||||||
CustomTypeDefinition((withPackageName("Sha256State"))),
|
CustomTypeDefinition((withPackageName("Sha256State"))),
|
||||||
@ -40,7 +44,7 @@ fun ClassDefinition.defineHashFunctions() {
|
|||||||
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
||||||
}
|
}
|
||||||
|
|
||||||
+funcDef("crypto_hash_sha256_final", TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 32) {
|
+funcDef("crypto_hash_sha256_final", returnType = TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 32) {
|
||||||
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha256State"))))
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha256State"))))
|
||||||
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
||||||
}
|
}
|
||||||
@ -56,8 +60,8 @@ fun ClassDefinition.defineHashFunctions() {
|
|||||||
)
|
)
|
||||||
+funcDef(
|
+funcDef(
|
||||||
"crypto_hash_sha512_init",
|
"crypto_hash_sha512_init",
|
||||||
CustomTypeDefinition(ClassName(packageName, "Sha512State")),
|
returnType = CustomTypeDefinition(ClassName(packageName, "Sha512State")),
|
||||||
true,
|
dynamicJsReturn = true,
|
||||||
isStateCreationFunction = true
|
isStateCreationFunction = true
|
||||||
) {
|
) {
|
||||||
+ParameterDefinition(
|
+ParameterDefinition(
|
||||||
@ -68,12 +72,12 @@ fun ClassDefinition.defineHashFunctions() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
+funcDef("crypto_hash_sha512_update", TypeDefinition.UNIT) {
|
+funcDef("crypto_hash_sha512_update", returnType = TypeDefinition.UNIT) {
|
||||||
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
||||||
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
+ParameterDefinition("input", TypeDefinition.ARRAY_OF_UBYTES_LONG_SIZE)
|
||||||
}
|
}
|
||||||
|
|
||||||
+funcDef("crypto_hash_sha512_final", TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 64) {
|
+funcDef("crypto_hash_sha512_final", returnType = TypeDefinition.ARRAY_OF_UBYTES, outputLengthWhenArray = 64) {
|
||||||
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
+ParameterDefinition("state", CustomTypeDefinition((withPackageName("Sha512State"))))
|
||||||
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
+ParameterDefinition("out", TypeDefinition.ARRAY_OF_UBYTES_NO_SIZE, isActuallyAnOutputParam = true, dropParameterFromDefinition = true)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
||||||
|
|
||||||
|
import com.squareup.kotlinpoet.ClassName
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 14/Aug/2020
|
||||||
|
*/
|
||||||
|
fun ClassDefinition.defineSecretStreamFunctions() {
|
||||||
|
+innerClassDef(
|
||||||
|
"SecretStreamState",
|
||||||
|
"com.goterl.lazycode.lazysodium.interfaces.SecretStream.State",
|
||||||
|
"SecretStreamState",
|
||||||
|
"crypto_hash_sha256_state"
|
||||||
|
)
|
||||||
|
+funcDef(
|
||||||
|
"crypto_secretstream_xchacha20poly1305_init_push",
|
||||||
|
returnType = TypeDefinition.ARRAY_OF_UBYTES,
|
||||||
|
dynamicJsReturn = true,
|
||||||
|
isStateCreationFunction = true
|
||||||
|
) {
|
||||||
|
+ParameterDefinition(
|
||||||
|
"state",
|
||||||
|
CustomTypeDefinition((withPackageName("SecretStreamState"))),
|
||||||
|
dropParameterFromDefinition = true,
|
||||||
|
isActuallyAnOutputParam = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
package com.ionspin.kotlin.crypto.generator.libsodium.definitions
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 14/Aug/2020
|
|
||||||
*/
|
|
||||||
fun ClassDefinition.defineSecretStreamFunctions() {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -49,7 +49,7 @@ object CommonLibsodiumGenerator {
|
|||||||
return innerClassBuilder.build()
|
return innerClassBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createCommonMethodSpec(methodDefinition: FunctionDefinition): FunSpec {
|
fun createCommonMethodSpec(methodDefinition: FunctionDefinition): FunSpec.Builder {
|
||||||
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
var actualReturnType : TypeName = Any::class.asTypeName()
|
var actualReturnType : TypeName = Any::class.asTypeName()
|
||||||
var actualReturnTypeFound : Boolean = false
|
var actualReturnTypeFound : Boolean = false
|
||||||
@ -69,7 +69,7 @@ object CommonLibsodiumGenerator {
|
|||||||
} else {
|
} else {
|
||||||
methodBuilder.returns(methodDefinition.returnType.typeName)
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
}
|
}
|
||||||
return methodBuilder.build()
|
return methodBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ object JsLibsodiumGenerator {
|
|||||||
return innerClassBuilder.build()
|
return innerClassBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createJsFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
fun createJsFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec.Builder {
|
||||||
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
|
|
||||||
var returnModifierFound = false
|
var returnModifierFound = false
|
||||||
@ -121,7 +121,7 @@ object JsLibsodiumGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
methodBuilder.addStatement(constructJsCall.toString())
|
methodBuilder.addStatement(constructJsCall.toString())
|
||||||
return methodBuilder.build()
|
return methodBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
fun paramsToString(methodDefinition: FunctionDefinition): String {
|
fun paramsToString(methodDefinition: FunctionDefinition): String {
|
||||||
|
@ -55,7 +55,7 @@ object JvmLibsodiumGenerator {
|
|||||||
return innerClassBuilder.build()
|
return innerClassBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createJvmFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
fun createJvmFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec.Builder {
|
||||||
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
||||||
var returnModifierFound = false
|
var returnModifierFound = false
|
||||||
@ -141,7 +141,7 @@ object JvmLibsodiumGenerator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
methodBuilder.returns(methodDefinition.returnType.typeName)
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
return methodBuilder.build()
|
return methodBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createOutputParam(outputParam: ParameterDefinition, length: String?, methodBuilder: FunSpec.Builder) {
|
fun createOutputParam(outputParam: ParameterDefinition, length: String?, methodBuilder: FunSpec.Builder) {
|
||||||
|
@ -70,7 +70,7 @@ object NativeLibsodiumGenerator {
|
|||||||
return innerClassBuilder.build()
|
return innerClassBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createNativeFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec {
|
fun createNativeFunctionImplementation(methodDefinition: FunctionDefinition): FunSpec.Builder {
|
||||||
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
val methodBuilder = FunSpec.builder(methodDefinition.name)
|
||||||
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
methodBuilder.modifiers += MultiplatformModifier.ACTUAL.modifierList
|
||||||
var returnModifierFound = false
|
var returnModifierFound = false
|
||||||
@ -159,7 +159,7 @@ object NativeLibsodiumGenerator {
|
|||||||
|
|
||||||
methodBuilder.returns(methodDefinition.returnType.typeName)
|
methodBuilder.returns(methodDefinition.returnType.typeName)
|
||||||
|
|
||||||
return methodBuilder.build()
|
return methodBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createStateParam(stateParameterDefinition: ParameterDefinition, methodBuilder: FunSpec.Builder) {
|
fun createStateParam(stateParameterDefinition: ParameterDefinition, methodBuilder: FunSpec.Builder) {
|
||||||
|
@ -15,7 +15,7 @@ import com.squareup.kotlinpoet.TypeSpec
|
|||||||
fun createClass(
|
fun createClass(
|
||||||
classDefinition: ClassDefinition,
|
classDefinition: ClassDefinition,
|
||||||
multiplatformModifier: MultiplatformModifier,
|
multiplatformModifier: MultiplatformModifier,
|
||||||
methodCreator: (FunctionDefinition) -> FunSpec
|
methodCreator: (FunctionDefinition) -> FunSpec.Builder
|
||||||
): TypeSpec.Builder {
|
): TypeSpec.Builder {
|
||||||
val commonClassBuilder = TypeSpec.classBuilder(classDefinition.name)
|
val commonClassBuilder = TypeSpec.classBuilder(classDefinition.name)
|
||||||
// Ugly
|
// Ugly
|
||||||
@ -29,9 +29,15 @@ fun createClass(
|
|||||||
commonClassBuilder.primaryConstructor(primaryConstructor.build())
|
commonClassBuilder.primaryConstructor(primaryConstructor.build())
|
||||||
commonClassBuilder.modifiers += multiplatformModifier.modifierList
|
commonClassBuilder.modifiers += multiplatformModifier.modifierList
|
||||||
for (methodDefinition in classDefinition.methods) {
|
for (methodDefinition in classDefinition.methods) {
|
||||||
commonClassBuilder.addFunction(methodCreator(methodDefinition))
|
val builder = methodCreator(methodDefinition)
|
||||||
|
generateDocumentationForMethod(builder, methodDefinition)
|
||||||
|
commonClassBuilder.addFunction(builder.build())
|
||||||
}
|
}
|
||||||
return commonClassBuilder
|
return commonClassBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun generateDocumentationForMethod(builder: FunSpec.Builder, methodSpec: FunctionDefinition) {
|
||||||
|
builder.addKdoc(methodSpec.codeDocumentation)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user