Gradle -version invoke through script not as CLI command as it may take another process creation overhead and not debuggable

Is it possible to invoke gradle -version from gradle script without overhead of another process, i.e. is there any relavant task to say dependsOn and invoke version info etc.. or just call versionTask etc

I don’t want to explicity define one function for version myself. why not reuse or extend what is already provided?

Lack of any inputs, I am settling with this script.. for future reference to remove once I find one

tasks.withType<Test>().configureEach {
    afterSuite(
	KotlinClosure2<TestDescriptor, TestResult, Unit>({ desc, result ->
							     if (desc.parent == null)
							     {
								 println("\n🔧 Java (used by Gradle): ${
								     System.getProperty("java.runtime.version")
								 }")
								 println("🧠 Java VM: ${
								     System.getProperty("java.vm.name")
								 } (${System.getProperty("java.vm.version")})")
								 println(
								     "🛠 Gradle Version: ${gradle.gradleVersion}\n\n")

								 println("🔍 Test Summary:")
								 println(" - ${result.testCount} tests executed")
								 println(
								     " - ${result.successfulTestCount} succeeded")
								 println(" - ${result.failedTestCount} failed")
								 println(" - ${result.skippedTestCount} skipped")
								 println(
								     "\nTest Report: file:///" + reports.html.entryPoint.absolutePath.replace(
									 File.separatorChar, '/'))
							     }
							 }))
}

Look at the name closure name - ‘KotlinClosure2’ - No way, I could have known such a script without LLMs..