mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx packaging: include dependant jars into layout: jnlp, signing, etc
(cherry picked from commit 708d1719120ddf2c54d427046f3924ce7dadf4bd)
This commit is contained in:
+17
-10
@@ -119,11 +119,15 @@ public abstract class AbstractJavaFxPackager {
|
||||
}
|
||||
|
||||
private void copyLibraries(String zipPath, File tempUnzippedArtifactOutput) throws IOException {
|
||||
final String preloaderJar = getPreloaderJar();
|
||||
if (preloaderJar != null) {
|
||||
final File preloaderJarFile = new File(getArtifactOutputPath(), preloaderJar);
|
||||
if (preloaderJarFile.isFile()) {
|
||||
FileUtil.copy(preloaderJarFile, new File(tempUnzippedArtifactOutput, preloaderJarFile.getName()));
|
||||
final File[] outFiles = new File(getArtifactOutputPath()).listFiles();
|
||||
if (outFiles != null) {
|
||||
for (File file : outFiles) {
|
||||
if (file.isFile()) {
|
||||
final String fileName = file.getName();
|
||||
if (fileName.endsWith(".jar") && !zipPath.equals(fileName)) {
|
||||
FileUtil.copy(file, new File(tempUnzippedArtifactOutput, fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,10 +144,13 @@ public abstract class AbstractJavaFxPackager {
|
||||
final boolean selfSigning = isSelfSigning();
|
||||
final int genResult = selfSigning ? genKey(binPath) : 0;
|
||||
if (genResult == 0) {
|
||||
sign(binPath, selfSigning, tempDirectory.getPath() + File.separator + getArtifactRootName());
|
||||
final String preloaderJar = getPreloaderJar();
|
||||
if (preloaderJar != null) {
|
||||
sign(binPath, selfSigning, tempDirectory.getPath() + File.separator + preloaderJar);
|
||||
final File[] files = tempDirectory.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile() && file.getName().endsWith(".jar")) {
|
||||
sign(binPath, selfSigning, file.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
registerJavaFxPackagerError("JavaFX generate certificate task has failed.");
|
||||
@@ -161,7 +168,7 @@ public abstract class AbstractJavaFxPackager {
|
||||
|
||||
final int signedResult = startProcess(signCommandLine);
|
||||
if (signedResult != 0) {
|
||||
registerJavaFxPackagerError("JavaFX sign task has failed.");
|
||||
registerJavaFxPackagerError("JavaFX sign task has failed for: " + jar2Sign + ".");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-17
@@ -71,17 +71,14 @@ public class JavaFxAntGenerator {
|
||||
final SimpleTag createJarTag = new SimpleTag("fx:jar",
|
||||
new Pair<String, String>("destfile", tempDirPath + File.separator + artifactFileName));
|
||||
createJarTag.add(new SimpleTag("fx:application", new Pair<String, String>("refid", appId)));
|
||||
|
||||
final List<Pair> fileset2Jar = new ArrayList<Pair>();
|
||||
fileset2Jar.add(new Pair<String, String>("dir", tempDirPath));
|
||||
if (preloaderJar != null) {
|
||||
fileset2Jar.add(new Pair<String, String>("excludes", preloaderJar));
|
||||
}
|
||||
fileset2Jar.add(new Pair<String, String>("excludes", "*.jar"));
|
||||
createJarTag.add(new SimpleTag("fileset", fileset2Jar.toArray(new Pair[fileset2Jar.size()])));
|
||||
if (preloaderFiles != null) {
|
||||
final SimpleTag createJarResourcesTag = new SimpleTag("fx:resources");
|
||||
createJarResourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("refid", preloaderFiles)));
|
||||
createJarTag.add(createJarResourcesTag);
|
||||
}
|
||||
|
||||
createJarTag.add(createResourcesTag(tempDirPath, preloaderFiles, artifactFileName, preloaderJar, false));
|
||||
|
||||
topLevelTagsCollector.add(createJarTag);
|
||||
|
||||
//deploy task
|
||||
@@ -100,20 +97,33 @@ public class JavaFxAntGenerator {
|
||||
if (!infoPairs.isEmpty()) {
|
||||
deployTag.add(new SimpleTag("fx:info", infoPairs.toArray(new Pair[infoPairs.size()])));
|
||||
}
|
||||
|
||||
final SimpleTag deployResourcesTag = new SimpleTag("fx:resources");
|
||||
deployResourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("dir", tempDirPath),
|
||||
new Pair<String, String>("includes", artifactFileName)));
|
||||
if (preloaderFiles != null) {
|
||||
deployResourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("refid", preloaderFiles)));
|
||||
}
|
||||
|
||||
deployTag.add(deployResourcesTag);
|
||||
deployTag.add(createResourcesTag(tempDirPath, preloaderFiles, artifactFileName, preloaderJar, true));
|
||||
|
||||
topLevelTagsCollector.add(deployTag);
|
||||
return topLevelTagsCollector;
|
||||
}
|
||||
|
||||
private static SimpleTag createResourcesTag(String tempDirPath, String preloaderFiles,
|
||||
String artifactFileName,
|
||||
String preloaderJar,
|
||||
boolean includeSelf) {
|
||||
final SimpleTag resourcesTag = new SimpleTag("fx:resources");
|
||||
if (preloaderFiles != null) {
|
||||
resourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("refid", preloaderFiles)));
|
||||
}
|
||||
final File[] files = new File(tempDirPath).listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
final String fileName = file.getName();
|
||||
if (!fileName.equals(preloaderJar) && (includeSelf || !fileName.equals(artifactFileName))) {
|
||||
resourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("dir", tempDirPath), new Pair<String, String>("includes", fileName)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return resourcesTag;
|
||||
}
|
||||
|
||||
private static void appendIfNotEmpty(final List<Pair> pairs, final String propertyName, final String propValue) {
|
||||
if (!StringUtil.isEmptyOrSpaces(propValue)) {
|
||||
pairs.add(Pair.create(propertyName, propValue));
|
||||
|
||||
+11
-13
@@ -36,18 +36,18 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
public void testJarDeployNoInfo() throws Exception {
|
||||
doTest("<fx:application id=\"jarDeployNoInfo_id\" name=\"jarDeployNoInfo\" mainClass=\"Main\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:jar destfile=\"temp/jarDeployNoInfo.jar\">\n" +
|
||||
"<fx:jar destfile=\"temp\\jarDeployNoInfo.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeployNoInfo_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp/deploy\" outfile=\"jarDeployNoInfo\">\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp\\deploy\" outfile=\"jarDeployNoInfo\">\n" +
|
||||
"<fx:application refid=\"jarDeployNoInfo_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset dir=\"temp\" includes=\"jarDeployNoInfo.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:deploy>\n", Collections.<String, String>emptyMap());
|
||||
}
|
||||
@@ -58,8 +58,10 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"<fx:jar destfile=\"temp/jarDeployTitle.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeployTitle_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp/deploy\" outfile=\"jarDeployTitle\">\n" +
|
||||
"<fx:application refid=\"jarDeployTitle_id\">\n" +
|
||||
@@ -67,8 +69,6 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"<fx:info title=\"My App\">\n" +
|
||||
"</fx:info>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset dir=\"temp\" includes=\"jarDeployTitle.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:deploy>\n", Collections.singletonMap(TITLE, "My App"));
|
||||
}
|
||||
@@ -81,22 +81,20 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:application id=\"jarDeployPreloader_id\" name=\"jarDeployPreloader\" mainClass=\"Main\" preloaderClass=\"MyPreloader\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:jar destfile=\"temp/jarDeployPreloader.jar\">\n" +
|
||||
"<fx:jar destfile=\"temp\\jarDeployPreloader.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeployPreloader_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"preloader.jar\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"jarDeployPreloader_preloader_files\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp/deploy\" outfile=\"jarDeployPreloader\">\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp\\deploy\" outfile=\"jarDeployPreloader\">\n" +
|
||||
"<fx:application refid=\"jarDeployPreloader_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset dir=\"temp\" includes=\"jarDeployPreloader.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset refid=\"jarDeployPreloader_preloader_files\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
|
||||
Reference in New Issue
Block a user