56 lines
1.5 KiB
Kotlin
56 lines
1.5 KiB
Kotlin
/*
|
|
* This file was generated by the Gradle 'init' task.
|
|
*
|
|
* This project uses @Incubating APIs which are subject to change.
|
|
*/
|
|
|
|
plugins {
|
|
// Apply the java-library plugin for API and implementation separation.
|
|
`java-library`
|
|
}
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
version = "1.0.0"
|
|
|
|
tasks.withType<Jar>().configureEach {
|
|
archiveBaseName.set(rootProject.name)
|
|
|
|
from(sourceSets.main.get().output)
|
|
|
|
dependsOn(configurations.runtimeClasspath)
|
|
from({
|
|
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
|
|
})
|
|
val cppProject = project(":CppAgent")
|
|
val nativeLibPath = cppProject.layout.buildDirectory
|
|
.dir("lib/main/debug") // or "release" if you're building release
|
|
.map { it.asFile }
|
|
.get()
|
|
.listFiles { file -> file.name.matches(Regex("lib.*\\.(so|dll|dylib)")) }
|
|
?.firstOrNull()
|
|
|
|
if (nativeLibPath != null) {
|
|
from(nativeLibPath) {
|
|
into(".") // 👈 root of the jar
|
|
}
|
|
} else {
|
|
doFirst {
|
|
throw GradleException("Native library not found in expected CppAgent build path")
|
|
}
|
|
}
|
|
manifest {
|
|
attributes(
|
|
"Main-Class" to "org.faumaray.FabricPPAgent",
|
|
"Agent-Class" to "org.faumaray.FabricPPAgent",
|
|
"Premain-Class" to "org.faumaray.FabricPPAgent"
|
|
)
|
|
}
|
|
}
|
|
|
|
tasks.named("compileJava") {
|
|
dependsOn(":CppAgent:build")
|
|
} |