- locate project extensions globally in resources folder

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8752 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 8929f6a75a
commit 6a99037c80
  1. 32
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/ProjectExtensionManager.java
  2. 2
      sdk/jme3-desktop-executables/src/com/jme3/gde/desktop/executables/DesktopExeCompositeProvider.java
  3. 2
      sdk/jme3-desktop-executables/src/com/jme3/gde/desktop/executables/launch4j-targets.xml
  4. 6
      sdk/jme3-desktop-executables/src/com/jme3/gde/desktop/executables/macapp-targets.xml
  5. 2
      sdk/jme3-lwjgl-applet/src/com/jme3/gde/lwjgl/applet/LwjglAppletCompositeProvider.java
  6. 4
      sdk/jme3-lwjgl-applet/src/com/jme3/gde/lwjgl/applet/lwjgl-applet-targets.xml

@ -40,8 +40,6 @@ import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -72,6 +70,7 @@ public class ProjectExtensionManager {
private String[] extensionDependencies;
private String antTaskLibrary;
private URL zipFile;
private static final String resourcesFolder = "resources";
/**
* Allows extending ant based projects
@ -428,17 +427,23 @@ public class ProjectExtensionManager {
ZipInputStream str = new ZipInputStream(in);
ZipEntry entry;
while ((entry = str.getNextEntry()) != null) {
String fileName = resourcesFolder + "/" + extensionName + "/" + entry.getName();
if (entry.isDirectory()) {
//XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo == null) {
FileUtil.createFolder(projectRoot, entry.getName());
if (fo != null && entry.getSize() != -1 && entry.getSize() == fo.getSize()) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old folder " + fo.getNameExt());
fo.delete();
}
FileUtil.createFolder(projectRoot, fileName);
} else {
//XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo != null && !fo.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + fo.getNameExt());
fo.delete();
}
fo = FileUtil.createData(projectRoot, entry.getName());
fo = FileUtil.createData(projectRoot, fileName);
writeFile(str, fo);
}
}
@ -456,17 +461,32 @@ public class ProjectExtensionManager {
ZipInputStream str = new ZipInputStream(in);
ZipEntry entry;
while ((entry = str.getNextEntry()) != null) {
FileObject obj = projectRoot.getFileObject(entry.getName());
//XXX: deleting old (beta) files here
FileObject old = projectRoot.getFileObject(entry.getName());
if (old != null && !old.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + old.getNameExt());
if (entry.getSize() != -1 && entry.getSize() == old.getSize()) {
old.delete();
}
}
String fileName = resourcesFolder + "/" + extensionName + "/" + entry.getName();
FileObject obj = projectRoot.getFileObject(fileName);
if (obj != null && !obj.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt());
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) {
obj.delete();
} else{
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Keeping file " + obj.getNameExt());
}
}
}
} finally {
in.close();
}
FileObject folder = projectRoot.getFileObject(resourcesFolder + "/" + extensionName);
if (folder != null && folder.getChildren().length == 0) {
folder.delete();
}
}
private void writeFile(ZipInputStream str, FileObject fo) throws IOException {

@ -65,7 +65,7 @@ public class DesktopExeCompositeProvider implements ProjectCustomizer.CompositeC
launch4j = new ProjectExtensionManager("launch4j", "v1.2", new String[]{"jar", "-launch4j-exe"});
launch4j.setAntTaskLibrary("launch4j");
launch4j.setDataZip("nbres:/com/jme3/gde/desktop/executables/winapp-data.zip");
macapp = new ProjectExtensionManager("macapp", "v1.1", new String[]{"jar", "-mac-app"});
macapp = new ProjectExtensionManager("macapp", "v1.2", new String[]{"jar", "-mac-app"});
macapp.setDataZip("nbres:/com/jme3/gde/desktop/executables/macapp-data.zip");
linux = new ProjectExtensionManager("linuxlauncher", "v1.1", new String[]{"jar", "-linux-launcher"});
}

@ -2,7 +2,7 @@
<echo>Windows EXE Creation</echo>
<taskdef classname="net.sf.launch4j.ant.Launch4jTask" classpath="${libs.launch4j.classpath}" name="launch4j"/>
<launch4j>
<config jar="${dist.jar}" outfile="${dist.dir}/${application.title}.exe" errTitle="${application.title}" icon="win-icon.ico" headertype="gui" chdir="." customProcName="true">
<config jar="${dist.jar}" outfile="${dist.dir}/${application.title}.exe" errTitle="${application.title}" icon="resources/lanuch4j/win-icon.ico" headertype="gui" chdir="." customProcName="true">
<singleInstance mutexName="${main.class}"/>
<jre minVersion="1.5.0" maxheapsize="512"/>
</config>

@ -8,9 +8,9 @@
</filterchain>
</copy>
<zip destfile="${dist.dir}/${application.title}-MacOSX.zip">
<zipfileset file="osx-stub" filemode="755" fullpath="${application.title}.app/Contents/MacOS/JavaApplicationStub"/>
<zipfileset file="_Info.plist" fullpath="${application.title}.app/Contents/Info.plist"/>
<zipfileset file="osx-icon.icns" fullpath="${application.title}.app/Contents/Resources/GenericApp.icns"/>
<zipfileset file="resources/macapp/osx-stub" filemode="755" fullpath="${application.title}.app/Contents/MacOS/JavaApplicationStub"/>
<zipfileset file="resources/macapp/_Info.plist" fullpath="${application.title}.app/Contents/Info.plist"/>
<zipfileset file="resources/macapp/osx-icon.icns" fullpath="${application.title}.app/Contents/Resources/GenericApp.icns"/>
<zipfileset file="${dist.jar}" prefix="${application.title}.app/Contents/Resources/Java"/>
<zipfileset dir="${dist.dir}/lib" prefix="${application.title}.app/Contents/Resources/Java/lib"/>
</zip>

@ -62,7 +62,7 @@ public class LwjglAppletCompositeProvider implements ProjectCustomizer.Composite
private class SavePropsListener implements ActionListener {
private String extensionName = "lwjglapplet";
private String extensionVersion = "v0.97";
private String extensionVersion = "v0.98";
private String[] extensionDependencies = new String[]{"jar", "-lwjgl-applet"};
private ProjectExtensionManager manager = new ProjectExtensionManager(extensionName, extensionVersion, extensionDependencies);
private ProjectExtensionProperties properties;

@ -17,7 +17,7 @@
<unzip src="${libs.appletloader}" dest="${applet.dir}"/>
<move file="${applet.dir}/applet-template.html" tofile="${applet.dir}/run-applet.html"/>
<move file="${assets.jar.resolved}" tofile="${applet.dir}/data.jar"/>
<copy file="appletlogo.png" todir="${applet.dir}"/>
<copy file="resources/lwjglapplet/appletlogo.png" todir="${applet.dir}"/>
<!-- if using many small jars -->
<!--
@ -45,7 +45,7 @@
<zipgroupfileset file="${dist.jar}"/>
</jar>
<property name="applet.classpath" value="code.jar, data.jar, lwjgl.jar.pack.lzma"/>
<property name="applet.logo" value="appletlogo.png"/>
<!--property name="applet.logo" value="appletlogo.png"/-->
<antcall target="-lwjgl-applet-packlogo"/>

Loading…
Cancel
Save