Closed CptSpaceToaster closed 9 years ago
This might be an issue with Gradle forcing J8, looking into this...
Edit: Yup... Gradle is forcing J8 here.... what a bummer.
Is there another method other than using the pluggins
block or downloading and compiling it myself? I suppose I could stash a copy in my git repo, but I'm trying to allow my project to be compiled everywhere on J7, without having too many extra steps in setup.
Edit: Edit: I opened a report on Gradle's Forum: http://discuss.gradle.org/t/gradle-plugins-block-does-not-function-using-java-7/8595
Sorry for the chatter.
Hmmm... sorry for all of the github chatter, but this was my problem: https://github.com/cjstehno/gradle-natives/issues/8
No problem. Should this issue be closed or are you still having issues?
Long story short:
Gotcha. I will have to dig deeper into it to see what's still using J8. I should be able to look at it this week.
So... when I was trying to get this to work, I just circumvented the pluggin with these two code blocks in my build.gradle:
String os = System.properties['os.name'].toLowerCase()
if (project.hasProperty('os')) {
os = project.os.toLowerCase()
} else {
if (os.contains("windows"))
os = "windows"
if (os.contains("linux"))
os = "linux"
if (os.contains("os x"))
os = "osx"
}
and
// Add a task to copy the native libraries to the $buildDir/natives/$os directory
task ('installNatives', type: Copy) {
def artifacts = configurations.compile.resolvedConfiguration.resolvedArtifacts.findAll { it.classifier == "natives-$os" }
artifacts.each {
from zipTree(it.file)
}
into "$buildDir/natives/$os"
}
// Add the natives lib to the java.library.path for testing
run {
systemProperty "java.library.path", "$buildDir/natives/$os"
}
run.dependsOn 'installNatives'
I asked gradle where it hid the natives, and then did some OS fuzzing to detect what I'm running on, and where I should copy too. You can override the os using the flag -Pos="linux"
https://github.com/CptSpaceToaster/OpenGL-boiler/blob/master/build.gradle
Thoughts? I think this pluggin might be improved by looking at System.properties['os.name'].toLowerCase()
I will look into your suggestions, might make a good default value. Also, I think I have a fix for the Java 8 requirement. I fixed a similar issue at work today which basically comes down to replacing:
compileJava {
sourceCompatibility = 7
targetCompatibility = 7
}
with
sourceCompatibility = 7
targetCompatibility = 7
I should be able to test this in the next day or two.
@CptSpaceToaster - Please install v0.2.2 when you have a chance and let me know if you continue to have issues. The .class
files are reading as 7 now so this should be fixed. The new version is deployed to bintray, but not appearing on the Gradle plugins site yet so you might need to verify the version.
Works!
I think I have everything setup properly, but I'm getting an odd error that seems to relate to mismatched JVM versions:
Build.gradle
This is what happens in my console
Full stacktrace: https://gist.github.com/CptSpaceToaster/003d66f6f2cc807eb2f2
Any idea what I'm doing wrong?