-
-
Save gabizou/17bb72c43cf3554f9180 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
allprojects { | |
afterEvaluate { | |
def versions = [ | |
'1.6' : "/opt/java6/jre/lib/" | |
] | |
// convert map to classpaths | |
versions = versions.collectEntries { key, value -> | |
def path = new File(value) | |
value = path.listFiles().findAll { it.getPath().endsWith(".jar") } | |
value = value.join(File.pathSeparator) | |
return [key, value] | |
} | |
def apply = { task -> | |
if (versions.containsKey(task.targetCompatibility)) | |
{ | |
task.options.fork = true; | |
task.options.bootClasspath = versions[task.targetCompatibility] | |
} | |
} | |
tasks.withType(JavaCompile, apply) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment