mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx packaging: diagnostics added (IDEA-104000; IDEA-104004)
(cherry picked from commit b480554b55ea5a7e76d6959490997627f6c79654)
This commit is contained in:
+43
-15
@@ -66,6 +66,10 @@ public abstract class AbstractJavaFxPackager {
|
||||
|
||||
|
||||
public void createJarAndDeploy(final String binPath) {
|
||||
if (!checkNotEmpty(getAppClass(), "Application class")) return;
|
||||
if (!checkNotEmpty(getWidth(), "Width")) return;
|
||||
if (!checkNotEmpty(getHeight(), "Height")) return;
|
||||
|
||||
final String zipPath = getArtifactOutputFilePath();
|
||||
|
||||
final File tempUnzippedArtifactOutput;
|
||||
@@ -112,9 +116,19 @@ public abstract class AbstractJavaFxPackager {
|
||||
final int result = startProcess(commandLine);
|
||||
if (result == 0) {
|
||||
deploy(binPath, tempDirWithJar, tempUnzippedArtifactOutput);
|
||||
} else {
|
||||
registerJavaFxPackagerError("JavaFX createJar task has failed.");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkNotEmpty(final String text, final String title) {
|
||||
if (StringUtil.isEmptyOrSpaces(text)) {
|
||||
registerJavaFxPackagerError("Unable to build JavaFX artifact. " + title + " should be specified in artifact's settings.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void appendPreloader(List<String> commandLine, boolean appendPreloaderJar) {
|
||||
final String preloaderClass = getPreloaderClass();
|
||||
final String preloaderJar = getPreloaderJar();
|
||||
@@ -172,26 +186,32 @@ public abstract class AbstractJavaFxPackager {
|
||||
registerJavaFxPackagerError(e);
|
||||
return;
|
||||
}
|
||||
addParameter(commandLine, tempDirectory.getPath());
|
||||
try {
|
||||
addParameter(commandLine, tempDirectory.getPath());
|
||||
|
||||
addParameter(commandLine, "-outfile");
|
||||
addParameter(commandLine, artifactName);
|
||||
addParameter(commandLine, "-outfile");
|
||||
addParameter(commandLine, artifactName);
|
||||
|
||||
addParameter(commandLine, "-srcdir");
|
||||
addParameter(commandLine, tempDirWithCreatedJar.getPath());
|
||||
addParameter(commandLine, "-srcdir");
|
||||
addParameter(commandLine, tempDirWithCreatedJar.getPath());
|
||||
|
||||
addParameter(commandLine, "-v");
|
||||
addParameter(commandLine, "-v");
|
||||
|
||||
final int result = startProcess(commandLine);
|
||||
if (result == 0) {
|
||||
if (isEnabledSigning()) {
|
||||
signApp(binPath, tempDirectory);
|
||||
final int result = startProcess(commandLine);
|
||||
if (result == 0) {
|
||||
if (isEnabledSigning()) {
|
||||
signApp(binPath, tempDirectory);
|
||||
}
|
||||
} else {
|
||||
registerJavaFxPackagerError("JavaFX deploy task has failed.");
|
||||
}
|
||||
}
|
||||
FileUtil.delete(tempUnzippedArtifactOutput);
|
||||
FileUtil.delete(new File(getArtifactOutputFilePath()));
|
||||
copyResultsToArtifactsOutput(tempDirWithCreatedJar);
|
||||
copyResultsToArtifactsOutput(tempDirectory);
|
||||
finally {
|
||||
FileUtil.delete(tempUnzippedArtifactOutput);
|
||||
FileUtil.delete(new File(getArtifactOutputFilePath()));
|
||||
copyResultsToArtifactsOutput(tempDirWithCreatedJar);
|
||||
copyResultsToArtifactsOutput(tempDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
private void signApp(String binPath, File tempDirectory) {
|
||||
@@ -208,6 +228,11 @@ public abstract class AbstractJavaFxPackager {
|
||||
addParameter(signCommandLine, getAlias(selfSigning));
|
||||
|
||||
final int signedResult = startProcess(signCommandLine);
|
||||
if (signedResult != 0) {
|
||||
registerJavaFxPackagerError("JavaFX sign task has failed.");
|
||||
}
|
||||
} else {
|
||||
registerJavaFxPackagerError("JavaFX generate certificate task has failed.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +332,10 @@ public abstract class AbstractJavaFxPackager {
|
||||
private int startProcess(List<String> commands) {
|
||||
try {
|
||||
final Process process = new ProcessBuilder(commands).start();
|
||||
LOG.info(new String(FileUtil.loadBytes(process.getErrorStream())));
|
||||
final String message = new String(FileUtil.loadBytes(process.getErrorStream()));
|
||||
if (!StringUtil.isEmptyOrSpaces(message)) {
|
||||
registerJavaFxPackagerError(message);
|
||||
}
|
||||
return process.waitFor();
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
-7
@@ -26,7 +26,6 @@ import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactManager;
|
||||
import com.intellij.packaging.artifacts.ArtifactProperties;
|
||||
@@ -36,7 +35,6 @@ import com.intellij.packaging.impl.elements.ArchivePackagingElement;
|
||||
import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.ArtifactPropertiesEditor;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.xmlb.XmlSerializerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -108,11 +106,6 @@ public class JavaFxArtifactProperties extends ArtifactProperties<JavaFxArtifactP
|
||||
final JavaFxArtifactProperties properties =
|
||||
(JavaFxArtifactProperties)artifact.getProperties(JavaFxArtifactPropertiesProvider.getInstance());
|
||||
|
||||
if (StringUtil.isEmptyOrSpaces(properties.getAppClass())) {
|
||||
compileContext.addMessage(CompilerMessageCategory.ERROR, "No application class specified for JavaFX package", null, -1, -1);
|
||||
return;
|
||||
}
|
||||
|
||||
new JavaFxPackager(artifact, properties, compileContext).createJarAndDeploy(binPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user