mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx packaging: fix dependencies in manifest/jnlp files
This commit is contained in:
+27
-16
@@ -39,6 +39,8 @@ public class JavaFxAntGenerator {
|
||||
final String preloaderJar = packager.getPreloaderJar();
|
||||
final String preloaderClass = packager.getPreloaderClass();
|
||||
String preloaderFiles = null;
|
||||
String allButPreloader = null;
|
||||
|
||||
if (!StringUtil.isEmptyOrSpaces(preloaderJar) && !StringUtil.isEmptyOrSpaces(preloaderClass)) {
|
||||
preloaderFiles = artifactName + "_preloader_files";
|
||||
topLevelTagsCollector.add(new SimpleTag("fx:fileset",
|
||||
@@ -46,8 +48,24 @@ public class JavaFxAntGenerator {
|
||||
new Pair<String, String>("requiredFor", "preloader"),
|
||||
new Pair<String, String>("dir", tempDirPath),
|
||||
new Pair<String, String>("includes", preloaderJar)));
|
||||
|
||||
allButPreloader = "all_but_preloader_" + artifactName;
|
||||
topLevelTagsCollector.add(new SimpleTag("fx:fileset", new Pair<String, String>("id", allButPreloader),
|
||||
new Pair<String, String>("dir", tempDirPath),
|
||||
new Pair<String, String>("excludes", preloaderJar),
|
||||
new Pair<String, String>("includes", "*.jar")));
|
||||
}
|
||||
|
||||
final String allButSelf = "all_but_" + artifactName;
|
||||
final SimpleTag allButSelfAndPreloader = new SimpleTag("fx:fileset", new Pair<String, String>("id", allButSelf),
|
||||
new Pair<String, String>("dir", tempDirPath),
|
||||
new Pair<String, String>("includes", "*.jar"));
|
||||
allButSelfAndPreloader.add(new SimpleTag("exclude", new Pair<String, String>("name", artifactFileName)));
|
||||
if (preloaderJar != null) {
|
||||
allButSelfAndPreloader.add(new SimpleTag("exclude", new Pair<String, String>("name", preloaderJar)));
|
||||
}
|
||||
topLevelTagsCollector.add(allButSelfAndPreloader);
|
||||
|
||||
//register application
|
||||
final String appId = artifactName + "_id";
|
||||
Pair[] applicationParams = {
|
||||
@@ -83,7 +101,7 @@ public class JavaFxAntGenerator {
|
||||
fileset2Jar.add(new Pair<String, String>("excludes", "*.jar"));
|
||||
createJarTag.add(new SimpleTag("fileset", fileset2Jar.toArray(new Pair[fileset2Jar.size()])));
|
||||
|
||||
createJarTag.add(createResourcesTag(tempDirPath, preloaderFiles, artifactFileName, preloaderJar, false));
|
||||
createJarTag.add(createResourcesTag(preloaderFiles, false, allButPreloader, allButSelf));
|
||||
|
||||
topLevelTagsCollector.add(createJarTag);
|
||||
|
||||
@@ -103,29 +121,22 @@ public class JavaFxAntGenerator {
|
||||
if (!infoPairs.isEmpty()) {
|
||||
deployTag.add(new SimpleTag("fx:info", infoPairs.toArray(new Pair[infoPairs.size()])));
|
||||
}
|
||||
deployTag.add(createResourcesTag(tempDirPath, preloaderFiles, artifactFileName, preloaderJar, true));
|
||||
deployTag.add(createResourcesTag(preloaderFiles, true, allButPreloader, allButSelf));
|
||||
|
||||
topLevelTagsCollector.add(deployTag);
|
||||
return topLevelTagsCollector;
|
||||
}
|
||||
|
||||
private static SimpleTag createResourcesTag(String tempDirPath, String preloaderFiles,
|
||||
String artifactFileName,
|
||||
String preloaderJar,
|
||||
boolean includeSelf) {
|
||||
private static SimpleTag createResourcesTag(String preloaderFiles,
|
||||
boolean includeSelf,
|
||||
String allButPreloader,
|
||||
String allButSelf) {
|
||||
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)));
|
||||
}
|
||||
|
||||
}
|
||||
resourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("refid", includeSelf ? allButPreloader : allButSelf)));
|
||||
} else if (!includeSelf) {
|
||||
resourcesTag.add(new SimpleTag("fx:fileset", new Pair<String, String>("refid", allButSelf)));
|
||||
}
|
||||
return resourcesTag;
|
||||
}
|
||||
|
||||
+47
-17
@@ -34,26 +34,36 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
private static final String PRELOADER_JAR = "preloaderJar";
|
||||
|
||||
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:application refid=\"jarDeployNoInfo_id\">\n" +
|
||||
"</fx:application>\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:application refid=\"jarDeployNoInfo_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:deploy>\n", Collections.<String, String>emptyMap());
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployNoInfo\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<exclude name=\"jarDeployNoInfo.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:application id=\"jarDeployNoInfo_id\" name=\"jarDeployNoInfo\" mainClass=\"Main\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:jar destfile=\"temp/jarDeployNoInfo.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeployNoInfo_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeployNoInfo\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\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:resources>\n" +
|
||||
"</fx:deploy>\n", Collections.<String, String>emptyMap());
|
||||
}
|
||||
|
||||
public void testJarDeployTitle() throws Exception {
|
||||
doTest("<fx:application id=\"jarDeployTitle_id\" name=\"jarDeployTitle\" mainClass=\"Main\">\n" +
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployTitle\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<exclude name=\"jarDeployTitle.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:application id=\"jarDeployTitle_id\" name=\"jarDeployTitle\" mainClass=\"Main\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:jar destfile=\"temp/jarDeployTitle.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeployTitle_id\">\n" +
|
||||
@@ -61,6 +71,8 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeployTitle\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp/deploy\" outfile=\"jarDeployTitle\">\n" +
|
||||
@@ -78,6 +90,14 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
options.put(PRELOADER_CLASS, "MyPreloader");
|
||||
options.put(PRELOADER_JAR, "preloader.jar");
|
||||
doTest("<fx:fileset id=\"jarDeployPreloader_preloader_files\" requiredFor=\"preloader\" dir=\"temp\" includes=\"preloader.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset id=\"all_but_preloader_jarDeployPreloader\" dir=\"temp\" excludes=\"preloader.jar\" includes=\"*.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset id=\"all_but_jarDeployPreloader\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<exclude name=\"jarDeployPreloader.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"<exclude name=\"preloader.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:application id=\"jarDeployPreloader_id\" name=\"jarDeployPreloader\" mainClass=\"Main\" preloaderClass=\"MyPreloader\">\n" +
|
||||
"</fx:application>\n" +
|
||||
@@ -89,6 +109,8 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"jarDeployPreloader_preloader_files\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeployPreloader\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:jar>\n" +
|
||||
"<fx:deploy width=\"800\" height=\"400\" updatemode=\"background\" outdir=\"temp/deploy\" outfile=\"jarDeployPreloader\">\n" +
|
||||
@@ -97,6 +119,8 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"jarDeployPreloader_preloader_files\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset refid=\"all_but_preloader_jarDeployPreloader\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"</fx:resources>\n" +
|
||||
"</fx:deploy>\n", options);
|
||||
}
|
||||
@@ -143,6 +167,7 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
private String myParams;
|
||||
private String myPreloaderClass;
|
||||
private String myPreloaderJar;
|
||||
private boolean myConvertCss2Bin;
|
||||
|
||||
private MockJavaFxPackager(String outputPath) {
|
||||
myOutputPath = outputPath;
|
||||
@@ -279,5 +304,10 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
public String getPreloaderJar() {
|
||||
return myPreloaderJar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convertCss2Bin() {
|
||||
return myConvertCss2Bin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user