Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion utbot-usvm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,41 @@ dependencies {
usvmInstrumentationCollector("$usvmRepo:usvm-jvm-instrumentation-collectors:$usvmVersion")
usvmInstrumentationRunner("$usvmRepo:usvm-jvm-instrumentation:$usvmVersion")
usvmInstrumentationRunner("$usvmRepo:usvm-jvm-instrumentation-collectors:$usvmVersion")
}
}

// TODO replace with runner from usvm (unavailable due to huge jar size)
val usvmInstrumentationRunnerJarTask by tasks.register<Jar>("usvmInstrumentationRunnerJar") {
archiveBaseName.set("usvm-jvm-instrumentation-runner")
archiveVersion.set("")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

manifest {
attributes(
"Main-Class" to "org.usvm.instrumentation.rd.InstrumentedProcessKt",
"Premain-Class" to "org.usvm.instrumentation.agent.Agent",
"Can-Retransform-Classes" to "true",
"Can-Redefine-Classes" to "true"
)
}

from(configurations.named("usvmInstrumentationRunner").get().map {
if (it.isDirectory) it else zipTree(it)
})
}

tasks.processResources {
listOf(
approximations,
usvmApproximationsApi,
usvmInstrumentationCollector,
usvmInstrumentationRunnerJarTask,
).forEach { source ->
from(source) {
into("lib")
rename {
it.replace("-$usvmVersion", "")
.replace("-$approximationsVersion", "")
}
}
}
}
17 changes: 17 additions & 0 deletions utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcJars.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.utbot.usvm.jc

import org.utbot.common.JarUtils

object JcJars {
val approximationsJar by lazy { extractUsvmJar("approximations.jar") }
val approximationsApiJar by lazy { extractUsvmJar("usvm-jvm-api.jar") }
val collectorsJar by lazy { extractUsvmJar("usvm-jvm-instrumentation-collectors.jar") }
val runnerJar by lazy { extractUsvmJar("usvm-jvm-instrumentation-runner.jar") }

private fun extractUsvmJar(jarFileName: String) = JarUtils.extractJarFileFromResources(
jarFileName = jarFileName,
jarResourcePath = "lib/$jarFileName",
targetDirectoryName = "usvm"
)
}