Declare common library dependencies for source sets, not binaries

No sense repeating this for each binary when it's the same for all of
them.
This commit is contained in:
Ben Liblit 2017-12-24 17:43:31 -06:00
parent b9e712bfa9
commit e52c8d981d
2 changed files with 11 additions and 9 deletions

View File

@ -50,15 +50,15 @@ model {
include 'smoke.cpp' include 'smoke.cpp'
} }
generatedBy tasks.generateJniHeaders generatedBy tasks.generateJniHeaders
['cast', 'jdk'].each {
lib project: ':com.ibm.wala.cast', library: it
}
} }
binaries { binaries {
withType(StaticLibraryBinarySpec) { withType(StaticLibraryBinarySpec) {
buildable = false buildable = false
} }
all { all {
['cast', 'jdk'].each {
lib project: ':com.ibm.wala.cast', library: it
}
// TODO: compute path on following line from 'cast' library properties somehow // TODO: compute path on following line from 'cast' library properties somehow
linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared" linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
// TODO: compute path on following line from 'jdk' library properties somehow // TODO: compute path on following line from 'jdk' library properties somehow
@ -67,14 +67,16 @@ model {
} }
} }
smoke_main(NativeExecutableSpec) { smoke_main(NativeExecutableSpec) {
sources.cpp.source { sources.cpp {
source {
srcDir 'harness-src/c' srcDir 'harness-src/c'
include 'smoke_main.cpp' include 'smoke_main.cpp'
} }
binaries.all {
['cast', 'jdk'].each { ['cast', 'jdk'].each {
lib project: ':com.ibm.wala.cast', library: it lib project: ':com.ibm.wala.cast', library: it
} }
}
binaries.all {
// TODO: compute path on following line from 'cast' library properties somehow // TODO: compute path on following line from 'cast' library properties somehow
linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared" linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
// TODO: compute path on following line from 'jdk' library properties somehow // TODO: compute path on following line from 'jdk' library properties somehow

View File

@ -34,9 +34,9 @@ model {
include '*.cpp' include '*.cpp'
} }
exportedHeaders.srcDir "$cSourceDir/include" exportedHeaders.srcDir "$cSourceDir/include"
lib library: 'jdk'
} }
binaries.all { binaries.all {
lib library: 'jdk'
// TODO: compute path on following line from 'jdk' library properties somehow // TODO: compute path on following line from 'jdk' library properties somehow
linker.args '-Wl,-rpath', "$currentJavaHome/jre/lib/amd64/server" linker.args '-Wl,-rpath', "$currentJavaHome/jre/lib/amd64/server"
} }