mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
fbcdc23434
* ENT-1012 - Use non-privileged user * ENT-1012 - Build and run containerised tests from IntelliJ * ENT-1012 - Remove trusty source in container * ENT-1012 - Make debug target toggleable * ENT-1012 - Inform when ready to attach debugger * ENT-1012 - Update reference to user home folder
58 lines
1.7 KiB
Groovy
58 lines
1.7 KiB
Groovy
String[] runArgs(List<String> prefix, List<String> args) {
|
|
return [
|
|
*prefix,
|
|
"-Dcorda.sgx.enclave.path=/code/sgx-jvm/remote-attestation/enclave/build",
|
|
"-Djava.library.path=/code/sgx-jvm/remote-attestation/host/native/build",
|
|
"-Dattestation.home=/code/sgx-jvm/remote-attestation/host/build/logs",
|
|
"-Dfile.encoding=US-ASCII", "-Duser.country=US", "-Duser.language=en", "-Duser.variant",
|
|
"-cp", sourceSets.main.runtimeClasspath.collect { it.toString() }.join(":"),
|
|
"$debugArgs", *args
|
|
]
|
|
}
|
|
|
|
String[] containerArgs(String project, String... args) {
|
|
return [
|
|
"bash", "$projectDir/../../tools/sx/sx", "build",
|
|
"remote-attestation/$project", *args
|
|
]
|
|
}
|
|
|
|
def execWait(String[] command, String directory, String ready) {
|
|
ProcessBuilder builder = new ProcessBuilder(command)
|
|
builder.redirectErrorStream(true)
|
|
builder.directory(new File(directory))
|
|
Process process = builder.start()
|
|
|
|
if (ready == null) {
|
|
process.waitFor()
|
|
return
|
|
}
|
|
|
|
InputStream stdout = process.getInputStream()
|
|
BufferedReader reader = new BufferedReader(new
|
|
InputStreamReader(stdout))
|
|
|
|
def line
|
|
while ((line = reader.readLine()) != null) {
|
|
println line
|
|
if (line.contains(ready)) {
|
|
println "Command $command is ready"
|
|
break
|
|
}
|
|
}
|
|
|
|
stdout.close()
|
|
}
|
|
|
|
def containerDebugWait(String directory, String project, String... args) {
|
|
def ready = "Listening for transport dt_socket at address:"
|
|
execWait(containerArgs(project, args), directory, ready)
|
|
}
|
|
|
|
ext {
|
|
runArgs = this.&runArgs
|
|
containerArgs = this.&containerArgs
|
|
containerDebugWait = this.&containerDebugWait
|
|
}
|
|
|