From 817166c1280c602b9372d96384c561d49c7ef6d1 Mon Sep 17 00:00:00 2001 From: Ben Liblit Date: Sun, 21 Jan 2018 16:18:06 -0600 Subject: [PATCH] Compute a library path from the native software model Previously we were repeating the library path twice, but that's not good for long-term maintenance. That being said, extracting this information from the depths of the native software model seems *far* more complex than it should be. I had hoped for something nicer in response to , but so far there's nothing. --- com.ibm.wala.cast/build.gradle | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/com.ibm.wala.cast/build.gradle b/com.ibm.wala.cast/build.gradle index 3cd076320..284f753a2 100644 --- a/com.ibm.wala.cast/build.gradle +++ b/com.ibm.wala.cast/build.gradle @@ -69,11 +69,22 @@ model { exportedHeaders.srcDirs = ["$cSourceDir/include"] lib library: 'jdk' } - binaries.all { - switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") { - case 'linux/x86-64': - // TODO: compute path on following line from 'jdk' library properties somehow - linker.args '-Wl,-rpath', "$currentJavaHome/jre/lib/amd64/server" + binaries { + withType(StaticLibraryBinarySpec) { + buildable = false + } + withType(SharedLibraryBinarySpec) { + switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") { + case 'linux/x86-64': + $ + .repositories['libs'] + .resolveLibrary('jdk') + .binaries + .withType(SharedLibraryBinary) + .findResults { it.sharedLibraryLinkFile } + *.parentFile + .each { linker.args "-Wl,-rpath=$it" } + } } } }