- add ant-jme project with ant tools git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9423 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
6c08d94d5a
commit
7ee15bf908
@ -0,0 +1,77 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- You may freely edit this file. See commented blocks below for --> |
||||
<!-- some examples of how to customize the build. --> |
||||
<!-- (If you delete it and reopen the project it will be recreated.) --> |
||||
<!-- By default, only the Clean and Build commands use this build script. --> |
||||
<!-- Commands such as Run, Debug, and Test only use this build script if --> |
||||
<!-- the Compile on Save feature is turned off for the project. --> |
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> |
||||
<!-- in the project's Project Properties dialog box.--> |
||||
<project name="LoadImagesAntTask" default="default" basedir="."> |
||||
<description>Builds, tests, and runs the project LoadImagesAntTask.</description> |
||||
<import file="nbproject/build-impl.xml"/> |
||||
<target name="-post-jar"> |
||||
<copy file="${dist.jar}" todir="../ant-lib" overwrite="true"/> |
||||
</target> |
||||
<!-- |
||||
|
||||
There exist several targets which are by default empty and which can be |
||||
used for execution of your tasks. These targets are usually executed |
||||
before and after some main targets. They are: |
||||
|
||||
-pre-init: called before initialization of project properties |
||||
-post-init: called after initialization of project properties |
||||
-pre-compile: called before javac compilation |
||||
-post-compile: called after javac compilation |
||||
-pre-compile-single: called before javac compilation of single file |
||||
-post-compile-single: called after javac compilation of single file |
||||
-pre-compile-test: called before javac compilation of JUnit tests |
||||
-post-compile-test: called after javac compilation of JUnit tests |
||||
-pre-compile-test-single: called before javac compilation of single JUnit test |
||||
-post-compile-test-single: called after javac compilation of single JUunit test |
||||
-pre-jar: called before JAR building |
||||
-post-jar: called after JAR building |
||||
-post-clean: called after cleaning build products |
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.) |
||||
|
||||
Example of inserting an obfuscator after compilation could look like this: |
||||
|
||||
<target name="-post-compile"> |
||||
<obfuscate> |
||||
<fileset dir="${build.classes.dir}"/> |
||||
</obfuscate> |
||||
</target> |
||||
|
||||
For list of available properties check the imported |
||||
nbproject/build-impl.xml file. |
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets. |
||||
The targets of interest are: |
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation |
||||
-init-macrodef-junit: defines macro for junit execution |
||||
-init-macrodef-debug: defines macro for class debugging |
||||
-init-macrodef-java: defines macro for class execution |
||||
-do-jar-with-manifest: JAR building (if you are using a manifest) |
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest) |
||||
run: execution of project |
||||
-javadoc-build: Javadoc generation |
||||
test-report: JUnit report generation |
||||
|
||||
An example of overriding the target for project execution could look like this: |
||||
|
||||
<target name="run" depends="LoadImagesAntTask-impl.jar"> |
||||
<exec dir="bin" executable="launcher.exe"> |
||||
<arg file="${dist.jar}"/> |
||||
</exec> |
||||
</target> |
||||
|
||||
Notice that the overridden target depends on the jar target and not only on |
||||
the compile target as the regular run target does. Again, for a list of available |
||||
properties which you can use, check the target you are overriding in the |
||||
nbproject/build-impl.xml file. |
||||
|
||||
--> |
||||
</project> |
File diff suppressed because it is too large
Load Diff
@ -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 |
@ -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 |
@ -0,0 +1,15 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://www.netbeans.org/ns/project/1"> |
||||
<type>org.netbeans.modules.java.j2seproject</type> |
||||
<configuration> |
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> |
||||
<name>ant-jme</name> |
||||
<source-roots> |
||||
<root id="src.dir"/> |
||||
</source-roots> |
||||
<test-roots> |
||||
<root id="test.src.dir"/> |
||||
</test-roots> |
||||
</data> |
||||
</configuration> |
||||
</project> |
@ -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("<a href=([^>]*)><img src=\"([^\"]*)\"([^>]*)></a>", "<img src=\"$2\">"); |
||||
line = line.replaceAll("<img src=\"([^>]*)\\?([^>]*)\">", "<img src=\"$1\">"); |
||||
// vvvv------v
|
||||
//line=line.replaceAll("<span([^>]*)>(.*(?<!/span>))</span>","$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("<span>([^>]*)</span>", "$1"); |
||||
//remove links to http://www.google.com/search added by wiki
|
||||
line = line.replaceAll("<a href=\"http://www\\.google\\.com/search([^\"]*)\"(.*)>(.*)</a>", "$3"); |
||||
//make external links netbeans help external links
|
||||
// line = line.replaceAll("<a href=\"http://([^\"]*)\"(.*)>(.*)</a>", "<object classid=\"java:org.netbeans.modules.javahelp.BrowserDisplayer\"><param name=\"content\" value=\"http://$1\"><param name=\"text\" value=\"<html><u>$3</u></html>\"><param name=\"textColor\" value=\"blue\"></object>");
|
||||
// line = line.replaceAll("<a href=\"https://([^\"]*)\"(.*)>(.*)</a>", "<object classid=\"java:org.netbeans.modules.javahelp.BrowserDisplayer\"><param name=\"content\" value=\"https://$1\"><param name=\"text\" value=\"<html><u>$3</u></html>\"><param name=\"textColor\" value=\"blue\"></object>");
|
||||
line = line.replaceAll("<a href=\"http://([^\"]*)\">([^<]*)</a>", "<object classid=\"java:org.netbeans.modules.javahelp.BrowserDisplayer\"><param name=\"content\" value=\"http://$1\"><param name=\"text\" value=\"<html><u>$2</u></html>\"><param name=\"textColor\" value=\"blue\"></object>"); |
||||
line = line.replaceAll("<a href=\"https://([^\"]*)\">([^<]*)</a>", "<object classid=\"java:org.netbeans.modules.javahelp.BrowserDisplayer\"><param name=\"content\" value=\"https://$1\"><param name=\"text\" value=\"<html><u>$2</u></html>\"><param name=\"textColor\" value=\"blue\"></object>"); |
||||
//other stuff
|
||||
// line = line.replaceAll("<note [^>]*>([^>]*)</note>", "<p>$2</p>");
|
||||
|
||||
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; |
||||
} |
||||
} |
@ -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("<img src="); |
||||
while (idx >= 0) { |
||||
int endIdx = line.indexOf("\"", idx + 10); |
||||
if (endIdx >= 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("<img src=", idx + 1); |
||||
} |
||||
line = rdr.readLine(); |
||||
} |
||||
rdr.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 (targetFolder == null) { |
||||
throw new BuildException("You must specify a destination folder."); |
||||
} |
||||
} |
||||
|
||||
public void setFile(File file) { |
||||
this.file = file; |
||||
} |
||||
|
||||
public void setTarget(String targetFolder) { |
||||
this.targetFolder = targetFolder; |
||||
} |
||||
|
||||
public void setHost(String host) { |
||||
this.host = host; |
||||
} |
||||
} |
@ -0,0 +1,108 @@ |
||||
package com.jme.ant; |
||||
|
||||
import java.io.BufferedOutputStream; |
||||
import java.io.File; |
||||
import java.io.FileOutputStream; |
||||
import java.io.OutputStreamWriter; |
||||
import javax.xml.parsers.DocumentBuilderFactory; |
||||
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.w3c.dom.Document; |
||||
import org.w3c.dom.Element; |
||||
import org.w3c.dom.NodeList; |
||||
|
||||
/** |
||||
* |
||||
* @author normenhansen |
||||
*/ |
||||
public class UpdateSdkDependencies extends Task { |
||||
|
||||
File projectFile; |
||||
String version; |
||||
String basePackage = "com.jme3.gde"; |
||||
|
||||
@Override |
||||
public void execute() throws BuildException { |
||||
if (projectFile == null || version == null) { |
||||
throw new BuildException("Please set projectfile and version"); |
||||
} |
||||
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) { |
||||
if (base.getTextContent().trim().startsWith(basePackage)) { |
||||
Element runDep = findChildElement(elem, "run-dependency"); |
||||
if (runDep != null) { |
||||
Element specVersion = findChildElement(runDep, "specification-version"); |
||||
if (specVersion != null && !version.equals(specVersion.getTextContent().trim())) { |
||||
specVersion.setTextContent(version); |
||||
log("Updating plugin dependency in " + projectFile); |
||||
change = true; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
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 setBasePackage(String basePackage) { |
||||
this.basePackage = basePackage; |
||||
} |
||||
|
||||
public void setProjectFile(File projectFile) { |
||||
this.projectFile = projectFile; |
||||
} |
||||
|
||||
public void setVersion(String version) { |
||||
this.version = version; |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,3 @@ |
||||
loadwikiimages=com.jme.ant.LoadWikiImages |
||||
fixwikilinks=com.jme.ant.FixWikiLinks |
||||
updatesdkdeps=com.jme.ant.UpdateSdkDependencies |
Loading…
Reference in new issue