Today i tried running nsight from gradle. Here is the working script:
tasks.register<Exec>("nsight") {
group = "application"
val javaExecTask = tasks.named<JavaExec>("run").get()
val javaHome = javaExecTask.javaLauncher.get().metadata.installationPath.asFile.absolutePath
commandLine = listOf(
"PATH TO ngfx.exe",
"--activity=Frame Debugger",
"--wait-hotkey",
"--dir", ".",
"--exe",
"$javaHome/bin/java",
"--args",
"-classpath "+sourceSets.main.get().runtimeClasspath.asPath+" CLASS_TO_RUN",
)
}