Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark opening close #1524

Draft
wants to merge 15 commits into
base: releases
Choose a base branch
from
Prev Previous commit
Next Next commit
Clean up
  • Loading branch information
clementetb committed Sep 20, 2023
commit fd9f19b399ede9598c7d9adf605a0a0297a934b5
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/io/realm/BenchmarkClassGenerator.kt
Original file line number Diff line number Diff line change
@@ -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
@@ -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(),
@@ -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()
)
@@ -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()
)
@@ -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()
)