Skip to content

Commit

Permalink
Preload core-rust lib on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasGasior1 committed Mar 10, 2023
1 parent 3781910 commit d452924
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ allprojects {
tasks.withType(Test) {
systemProperty "file.encoding", "UTF-8"
jvmArgs("--enable-preview")
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug"
}

tasks.withType(JavaExec) {
jvmArgs("--enable-preview")
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug"
}
}
Expand Down
5 changes: 5 additions & 0 deletions cli-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ task generateNodeKey(type: Exec) {

group = "Execution"
description = "Generate Node key"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"com.radixdlt.cloud.AWSSecrets",
Expand All @@ -178,6 +179,7 @@ task generateDevUniverse(type: Exec) {
dependsOn ':olympia-engine:jar'
group = "Execution"
description = "Generate development universe"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"-Dlog4j.configurationFile=${projectDir.path + "/src/main/resources/generateuniverses.log4j2.properties"}",
Expand All @@ -194,6 +196,7 @@ task generateGenesisFile(type: Exec) {
dependsOn ':olympia-engine:jar'
group = "Execution"
description = "Generate development universe"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
commandLine "java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(),
"-Djava.library.path=${project(':core-rust').projectDir}/target/debug/",
"-Dlog4j.configurationFile=${projectDir.path + "/src/main/resources/generateuniverses.log4j2.properties"}",
Expand Down Expand Up @@ -251,13 +254,15 @@ task runTargetedIntegrationTests(type: Test) {

task runAllIntegrationTests(type: Test) {
environment "RADIX_NODE_KEYSTORE_PASSWORD", "supersecret"
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug/"
testClassesDirs = sourceSets.integration.output.classesDirs
classpath = sourceSets.integration.runtimeClasspath
}

task runP2pTests(type: JavaExec) {
classpath = sourceSets.p2pTest.runtimeClasspath
environment "LD_PRELOAD", "${project(':core-rust').projectDir}/target/debug/libcorerust.so"
systemProperty "java.library.path", "${project(':core-rust').projectDir}/target/debug/"
main = "com.radixdlt.p2ptest.LargeMessageTest"

Expand Down
2 changes: 1 addition & 1 deletion shell/radix-shell.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
RADIX_NODE_KEYSTORE_PASSWORD=supersecret RADIXDLT_CONSOLE_APPENDER_THRESHOLD=OFF jshell -R -Djava.library.path=$(./gradlew -q cli-tools:getNativeLibPathForRadixShell) --enable-preview --class-path $(./gradlew -q cli-tools:getClassPathForRadixShell) ./shell/shell-init.java -R -Djava.net.preferIPv4Stack=true
RADIX_NODE_KEYSTORE_PASSWORD=supersecret RADIXDLT_CONSOLE_APPENDER_THRESHOLD=OFF LD_PRELOAD=$(./gradlew -q cli-tools:getNativeLibPathForRadixShell)/libcorerust.so:$LD_PRELOAD jshell -R -Djava.library.path=$(./gradlew -q cli-tools:getNativeLibPathForRadixShell) --enable-preview --class-path $(./gradlew -q cli-tools:getClassPathForRadixShell) ./shell/shell-init.java -R -Djava.net.preferIPv4Stack=true

0 comments on commit d452924

Please sign in to comment.