diff --git a/sdk/ant-jme/build.xml b/sdk/ant-jme/build.xml new file mode 100644 index 000000000..5acf8cbcc --- /dev/null +++ b/sdk/ant-jme/build.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + Builds, tests, and runs the project LoadImagesAntTask. + + + + + + diff --git a/sdk/ant-jme/nbproject/build-impl.xml b/sdk/ant-jme/nbproject/build-impl.xml new file mode 100644 index 000000000..883da6384 --- /dev/null +++ b/sdk/ant-jme/nbproject/build-impl.xml @@ -0,0 +1,1042 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + Must select one file in the IDE or set profile.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/ant-jme/nbproject/genfiles.properties b/sdk/ant-jme/nbproject/genfiles.properties new file mode 100644 index 000000000..011c70f79 --- /dev/null +++ b/sdk/ant-jme/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=7f939454 +build.xml.script.CRC32=9384ed68 +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=705df161 +nbproject/build-impl.xml.script.CRC32=817fd157 +nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45 diff --git a/sdk/ant-jme/nbproject/project.properties b/sdk/ant-jme/nbproject/project.properties new file mode 100644 index 000000000..071f29a17 --- /dev/null +++ b/sdk/ant-jme/nbproject/project.properties @@ -0,0 +1,72 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=ant-jme +application.vendor=normenhansen +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/ant-jme.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.ANT.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/sdk/ant-jme/nbproject/project.xml b/sdk/ant-jme/nbproject/project.xml new file mode 100644 index 000000000..f2234fb48 --- /dev/null +++ b/sdk/ant-jme/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + ant-jme + + + + + + + + + diff --git a/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java b/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java new file mode 100644 index 000000000..7c7b68053 --- /dev/null +++ b/sdk/ant-jme/src/com/jme/ant/FixWikiLinks.java @@ -0,0 +1,96 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.jme.ant; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.StringWriter; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * + * @author normenhansen + */ +public class FixWikiLinks extends Task { + + File file; + String helpPath; + + @Override + public void execute() throws BuildException { + validate(); + BufferedReader rdr; + try { + rdr = new BufferedReader(new FileReader(file)); + StringWriter out = new StringWriter(); + String line = rdr.readLine(); + while (line != null) { + //internal links + line = line.replaceAll("wiki/doku\\.php/([^>]*):([^>]*):([^>]*):([^>]*)\\?do=export_xhtmlbody", helpPath + "$1/$2/$3/$4.html"); + line = line.replaceAll("wiki/doku\\.php/([^>]*):([^>]*):([^>]*)\\?do=export_xhtmlbody", helpPath + "$1/$2/$3.html"); + line = line.replaceAll("wiki/doku\\.php/([^>]*):([^>]*)\\?do=export_xhtmlbody", helpPath + "$1/$2.html"); + line = line.replaceAll("wiki/doku\\.php/([^>]*)\\?do=export_xhtmlbody", helpPath + "$1.html"); + //images + line = line.replaceAll("/wiki/lib/exe/fetch\\.php/([^>]*):([^>]*):([^>]*):([^>]*)\"", "nbdocs:/" + helpPath + "$1/$2/$3/$4\""); + 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("]*)>]*)>", ""); + line = line.replaceAll("]*)\\?([^>]*)\">", ""); + // vvvv------v + //line=line.replaceAll("]*)>(.*(?))","$2"); + //remove class, name and id from tags + line = line.replaceAll(" class=\"([^>]*)\">", ">"); + line = line.replaceAll(" name=\"([^>]*)\">", ">"); + line = line.replaceAll(" id=\"([^>]*)\">", ">"); + //remove obnoxious spans using negative look-behind.. + line = line.replaceAll("([^>]*)", "$1"); + //remove links to http://www.google.com/search added by wiki + line = line.replaceAll("(.*)", "$3"); + //make external links netbeans help external links +// line = line.replaceAll("(.*)", "$3\">"); +// line = line.replaceAll("(.*)", "$3\">"); + line = line.replaceAll("([^<]*)", "$2\">"); + line = line.replaceAll("([^<]*)", "$2\">"); + //other stuff +// line = line.replaceAll("]*>([^>]*)", "

$2

"); + + out.write(line + "\n"); + line = rdr.readLine(); + } + rdr.close(); + FileWriter outWriter = new FileWriter(file); + out.flush(); + outWriter.write(out.toString()); + out.close(); + outWriter.close(); + } catch (Exception e) { + throw new BuildException(e, getLocation()); + } + } + + protected void validate() { + if (file == null) { + throw new BuildException("You must specify a file to read."); + } + if (!file.canRead()) { + throw new BuildException("Can not read file " + file.getAbsolutePath()); + } + if (helpPath == null) { + throw new BuildException("You must specify a help path."); + } + } + + public void setFile(File file) { + this.file = file; + } + + public void setHelpPath(String helpPath) { + this.helpPath = helpPath; + } +} diff --git a/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java b/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java new file mode 100644 index 000000000..7bf28c4ef --- /dev/null +++ b/sdk/ant-jme/src/com/jme/ant/LoadWikiImages.java @@ -0,0 +1,98 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.jme.ant; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.InputStream; +import java.net.URL; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * + * @author normenhansen + */ +public class LoadWikiImages extends Task { + + File file; + String targetFolder; + private String host; + + @Override + public void execute() throws BuildException { + validate(); + BufferedReader rdr; + try { + rdr = new BufferedReader(new FileReader(file)); + String line = rdr.readLine(); + while (line != null) { + line = line.trim(); + int idx = line.indexOf("= 0) { + String link = line.substring(idx + 10, endIdx); + int wikidx = link.indexOf("/wiki/lib/exe/fetch.php/"); + if (wikidx >= 0) { + String name = link.replaceAll("/wiki/lib/exe/fetch\\.php/", ""); + int markIdx = name.indexOf("?"); + if (markIdx >= 0) { + name = name.substring(0, markIdx); + } + name = name.replaceAll(":", "/"); + 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("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(); + } + } + idx = line.indexOf("