Include docs for both bukkit and canary event helpers.
This commit is contained in:
parent
55b07fd4a6
commit
3ec582f653
5 changed files with 1625 additions and 174 deletions
36
build.xml
36
build.xml
|
@ -11,7 +11,8 @@
|
||||||
|
|
||||||
<!-- compiles against these libraries -->
|
<!-- compiles against these libraries -->
|
||||||
<property name="lib.canary" location="lib/CanaryMod-1.7.10-1.1.3-SNAPSHOT-shaded.jar"/>
|
<property name="lib.canary" location="lib/CanaryMod-1.7.10-1.1.3-SNAPSHOT-shaded.jar"/>
|
||||||
<property name="lib.bukkit" location="lib/bukkit-1.7.9-R0.2.jar"/>
|
<!-- property name="lib.bukkit" location="lib/bukkit-1.7.9-R0.2.jar"/ -->
|
||||||
|
<property name="lib.bukkit" location="lib/bukkit-1.7.10-R0.1-SNAPSHOT.jar"/>
|
||||||
|
|
||||||
<property name="build" location="target/classes"/>
|
<property name="build" location="target/classes"/>
|
||||||
<property name="dist" location="target/" />
|
<property name="dist" location="target/" />
|
||||||
|
@ -29,6 +30,7 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<pathelement path="${build}"/>
|
<pathelement path="${build}"/>
|
||||||
<pathelement path="${lib.canary}"/>
|
<pathelement path="${lib.canary}"/>
|
||||||
|
<pathelement path="${lib.bukkit}"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
<arg value="@{src}"/>
|
<arg value="@{src}"/>
|
||||||
<js-args/>
|
<js-args/>
|
||||||
|
@ -82,10 +84,14 @@
|
||||||
|
|
||||||
<target name="generate-api-ref-entries" depends="copy-js,compile-docs,init">
|
<target name="generate-api-ref-entries" depends="copy-js,compile-docs,init">
|
||||||
|
|
||||||
<jscript src="src/docs/js/generateApiDocs.js" out="${dist}/apiref.md" err="${dist}/gen-api-error.log">
|
<jscript src="src/docs/js/generateApiDocs.js"
|
||||||
|
out="${dist}/apiref.md"
|
||||||
|
err="${dist}/gen-api-error.log">
|
||||||
<arg value="${dist}/js"/>
|
<arg value="${dist}/js"/>
|
||||||
</jscript>
|
</jscript>
|
||||||
<jscript src="src/docs/js/generateItemsDoc.js" out="${dist}/items.md" err="${dist}/gen-items-error.log" />
|
<jscript src="src/docs/js/generateItemsDoc.js"
|
||||||
|
out="${dist}/items.md"
|
||||||
|
err="${dist}/gen-items-error.log" />
|
||||||
<concat destfile="${dist}/apiref-con.md">
|
<concat destfile="${dist}/apiref-con.md">
|
||||||
<fileset file="${dist}/apiref.md" />
|
<fileset file="${dist}/apiref.md" />
|
||||||
<fileset file="${dist}/items.md" />
|
<fileset file="${dist}/items.md" />
|
||||||
|
@ -93,11 +99,11 @@
|
||||||
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<target name="gen-events-helper-canary" depends="compile-docs,init">
|
<target name="gen-events-helper-canary" depends="compile-docs,init">
|
||||||
<mkdir dir="${dist}/js/lib"/>
|
<mkdir dir="${dist}/js/lib"/>
|
||||||
<jscript src="src/docs/js/generateEventsHelper.js" out="${dist}/js/lib/events-helper.js" err="${dist}/gen-events-canary-error.log">
|
<jscript src="src/docs/js/generateEventsHelper.js"
|
||||||
|
out="${dist}/js/lib/events-helper-canary.js"
|
||||||
|
err="${dist}/gen-events-canary-error.log">
|
||||||
<arg value="canary"/>
|
<arg value="canary"/>
|
||||||
<arg value="${lib.canary}"/>
|
<arg value="${lib.canary}"/>
|
||||||
<arg value="blockDestroy"/>
|
<arg value="blockDestroy"/>
|
||||||
|
@ -107,10 +113,12 @@
|
||||||
|
|
||||||
<target name="gen-events-helper-bukkit" depends="compile-docs,init">
|
<target name="gen-events-helper-bukkit" depends="compile-docs,init">
|
||||||
<mkdir dir="${dist}/js/lib"/>
|
<mkdir dir="${dist}/js/lib"/>
|
||||||
<jscript src="src/docs/js/generateEventsHelper.js" out="${dist}/js/lib/events-helper.js" err="${dist}/gen-events-bukkit-error.log">
|
<jscript src="src/docs/js/generateEventsHelper.js"
|
||||||
|
out="${dist}/js/lib/events-helper-bukkit.js"
|
||||||
|
err="${dist}/gen-events-bukkit-error.log">
|
||||||
<arg value="bukkit"/>
|
<arg value="bukkit"/>
|
||||||
<arg value="${lib.canary}"/>
|
<arg value="${lib.bukkit}"/>
|
||||||
<arg value="Break"/>
|
<arg value="blockBreak"/>
|
||||||
<arg value="org.bukkit.event.block.BlockBreakEvent"/>
|
<arg value="org.bukkit.event.block.BlockBreakEvent"/>
|
||||||
</jscript>
|
</jscript>
|
||||||
</target>
|
</target>
|
||||||
|
@ -133,13 +141,17 @@ Walter Higgins
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="gen-toc-apiref" depends="compile-docs,generate-api-ref-entries, init" description="Generate Table of Contents for API Reference">
|
<target name="gen-toc-apiref" depends="compile-docs,generate-api-ref-entries, init" description="Generate Table of Contents for API Reference">
|
||||||
<jscript src="src/docs/js/generateTOC.js" out="${dist}/toc-apiref.md" err="${dist}/gen-toc-error.log">
|
<jscript src="src/docs/js/generateTOC.js"
|
||||||
|
out="${dist}/toc-apiref.md"
|
||||||
|
err="${dist}/gen-toc-error.log">
|
||||||
<arg value="${dist}/apiref-con.md"/>
|
<arg value="${dist}/apiref-con.md"/>
|
||||||
</jscript>
|
</jscript>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="gen-toc-ypgpm" depends="compile-docs,init" description="Generate Table of Contents for Young Programmers Guide">
|
<target name="gen-toc-ypgpm" depends="compile-docs,init" description="Generate Table of Contents for Young Programmers Guide">
|
||||||
<jscript src="src/docs/js/generateTOC.js" out="${dist}/toc-ypgpm.md" err="${dist}/gen-ypgpm-error.log">
|
<jscript src="src/docs/js/generateTOC.js"
|
||||||
|
out="${dist}/toc-ypgpm.md"
|
||||||
|
err="${dist}/gen-ypgpm-error.log">
|
||||||
<arg value="src/docs/templates/ypgpm.md"/>
|
<arg value="src/docs/templates/ypgpm.md"/>
|
||||||
</jscript>
|
</jscript>
|
||||||
</target>
|
</target>
|
||||||
|
@ -157,7 +169,7 @@ Walter Higgins
|
||||||
<target name="zip_js" depends="zip_lib, zip_modules, zip_plugins">
|
<target name="zip_js" depends="zip_lib, zip_modules, zip_plugins">
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="copy-js" depends="gen-events-helper-canary,init">
|
<target name="copy-js" depends="gen-events-helper-canary,gen-events-helper-bukkit,init">
|
||||||
<copy todir="${dist}/js">
|
<copy todir="${dist}/js">
|
||||||
<fileset dir="src/main/js"/>
|
<fileset dir="src/main/js"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
@ -12,7 +12,7 @@ var File = java.io.File,
|
||||||
entry = null;
|
entry = null;
|
||||||
var content = [
|
var content = [
|
||||||
'/*********************',
|
'/*********************',
|
||||||
'## Events Helper Module',
|
'## Events Helper Module (' + args[0] + ' version)',
|
||||||
'The Events helper module provides a suite of functions - one for each possible event.',
|
'The Events helper module provides a suite of functions - one for each possible event.',
|
||||||
'For example, the events.' + args[2] + '() function is just a wrapper function which calls events.on(' + args[3] + ', callback, priority)',
|
'For example, the events.' + args[2] + '() function is just a wrapper function which calls events.on(' + args[3] + ', callback, priority)',
|
||||||
'This module is a convenience wrapper for easily adding new event handling functions in Javascript. ',
|
'This module is a convenience wrapper for easily adding new event handling functions in Javascript. ',
|
||||||
|
@ -29,13 +29,18 @@ var content = [
|
||||||
'',
|
'',
|
||||||
'***/'
|
'***/'
|
||||||
];
|
];
|
||||||
|
var canary = false;
|
||||||
|
if (args[0] == 'canary'){
|
||||||
|
canary = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i< content.length; i++){
|
for (var i = 0; i< content.length; i++){
|
||||||
out.println(content[i]);
|
out.println(content[i]);
|
||||||
}
|
}
|
||||||
while ( ( entry = zis.nextEntry) != null) {
|
while ( ( entry = zis.nextEntry) != null) {
|
||||||
var name = new String( entry.name );
|
var name = new String( entry.name );
|
||||||
var re1 = /org\/bukkit\/event\/.+Event\.class$/;
|
var re1 = /org\/bukkit\/event\/.+Event\.class$/;
|
||||||
if (args[0] == 'canary'){
|
if (canary){
|
||||||
re1 = /net\/canarymod\/hook\/.+Hook\.class$/;
|
re1 = /net\/canarymod\/hook\/.+Hook\.class$/;
|
||||||
}
|
}
|
||||||
if ( re1.test(name) ) {
|
if ( re1.test(name) ) {
|
||||||
|
@ -43,6 +48,7 @@ while ( ( entry = zis.nextEntry) != null) {
|
||||||
try {
|
try {
|
||||||
clz = java.lang.Class.forName(name);
|
clz = java.lang.Class.forName(name);
|
||||||
}catch ( e) {
|
}catch ( e) {
|
||||||
|
err.println('Warning: could not Class.forName("' + name + '")');
|
||||||
clz = engine.eval(name);
|
clz = engine.eval(name);
|
||||||
}
|
}
|
||||||
var isAbstract = Modifier.isAbstract(clz.getModifiers());
|
var isAbstract = Modifier.isAbstract(clz.getModifiers());
|
||||||
|
@ -51,28 +57,28 @@ while ( ( entry = zis.nextEntry) != null) {
|
||||||
}
|
}
|
||||||
var parts = name.split('.');
|
var parts = name.split('.');
|
||||||
var shortName = null;
|
var shortName = null;
|
||||||
if (args[0] == 'canary'){
|
if (canary){
|
||||||
shortName = name.replace('net.canarymod.hook.','');
|
shortName = name.replace('net.canarymod.hook.','');
|
||||||
}
|
}
|
||||||
if (args[0] == 'bukkit'){
|
if (!canary){
|
||||||
shortName = name.replace('org.bukkit.event.','');
|
shortName = name.replace('org.bukkit.event.','');
|
||||||
}
|
}
|
||||||
var fname = parts.reverse().shift().replace(/^(.)/,function(a){
|
var fname = parts.reverse().shift().replace(/^(.)/,function(a){
|
||||||
return a.toLowerCase();});
|
return a.toLowerCase();});
|
||||||
if (args[0] == 'bukkit'){
|
if (!canary){
|
||||||
fname = fname.replace(/Event$/,'');
|
fname = fname.replace(/Event$/,'');
|
||||||
}
|
}
|
||||||
if (args[0] == 'canary'){
|
if (canary){
|
||||||
fname = fname.replace(/Hook$/,'');
|
fname = fname.replace(/Hook$/,'');
|
||||||
}
|
}
|
||||||
|
var javaDoc = canary ? 'https://ci.visualillusionsent.net/job/CanaryLib/javadoc/net/canarymod/hook/' : 'http://jd.bukkit.org/rb/apidocs/org/bukkit/event/';
|
||||||
var comment = [
|
var comment = [
|
||||||
'/*********************',
|
'/*********************',
|
||||||
'### events.' + fname + '()',
|
'### events.' + fname + '()',
|
||||||
'',
|
'',
|
||||||
'#### Parameters ',
|
'#### Parameters ',
|
||||||
'',
|
'',
|
||||||
' * callback - A function which is called whenever the ['+ shortName + ' event](http://jd.bukkit.org/rb/apidocs/org/bukkit/event/' + shortName.replace('.','/') + '.html) is fired',
|
' * callback - A function which is called whenever the ['+ shortName + ' event](' + javaDoc + shortName.replace('.','/') + '.html) is fired',
|
||||||
'',
|
'',
|
||||||
' * priority - optional - see events.on() for more information.',
|
' * priority - optional - see events.on() for more information.',
|
||||||
'',
|
'',
|
||||||
|
|
|
@ -64,13 +64,14 @@ myBlockBreakListener.unregister();
|
||||||
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
[buk]: http://jd.bukkit.org/dev/apidocs/index.html?org/bukkit/event/Event.html
|
||||||
|
|
||||||
***/
|
***/
|
||||||
|
var helper;
|
||||||
if (__plugin.canary){
|
if (__plugin.canary){
|
||||||
module.exports = require('events-canary');
|
module.exports = require('events-canary');
|
||||||
|
helper = require('events-helper-canary');
|
||||||
} else {
|
} else {
|
||||||
module.exports = require('events-bukkit');
|
module.exports = require('events-bukkit');
|
||||||
|
helper = require('events-helper-bukkit');
|
||||||
}
|
}
|
||||||
var helper = require('events-helper');
|
|
||||||
for ( var func in helper ) {
|
for ( var func in helper ) {
|
||||||
module.exports[func] = helper[func];
|
module.exports[func] = helper[func];
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue