mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
72 lines
2.2 KiB
Groovy
72 lines
2.2 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/attestation-host/native/build",
|
|
"-Dattestation.home=/code/sgx-jvm/remote-attestation/attestation-host/build/logs",
|
|
"-Dfile.encoding=UTF-8", "-Duser.country=US", "-Duser.language=en", "-Duser.variant",
|
|
"-cp", sourceSets.main.runtimeClasspath.collect { it.toString() }.join(":"),
|
|
debugArgs, *args
|
|
]
|
|
}
|
|
|
|
String[] containerArgs(String project, String... args) {
|
|
def buildArgs = [ "bash", "$projectDir/../../tools/sx/sx", "build" ]
|
|
if (ext.hardware) {
|
|
buildArgs << "-hp"
|
|
}
|
|
return [
|
|
*buildArgs, "remote-attestation/$project", *args
|
|
]
|
|
}
|
|
|
|
def execWait(String[] command, File directory, String ready) {
|
|
ProcessBuilder builder = new ProcessBuilder(command)
|
|
builder.redirectErrorStream(true)
|
|
builder.directory(directory)
|
|
Process process = builder.start()
|
|
|
|
if (ready == null) {
|
|
process.waitFor()
|
|
return
|
|
}
|
|
|
|
InputStream stdout = process.getInputStream()
|
|
try {
|
|
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
|
|
}
|
|
}
|
|
} finally {
|
|
stdout.close()
|
|
}
|
|
}
|
|
|
|
def containerDebugWait(File directory, String project, String... args) {
|
|
def ready = "Listening for transport dt_socket at address:"
|
|
execWait(containerArgs(project, args), directory, ready)
|
|
}
|
|
|
|
/*
|
|
* R3 Proprietary and Confidential
|
|
*
|
|
* Copyright (c) 2018 R3 Limited. All rights reserved.
|
|
*
|
|
* The intellectual and technical concepts contained herein are proprietary to R3 and its suppliers and are protected by trade secret law.
|
|
*
|
|
* Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited.
|
|
*/
|
|
|
|
ext {
|
|
runArgs = this.&runArgs
|
|
containerArgs = this.&containerArgs
|
|
containerDebugWait = this.&containerDebugWait
|
|
}
|
|
|