mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 21:18:27 +00:00
on the current Java Implementation. The code dependencies related to JVM were removed and the project is able to target all available platforms. The only requirement to implement to fully support a target is to implement functions described in `ByteArray.kt`. Right now the code support JVM and native targets. JS port still missing, but just be trivial to introduce. Currently, only the `jvm` and `macosX64` targets are enabled until we figure out how to enable tests on all platforms on CI. A submodule called "benchmark" is also introduced. It contains a series of benchmarks comparing Java and Kotlin implementations of FlexBuffers and the UTF8 API. Finally, this commit does not contain the scripts necessary to publish the artifacts. This will be introduced at a later stage once the team has an agreement on how to rollout Kotlin releases.
91 lines
2.5 KiB
Kotlin
91 lines
2.5 KiB
Kotlin
import org.jetbrains.kotlin.ir.backend.js.compile
|
|
|
|
plugins {
|
|
kotlin("multiplatform") version "1.4.20"
|
|
id("org.jetbrains.kotlin.plugin.allopen") version "1.4.20"
|
|
id("kotlinx.benchmark") version "0.2.0-dev-20"
|
|
id("io.morethan.jmhreport") version "0.9.0"
|
|
}
|
|
|
|
// allOpen plugin is needed for the benchmark annotations.
|
|
// for more infomation, see https://github.com/Kotlin/kotlinx-benchmark#gradle-plugin
|
|
allOpen {
|
|
annotation("org.openjdk.jmh.annotations.State")
|
|
}
|
|
|
|
group = "com.google.flatbuffers.jmh"
|
|
version = "1.12.0-SNAPSHOT"
|
|
|
|
// This plugin generates a static html page with the aggregation
|
|
// of all benchmarks ran. very useful visualization tool.
|
|
jmhReport {
|
|
val baseFolder = project.file("build/reports/benchmarks/main").absolutePath
|
|
val lastFolder = project.file(baseFolder).list()?.sortedArray()?.lastOrNull() ?: ""
|
|
jmhResultPath = "$baseFolder/$lastFolder/jvm.json"
|
|
jmhReportOutput = "$baseFolder/$lastFolder"
|
|
}
|
|
|
|
// For now we benchmark on JVM only
|
|
benchmark {
|
|
configurations {
|
|
this.getByName("main") {
|
|
iterations = 5
|
|
iterationTime = 300
|
|
iterationTimeUnit = "ms"
|
|
}
|
|
}
|
|
targets {
|
|
register("jvm")
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
jvm {
|
|
withJava()
|
|
compilations.all {
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
}
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
|
|
all {
|
|
languageSettings.enableLanguageFeature("InlineClasses")
|
|
languageSettings.useExperimentalAnnotation("kotlin.ExperimentalUnsignedTypes")
|
|
}
|
|
|
|
val commonTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-common"))
|
|
implementation(kotlin("test-annotations-common"))
|
|
}
|
|
}
|
|
val jvmTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-junit"))
|
|
}
|
|
}
|
|
val jvmMain by getting {
|
|
dependencies {
|
|
implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime:0.2.0-dev-20")
|
|
implementation(kotlin("stdlib-common"))
|
|
implementation(project(":flatbuffers-kotlin"))
|
|
implementation("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:0.2.0-dev-20")
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1")
|
|
|
|
}
|
|
}
|
|
|
|
/* Targets configuration omitted.
|
|
* To find out how to configure the targets, please follow the link:
|
|
* https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets
|
|
*/
|
|
targets {
|
|
targetFromPreset(presets.getAt("jvm"))
|
|
}
|
|
}
|
|
}
|