[ANY] Проверка на наличие файлов javafx для proguard

This commit is contained in:
Gravit 2020-05-05 06:40:03 +07:00
parent ca5c435341
commit 80e919f4a1
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -2,6 +2,7 @@
import pro.gravit.launchserver.LaunchServer;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.LogHelper;
import proguard.Configuration;
import proguard.ConfigurationParser;
@ -10,6 +11,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ProGuardBuildTask implements LauncherBuildTask {
private final LaunchServer server;
@ -30,6 +32,21 @@ public Path process(Path inputFile) throws IOException {
Configuration proguard_cfg = new Configuration();
ConfigurationParser parser = new ConfigurationParser(server.proguardConf.buildConfig(inputFile, outputJar),
server.proguardConf.proguard.toFile(), System.getProperties());
if (JVMHelper.JVM_VERSION >= 9)
{
Path javaJModsPath = Paths.get(System.getProperty("java.home")).resolve("jmods");
if(!IOHelper.exists(javaJModsPath))
{
LogHelper.warning("Directory %s not found. It is not good", javaJModsPath);
}
else
{
//Find javaFX libraries
if(!IOHelper.exists(javaJModsPath.resolve("javafx.base.jmod"))) LogHelper.warning("javafx.base.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
if(!IOHelper.exists(javaJModsPath.resolve("javafx.graphics.jmod"))) LogHelper.warning("javafx.graphics.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
if(!IOHelper.exists(javaJModsPath.resolve("javafx.controls.jmod"))) LogHelper.warning("javafx.controls.jmod not found. Launcher can be assembled incorrectly. Maybe you need to install OpenJFX?");
}
}
try {
parser.parse(proguard_cfg);
ProGuard proGuard = new ProGuard(proguard_cfg);