Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
clementetb committed Sep 20, 2023
1 parent 34e6711 commit fd9f19b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/io/realm/BenchmarkClassGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.realm
import com.squareup.kotlinpoet.ClassName
import com.squareup.kotlinpoet.TypeSpec
import com.squareup.kotlinpoet.FileSpec
import com.squareup.kotlinpoet.ParameterizedTypeName
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import com.squareup.kotlinpoet.PropertySpec
import com.squareup.kotlinpoet.TypeVariableName
Expand All @@ -13,15 +14,15 @@ import kotlin.reflect.KClass

private val REALM_OBJECT_CLASS_NAME = ClassName("io.realm.kotlin.types", "RealmObject")
private val REALM_LIST_CLASS_NAME = ClassName("io.realm.kotlin.types", "RealmList")
private val KCLASS_SET_CLASS_NAME = List::class
private val KCLASS_LIST_CLASS_NAME: ParameterizedTypeName = List::class
.asClassName()
.parameterizedBy(
KClass::class
.asClassName()
.parameterizedBy(TypeVariableName("out RealmObject"))
)

private val MAP_SETS_CLASS_NAME = Map::class
private val MAP_STRING_KCLASS_LIST_CLASS_NAME: ParameterizedTypeName = Map::class
.asClassName()
.parameterizedBy(
String::class.asClassName(),
Expand All @@ -34,7 +35,7 @@ private val MAP_SETS_CLASS_NAME = Map::class
)
)

private val STRINT_REALM_LIST_CLASS_NAME = REALM_LIST_CLASS_NAME
private val STRINT_REALM_LIST_CLASS_NAME: ParameterizedTypeName = REALM_LIST_CLASS_NAME
.parameterizedBy(
String::class.asClassName()
)
Expand Down Expand Up @@ -102,7 +103,7 @@ private fun generateClasses(
// add a property to facilitate accessing these generated classes
addProperty(
PropertySpec
.builder(setName, KCLASS_SET_CLASS_NAME)
.builder(setName, KCLASS_LIST_CLASS_NAME)
.initializer(classesAsList)
.build()
)
Expand Down Expand Up @@ -130,7 +131,7 @@ fun generateSuiteEntryPoint(

addProperty(
PropertySpec
.builder("${name}ClassesMap", MAP_SETS_CLASS_NAME)
.builder("${name}ClassesMap", MAP_STRING_KCLASS_LIST_CLASS_NAME)
.initializer(generatedSetsAsMap)
.build()
)
Expand Down

0 comments on commit fd9f19b

Please sign in to comment.