task(dependsOn: [prepareLibDir, classes], task_name, type: JavaExec) {
systemProperty "org.gradle.scan.acceptTerm", "true"
logger.info 'Task: ' + task_name + ' started execution'
doFirst {
setTmpDir()
buildFileSystem("$curInst.temp")
jvmArgs += prepareJvmArgs()
def quantumJarFile = sourceSets.main.runtimeClasspath.filter {
it.toPath().getFileName().toString().endsWith('.jar') && it.toPath().getFileName().toString().contains("quantum")
}
// Your original dynamic classpath logic
def fullClasspath = files(instanceClasspath) + quantumJarFile + (sourceSets.main.runtimeClasspath + files("${System.properties['java.io.tmpdir']}/$curInst.temp/dds") - quantumJarFile)
// --- NATIVE JAVA JAR CREATION (NO ANT ERRORS) ---
def pathingJar = new File(buildDir, "pathing-${task_name}.jar")
pathingJar.parentFile.mkdirs()
def manifest = new java.util.jar.Manifest()
manifest.mainAttributes.put(java.util.jar.Attributes.Name.MANIFEST_VERSION, "1.0")
// Convert the file list to a space-separated URI string for the manifest
def classpathString = fullClasspath.files.collect { it.toURI().toString() }.join(" ")
manifest.mainAttributes.put(java.util.jar.Attributes.Name.CLASS_PATH, classpathString)
// Create the JAR file directly
new java.util.jar.JarOutputStream(new FileOutputStream(pathingJar), manifest).withCloseable { it.finish() }
// Swap the task's classpath to the pathing JAR
classpath = files(pathingJar)
// ------------------------------------------------
if (instance_options.isDevLocal?.toString()?.toBoolean()) {
setupDevConfig()
}
fullClasspath.each { File file -> println 'classpath: ' + file }
}
// DIRECT CALL TO REAL SERVER
main = 'com.citigroup.get.quantum.server.Server'
args 'file:///' + file("src/main/config/quantum/$curInst.asset/$curInst.region${curInst.country ? "/$curInst.country" : ""}/$curInst.env"),
"$curInst.instance",
'dummy'
workingDir file('src/main/config')
standardInput = System.in
logger.info 'Task: ' + task_name + ' completes execution'
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)