mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx packaging: deep copy
This commit is contained in:
+12
-6
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.Base64Converter;
|
||||
import com.intellij.util.PathUtilRt;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
@@ -38,6 +39,7 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class AbstractJavaFxPackager {
|
||||
private static final Logger LOG = Logger.getInstance("#" + AbstractJavaFxPackager.class.getName());
|
||||
private static final String JB_JFX_JKS = "jb-jfx.jks";
|
||||
|
||||
//artifact description
|
||||
protected String getArtifactRootName() {
|
||||
@@ -84,7 +86,7 @@ public abstract class AbstractJavaFxPackager {
|
||||
tempUnzippedArtifactOutput = FileUtil.createTempDirectory("artifact", "unzipped");
|
||||
final File artifactOutputFile = new File(zipPath);
|
||||
ZipUtil.extract(artifactOutputFile, tempUnzippedArtifactOutput, null);
|
||||
copyLibraries(artifactOutputFile.getName(), tempUnzippedArtifactOutput);
|
||||
copyLibraries(FileUtil.getNameWithoutExtension(artifactOutputFile), tempUnzippedArtifactOutput);
|
||||
}
|
||||
catch (IOException e) {
|
||||
registerJavaFxPackagerError(e);
|
||||
@@ -128,11 +130,15 @@ public abstract class AbstractJavaFxPackager {
|
||||
private void copyLibraries(String zipPath, File tempUnzippedArtifactOutput) throws IOException {
|
||||
final File[] outFiles = new File(getArtifactOutputPath()).listFiles();
|
||||
if (outFiles != null) {
|
||||
final String[] generatedItems = new String[] {JB_JFX_JKS, zipPath + ".jar", zipPath + ".jnlp", zipPath + ".html"};
|
||||
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));
|
||||
final String fileName = file.getName();
|
||||
if (ArrayUtilRt.find(generatedItems, fileName) < 0) {
|
||||
final File destination = new File(tempUnzippedArtifactOutput, fileName);
|
||||
if (file.isFile()) {
|
||||
FileUtil.copy(file, destination);
|
||||
} else {
|
||||
FileUtil.copyDir(file, destination, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,7 +326,7 @@ public abstract class AbstractJavaFxPackager {
|
||||
}
|
||||
|
||||
private String getKeystore(boolean selfSigning) {
|
||||
return selfSigning ? getArtifactOutputPath() + File.separator + "jb-jfx.jks" : getKeystore();
|
||||
return selfSigning ? getArtifactOutputPath() + File.separator + JB_JFX_JKS : getKeystore();
|
||||
}
|
||||
|
||||
private String getStorepass(boolean selfSigning) {
|
||||
|
||||
+4
-4
@@ -53,13 +53,13 @@ public class JavaFxAntGenerator {
|
||||
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")));
|
||||
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"));
|
||||
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)));
|
||||
@@ -69,7 +69,7 @@ public class JavaFxAntGenerator {
|
||||
final String all = "all_" + artifactName;
|
||||
final SimpleTag allIncluded = new SimpleTag("fx:fileset", new Pair<String, String>("id", all),
|
||||
new Pair<String, String>("dir", tempDirPath),
|
||||
new Pair<String, String>("includes", "*.jar"));
|
||||
new Pair<String, String>("includes", "**/*.jar"));
|
||||
topLevelTagsCollector.add(allIncluded);
|
||||
|
||||
//register application
|
||||
@@ -100,7 +100,7 @@ public class JavaFxAntGenerator {
|
||||
|
||||
final List<Pair> fileset2Jar = new ArrayList<Pair>();
|
||||
fileset2Jar.add(new Pair<String, String>("dir", tempDirPath));
|
||||
fileset2Jar.add(new Pair<String, String>("excludes", "*.jar"));
|
||||
fileset2Jar.add(new Pair<String, String>("excludes", "**/*.jar"));
|
||||
createJarTag.add(new SimpleTag("fileset", fileset2Jar.toArray(new Pair[fileset2Jar.size()])));
|
||||
|
||||
createJarTag.add(createResourcesTag(preloaderFiles, false, allButPreloader, allButSelf, all));
|
||||
|
||||
+13
-13
@@ -35,18 +35,18 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
private static final String SIGNED = "signed";
|
||||
|
||||
public void testJarDeployNoInfo() throws Exception {
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployNoInfo\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployNoInfo\" dir=\"temp\" includes=\"**/*.jar\">\n" +
|
||||
"<exclude name=\"jarDeployNoInfo.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset id=\"all_jarDeployNoInfo\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<fx:fileset id=\"all_jarDeployNoInfo\" dir=\"temp\" includes=\"**/*.jar\">\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 dir=\"temp\" excludes=\"**/*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeployNoInfo\">\n" +
|
||||
@@ -64,18 +64,18 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
}
|
||||
|
||||
public void testJarDeployTitle() throws Exception {
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployTitle\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
doTest("<fx:fileset id=\"all_but_jarDeployTitle\" dir=\"temp\" includes=\"**/*.jar\">\n" +
|
||||
"<exclude name=\"jarDeployTitle.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset id=\"all_jarDeployTitle\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<fx:fileset id=\"all_jarDeployTitle\" dir=\"temp\" includes=\"**/*.jar\">\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" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"**/*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeployTitle\">\n" +
|
||||
@@ -95,18 +95,18 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
}
|
||||
|
||||
public void testJarDeploySigned() throws Exception {
|
||||
doTest("<fx:fileset id=\"all_but_jarDeploySigned\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
doTest("<fx:fileset id=\"all_but_jarDeploySigned\" dir=\"temp\" includes=\"**/*.jar\">\n" +
|
||||
"<exclude name=\"jarDeploySigned.jar\">\n" +
|
||||
"</exclude>\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:fileset id=\"all_jarDeploySigned\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<fx:fileset id=\"all_jarDeploySigned\" dir=\"temp\" includes=\"**/*.jar\">\n" +
|
||||
"</fx:fileset>\n" +
|
||||
"<fx:application id=\"jarDeploySigned_id\" name=\"jarDeploySigned\" mainClass=\"Main\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fx:jar destfile=\"temp" + File.separator + "jarDeploySigned.jar\">\n" +
|
||||
"<fx:application refid=\"jarDeploySigned_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"**/*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"all_but_jarDeploySigned\">\n" +
|
||||
@@ -131,22 +131,22 @@ public class JavaFxAntTaskTest extends UsefulTestCase{
|
||||
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 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" +
|
||||
"<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:fileset id=\"all_jarDeployPreloader\" dir=\"temp\" includes=\"*.jar\">\n" +
|
||||
"<fx:fileset id=\"all_jarDeployPreloader\" dir=\"temp\" includes=\"**/*.jar\">\n" +
|
||||
"</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:application refid=\"jarDeployPreloader_id\">\n" +
|
||||
"</fx:application>\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"*.jar\">\n" +
|
||||
"<fileset dir=\"temp\" excludes=\"**/*.jar\">\n" +
|
||||
"</fileset>\n" +
|
||||
"<fx:resources>\n" +
|
||||
"<fx:fileset refid=\"jarDeployPreloader_preloader_files\">\n" +
|
||||
|
||||
Reference in New Issue
Block a user