Skip to content

Commit

Permalink
Migrate utils-benchmarks to version catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Sep 30, 2024
1 parent 2a385b4 commit fa52c63
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
4 changes: 3 additions & 1 deletion libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ apache-httpclient = "4.5.14"
logback = "1.5.7"

instrumenter = "3.3.4"
jmh-plugin = "0.6.7"
jmh-plugin = "0.7.2"

junit = "5.11.1"
junit4 = "4.13.2"

[libraries]

Expand All @@ -38,6 +39,7 @@ instrumenter = { module = "com.google.code.java-allocation-instrumenter:java-all

junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }
junit4 = { module = "junit:junit", version.ref = "junit4" }

[plugins]

Expand Down
37 changes: 13 additions & 24 deletions utils-benchmarks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
plugins {
kotlin("jvm") version "2.0.20"
kotlin("plugin.allopen") version "2.0.20"
kotlin("plugin.serialization") version "2.0.20"
id("org.jetbrains.kotlinx.atomicfu") version "0.25.0"
id("me.champeau.jmh") version "0.6.5"
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.allopen)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlinx.atomicfu)
alias(libs.plugins.jmh)
}

allOpen {
Expand All @@ -13,27 +13,19 @@ allOpen {
group = "org.example"
version = "1.0-SNAPSHOT"

val serialization_version= "1.7.1"
val instrumenter by configurations.creating
val instrumenterName = "java-allocation-instrumenter"
val instrumenter_version = "3.3.4"

repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib"))
implementation("junit:junit:4.13.2")
implementation(libs.junit4)

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version")
implementation("io.ktor:ktor-io:2.1.0")
implementation("io.ktor:ktor-utils:2.1.0")
implementation("io.ktor:ktor-network:2.1.0")

instrumenter("com.google.code.java-allocation-instrumenter:$instrumenterName:$instrumenter_version")
implementation("com.google.code.java-allocation-instrumenter:$instrumenterName:$instrumenter_version")
implementation(libs.kotlinx.serialization.json)
implementation(libs.ktor.io)
implementation(libs.ktor.utils)
implementation(libs.ktor.network)

instrumenter(libs.instrumenter)
implementation(libs.instrumenter)
}

jmh {
Expand All @@ -57,10 +49,7 @@ jmh {

}

val agentPath = instrumenter.toList().find {
it.name.contains("$instrumenterName-$instrumenter_version.jar")
}?.path

val agentPath = instrumenter.singleOrNull()?.path
check(agentPath != null) { "Instrumentation agent is not found. Please check the configuration" }

tasks.test {
Expand Down
17 changes: 16 additions & 1 deletion utils-benchmarks/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
rootProject.name = "utils-benchmarks"
@file:Suppress("UnstableApiUsage")

dependencyResolutionManagement {
repositories {
mavenCentral()
}

versionCatalogs {
create("libs") {
from(files("../libs.versions.toml"))

version("ktor", "2.1.0")
}
}
}

rootProject.name = "utils-benchmarks"

0 comments on commit fa52c63

Please sign in to comment.