Skip to content

Instantly share code, notes, and snippets.

@big-guy
Created Jun 9, 2016
Embed
What would you like to do?
import java.nio.file.Paths
import java.nio.file.Files
apply plugin: 'cpp'
model {
repositories {
libs(PrebuiltLibraries) {
jvm {
/* Fails with
> Exception thrown while executing model rule: repositories { ... } @ build.gradle line 7, column 5
> Could not find method findJdkIncludePath() for arguments [] on object of type org.gradle.nativeplatform.internal.prebuilt.DefaultPrebuiltLibrary.
*/
println findJdkIncludePath()
}
}
}
components {
main(NativeLibrarySpec) {
sources {
cpp {
/* Fails with
> Exception thrown while executing model rule: main(org.gradle.nativeplatform.NativeLibrarySpec) { ... } @ build.gradle line 16, column 9 > named(cpp)
> No signature of method: sun.nio.fs.UnixPath.resolve() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, java.lang.String) values: [jdk1.8.0_60, include]
Possible solutions: resolve(java.lang.String), resolve(java.nio.file.Path)
*/
println findJdkIncludePath()
lib library: "jvm", linkage: "api"
}
}
}
}
}
def findJdkIncludePath() {
def programFilesJava = Paths.get(null, "Java")
def javaVersion = System.properties['java.version']
// Throws MethodMissingException
return programFilesJava.resolve("jdk${javaVersion}", "include")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment