-
-
Save big-guy/a4e1c3738d152f49701a7c9c4eb41217 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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