diff --git a/sdk/ant-jme/lib/CopyLibs-2/org-netbeans-modules-java-j2seproject-copylibstask.jar b/sdk/ant-jme/lib/CopyLibs-2/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 000000000..38246fd27 Binary files /dev/null and b/sdk/ant-jme/lib/CopyLibs-2/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/sdk/ant-jme/lib/nblibraries.properties b/sdk/ant-jme/lib/nblibraries.properties index 5819d0820..ee602518f 100644 --- a/sdk/ant-jme/lib/nblibraries.properties +++ b/sdk/ant-jme/lib/nblibraries.properties @@ -1,5 +1,6 @@ libs.ANT.classpath=\ ${base}/ANT/ant.jar libs.CopyLibs.classpath=\ - ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar + ${base}/CopyLibs-2/org-netbeans-modules-java-j2seproject-copylibstask.jar libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=1.0 diff --git a/sdk/ant-jme/nbproject/build-impl.xml b/sdk/ant-jme/nbproject/build-impl.xml index b92b08ad3..bd8965d6a 100644 --- a/sdk/ant-jme/nbproject/build-impl.xml +++ b/sdk/ant-jme/nbproject/build-impl.xml @@ -523,39 +523,66 @@ is divided into following sections: - + - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + - - + + @@ -588,7 +615,7 @@ is divided into following sections: - + @@ -599,22 +626,49 @@ is divided into following sections: - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -775,6 +829,9 @@ is divided into following sections: + + + @@ -1252,13 +1309,14 @@ is divided into following sections: TEST DEBUGGING SECTION ======================= --> - + Must select one file in the IDE or set test.class - + - + Must select one file in the IDE or set test.class - + Must select some method in the IDE or set test.method + diff --git a/sdk/ant-jme/nbproject/genfiles.properties b/sdk/ant-jme/nbproject/genfiles.properties index 4cc393bae..940a52acd 100644 --- a/sdk/ant-jme/nbproject/genfiles.properties +++ b/sdk/ant-jme/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=28e38971@1.38.2.45 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=dd1578ef -nbproject/build-impl.xml.script.CRC32=e46589cd -nbproject/build-impl.xml.stylesheet.CRC32=5183f3c0@1.51.1.46 +nbproject/build-impl.xml.script.CRC32=a6e22d49 +nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46 diff --git a/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java b/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java index 7c7b68053..24b7e55c7 100644 --- a/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java +++ b/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java @@ -40,6 +40,8 @@ public class FixWikiLinks extends Task { line = line.replaceAll("/wiki/lib/exe/fetch\\.php/([^>]*):([^>]*):([^>]*)\"", "nbdocs:/" + helpPath + "$1/$2/$3\""); line = line.replaceAll("/wiki/lib/exe/fetch\\.php/([^>]*):([^>]*)\"", "nbdocs:/" + helpPath + "$1/$2\""); line = line.replaceAll("/wiki/lib/exe/fetch\\.php/([^>]*)\"", "nbdocs:/" + helpPath + "$1\""); +// line = line.replaceAll("/wiki/lib/exe/fetch\\.php?([^>]*)\"", "nbdocs:/" + helpPath + "external/$1\"").replaceAll("[_[^\\w\\däüö:ÄÜÖ\\/\\+\\-\\. ]]", "_"); + line = line.replaceAll("]*)>]*)>", ""); line = line.replaceAll("]*)\\?([^>]*)\">", ""); // vvvv------v diff --git a/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java b/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java index 7bf28c4ef..d56556a9b 100644 --- a/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java +++ b/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java @@ -38,6 +38,8 @@ public class LoadWikiImages extends Task { if (endIdx >= 0) { String link = line.substring(idx + 10, endIdx); int wikidx = link.indexOf("/wiki/lib/exe/fetch.php/"); + //int extidx = link.indexOf("/wiki/lib/exe/fetch.php?"); + int extidx = -1; if (wikidx >= 0) { String name = link.replaceAll("/wiki/lib/exe/fetch\\.php/", ""); int markIdx = name.indexOf("?"); @@ -48,7 +50,30 @@ public class LoadWikiImages extends Task { URL url = new URL(host + link); InputStream in = url.openStream(); File file = new File(getLocation().getFileName().replaceAll("build.xml", "") + File.separator + targetFolder + File.separator + name.replaceAll("/", File.separator)); - log("Getting: " + host + link); + log("Getting image: " + host + link); + log("To: " + file); + File parent = file.getParentFile(); + parent.mkdirs(); + FileOutputStream out = new FileOutputStream(file); + int byte_ = in.read(); + while (byte_ != -1) { + out.write(byte_); + byte_ = in.read(); + } + in.close(); + out.close(); + }else if(extidx >= 0){ + String name = link.replaceAll("/wiki/lib/exe/fetch\\.php\\?([^>]*);media=([^>]*)\"", ""); + int markIdx = name.indexOf("?"); + if (markIdx >= 0) { + name = name.substring(0, markIdx); + } + //make external folder and clean filename + name = "external/" + name.replaceAll("[_[^\\w\\däüöÄÜÖ\\/\\+\\-\\. ]]", "_"); + URL url = new URL(host + link); + InputStream in = url.openStream(); + File file = new File(getLocation().getFileName().replaceAll("build.xml", "") + File.separator + targetFolder + File.separator + name.replaceAll("/", File.separator)); + log("Getting external image: " + host + link); log("To: " + file); File parent = file.getParentFile(); parent.mkdirs(); diff --git a/sdk/ant-jme/src/com/jme/ant/UpdateNetBeansDependencies.java b/sdk/ant-jme/src/com/jme/ant/UpdateNetBeansDependencies.java new file mode 100644 index 000000000..61370956e --- /dev/null +++ b/sdk/ant-jme/src/com/jme/ant/UpdateNetBeansDependencies.java @@ -0,0 +1,169 @@ +package com.jme.ant; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.HashMap; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.types.LogLevel; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +/** + * + * @author normenhansen + */ +public class UpdateNetBeansDependencies extends Task { + + File projectFile; + File platformFolder; + private HashMap versionMap = new HashMap(); + + @Override + public void execute() throws BuildException { + if (projectFile == null || platformFolder == null) { + throw new BuildException("Please set projectfile and version"); + } + clearVesionMap(); + gatherVersionMap(platformFolder); + try { + boolean change = false; + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(projectFile); + Element project = doc.getDocumentElement(); + if (project == null) { + return; + } + Element configuration = findChildElement(project, "configuration"); + if (configuration == null) { + return; + } + Element data = findChildElement(configuration, "data"); + if (data == null) { + return; + } + Element deps = findChildElement(data, "module-dependencies"); + if (deps == null) { + return; + } + NodeList list = deps.getElementsByTagName("dependency"); + for (int i = 0; i < list.getLength(); i++) { + Element elem = (Element) list.item(i); + Element base = findChildElement(elem, "code-name-base"); + if (base != null) { + Element runDep = findChildElement(elem, "run-dependency"); + if (runDep != null) { + Element specVersion = findChildElement(runDep, "specification-version"); + if (specVersion != null) { + String name = base.getTextContent().trim(); + String version = specVersion.getTextContent().trim(); + String newVersion = versionMap.get(name); + if (newVersion != null && !newVersion.equals(version)) { + specVersion.setTextContent(newVersion); + change = true; + log("Updating dependency in for " + name + " to " + newVersion); + } else { + log("Unknown " + name + ", cannot update dependency.", LogLevel.WARN.getLevel()); + } + } + } + } + } + if (change) { + TransformerFactory transformerFactory = TransformerFactory.newInstance(); + Transformer transformer = transformerFactory.newTransformer(); + DOMSource source = new DOMSource(doc); + StreamResult result = new StreamResult(projectFile); + transformer.transform(source, result); + OutputStreamWriter out = new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(projectFile, true))); + out.write("\n"); + out.close(); + } + } catch (Exception ex) { + throw new BuildException("Error changing file: " + ex); + } + } + + public void setProjectFile(File projectFile) { + this.projectFile = projectFile; + } + + public void setPlatformFolder(File platformFolder) { + this.platformFolder = platformFolder; + } + + private void clearVesionMap() { + versionMap.clear(); + } + + private void gatherVersionMap(File baseFolder) { + File[] packages = baseFolder.listFiles(); + for (File pkg : packages) { + if (pkg.isDirectory()) { + for (File utr : pkg.listFiles()) { + if (utr.isDirectory() && utr.getName().equals("update_tracking")) { + File[] xmls = utr.listFiles(); + for (File file : xmls) { + if (file.getName().toLowerCase().endsWith(".xml")) { + parseModules(file); + } + } + } + } + } + } + } + + private void parseModules(File file) { + try { + Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file); + if (doc == null) { + return; + } + Element moduleElement = doc.getDocumentElement(); + if (moduleElement == null || !moduleElement.getTagName().equalsIgnoreCase("module")) { + return; + } + Element versionElement = findChildElement(moduleElement, "module_version"); + if (versionElement == null) { + return; + } + String name = moduleElement.getAttribute("codename"); + int idx = name.indexOf("/"); + if (idx != -1) { + name = name.substring(0, idx); + } + String version = versionElement.getAttribute("specification_version"); + versionMap.put(name, version); + } catch (SAXException ex) { + Logger.getLogger(UpdateNetBeansDependencies.class.getName()).log(Level.SEVERE, null, ex); + } catch (IOException ex) { + Logger.getLogger(UpdateNetBeansDependencies.class.getName()).log(Level.SEVERE, null, ex); + } catch (ParserConfigurationException ex) { + Logger.getLogger(UpdateNetBeansDependencies.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private Element findChildElement(Element parent, String name) { + if (parent == null) { + return null; + } + org.w3c.dom.Node ret = parent.getFirstChild(); + while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name))) { + ret = ret.getNextSibling(); + } + return (Element) ret; + } +} diff --git a/sdk/ant-jme/src/com/jme/ant/ant-jme.properties b/sdk/ant-jme/src/com/jme/ant/ant-jme.properties index 2ba85ef73..84d25df1b 100644 --- a/sdk/ant-jme/src/com/jme/ant/ant-jme.properties +++ b/sdk/ant-jme/src/com/jme/ant/ant-jme.properties @@ -1,3 +1,4 @@ loadwikiimages=com.jme.ant.LoadWikiImages fixwikilinks=com.jme.ant.FixWikiLinks updatesdkdeps=com.jme.ant.UpdateSdkDependencies +updatenbdeps=com.jme.ant.UpdateNetBeansDependencies diff --git a/sdk/ant-lib/ant-jme.jar b/sdk/ant-lib/ant-jme.jar index 4539ecba1..27a4b87e1 100644 Binary files a/sdk/ant-lib/ant-jme.jar and b/sdk/ant-lib/ant-jme.jar differ