org.gosulang.gradle.tasks.Util Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-gosu-plugin Show documentation
Show all versions of gradle-gosu-plugin Show documentation
Gosu language compiler for Gradle. Built with Gradle 5.1.1.
This has also been tested extensively with Gradle version(s): 5.1.1
** Gradle versions below 2.12 are no longer supported **
Projects applying this plugin require a compile-time dependency on the gosu-core-api library.
This version requires Gosu 1.13.9 or greater, or 1.14.2 or greater.
Please include this in the depencencies closure:
dependencies {
compile group: 'org.gosu-lang.gosu', name: 'gosu-core-api', version: '1.14.12'
}
package org.gosulang.gradle.tasks;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class Util {
private Util() {}
/**
* Takes the place of {@link org.gradle.internal.jvm.Jvm#findToolsJar(File)}
* @return the location of tools.jar
*/
public static File findToolsJar() {
Path javaHome = Paths.get(System.getProperty("java.home"));
Path toolsJar = javaHome.resolve("lib").resolve("tools.jar");
if(!Files.isRegularFile(toolsJar) && javaHome.toFile().getName().equalsIgnoreCase("jre")) {
javaHome = javaHome.getParent();
toolsJar = javaHome.resolve("lib").resolve("tools.jar");
} else {
throw new IllegalStateException("Could not find tools.jar");
}
return toolsJar.toFile();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy