Skip to content

Instantly share code, notes, and snippets.

@big-guy
Created June 9, 2016 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save big-guy/a4e1c3738d152f49701a7c9c4eb41217 to your computer and use it in GitHub Desktop.
Save big-guy/a4e1c3738d152f49701a7c9c4eb41217 to your computer and use it in GitHub Desktop.
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