Clean up build for distribution.

This commit is contained in:
James Roseborough
2012-10-02 02:34:34 +00:00
parent 17f233adf8
commit bee51df7b3
6 changed files with 21 additions and 26 deletions

View File

@@ -1,13 +1,13 @@
<project default="all">
<import file="build.xml"/>
<available file="luaj-jse-2.0.jar" property="luaj2.lib.exists"/>
<property name="lua.command" value="lua"/>
<available file="luaj-jse-${version}.jar" property="luaj.lib.exists"/>
<available file="lib/jill-1.0.1.jar" property="jill.lib.exists"/>
<available file="lib/kahlua.jar" property="kahlua.lib.exists"/>
<available file="lib/mochalua-1.0.jar" property="mochalua.lib.exists"/>
<target name="luaj2-lib" unless="luaj2.lib.exists">
<target name="luaj-lib" unless="luaj.lib.exists">
<antcall target="jar-jse"/>
</target>
@@ -30,7 +30,7 @@
dest="lib/mochalua-1.0.jar"/>
</target>
<target name="perf-libs" depends="luaj2-lib,bcel-lib,jill-lib,kahlua-lib,mochalua-lib"/>
<target name="perf-libs" depends="luaj-lib,bcel-lib,jill-lib,kahlua-lib,mochalua-lib"/>
<macrodef name="perftest">
<attribute name="program" default="lua"/>
@@ -51,10 +51,9 @@
<sequential>
<echo level="info">=========== @{luaprog} =============</echo>
<perftest program="java -version" luaprog="" basedir=""/>
<perftest program="lua" luaprog="@{luaprog}"/>
<perftest program="java -cp luaj-jse-2.0.jar lua -n" luaprog="@{luaprog}"/>
<perftest program="java -cp luaj-jse-2.0.jar lua -j" luaprog="@{luaprog}"/>
<perftest program="java -cp luaj-jse-2.0.jar\\;lib/bcel-5.2.jar lua -b" luaprog="@{luaprog}"/>
<perftest program="${lua.command}" luaprog="@{luaprog}"/>
<perftest program="java -cp luaj-jse-${version}.jar lua -n" luaprog="@{luaprog}"/>
<perftest program="java -cp luaj-jse-${version}.jar${path.separator}lib/bcel-5.2.jar lua -b" luaprog="@{luaprog}"/>
</sequential>
</macrodef>

View File

@@ -54,6 +54,7 @@
<tokenfilter><replacestring from='&lt;Object,String&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;Double,String&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;Integer,Integer&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;Integer,LocalVariableGen&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;Exp,Integer&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;String,byte[]&gt;' to=''/></tokenfilter>
<tokenfilter><replacestring from='&lt;String,Variable&gt;' to=''/></tokenfilter>

View File

@@ -29,8 +29,6 @@ import org.luaj.vm2.lib.BaseLib;
import org.luaj.vm2.lib.DebugLib;
import org.luaj.vm2.lib.PackageLib;
import org.luaj.vm2.lib.ResourceFinder;
import org.luaj.vm2.lib.jme.JmePlatform;
import org.luaj.vm2.lib.jse.JsePlatform;
/**
* Global environment used by luaj.

View File

@@ -27,15 +27,6 @@ import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
import org.luaj.vm2.lib.PackageLib.java_searcher;
import org.luaj.vm2.lib.PackageLib.loadlib;
import org.luaj.vm2.lib.PackageLib.lua_searcher;
import org.luaj.vm2.lib.PackageLib.preload_searcher;
import org.luaj.vm2.lib.PackageLib.require;
import org.luaj.vm2.lib.PackageLib.searchpath;
import org.luaj.vm2.lib.jme.JmePlatform;
import org.luaj.vm2.lib.jse.JseOsLib;
import org.luaj.vm2.lib.jse.JsePlatform;
/**
* Subclass of {@link LibFunction} which implements the standard lua {@code os} library.

View File

@@ -64,7 +64,11 @@ public class PackageLib extends OneArgFunction {
/** The default value to use for package.path. This can be set with the system property
* "luaj.package.path", and is "?.lua" by default. */
public static String DEFAULT_LUA_PATH = System.getProperty("luaj.package.path", "?.lua");
public static String DEFAULT_LUA_PATH = System.getProperty("luaj.package.path");
static {
if (DEFAULT_LUA_PATH == null)
DEFAULT_LUA_PATH = "?.lua";
}
/** The globals that were used to load this library. */
Globals globals;

View File

@@ -346,7 +346,7 @@ public class JavaBuilder {
LocalVariableGen local = mg.addLocalVariable(name, type, null, null);
int index = local.getIndex();
map.put(islot, Integer.valueOf(index));
localVarGenBySlot.put(slot, local);
localVarGenBySlot.put(islot, local);
return index;
}
private int findSlotIndex( int slot, boolean isupvalue ) {
@@ -699,9 +699,10 @@ public class JavaBuilder {
init.append(factory.createInvoke(STR_LUASTRING, "valueOf",
TYPE_LUASTRING, ARG_TYPES_STRING, Constants.INVOKESTATIC));
} else {
char[] c = new char[ls.m_length];
for ( int j=0; j<ls.m_length; j++ )
c[j] = (char) (0xff & (int) (ls.m_bytes[ls.m_offset+j]));
byte[] b = ls.dumpbytes();
char[] c = new char[b.length];
for ( int j=0; j<b.length; j++ )
c[j] = (char) (0xff & (int) (b[j]));
init.append(new PUSH(cp, new String(c)));
init.append(factory.createInvoke(STR_STRING, "toCharArray",
TYPE_CHARARRAY, Type.NO_ARGS,
@@ -757,9 +758,10 @@ public class JavaBuilder {
}
public void setVarStartEnd(int slot, int start_pc, int end_pc, String name) {
if (localVarGenBySlot.containsKey(slot)) {
Integer islot = Integer.valueOf(slot);
if (localVarGenBySlot.containsKey(islot)) {
name = name.replaceAll("[^a-zA-Z0-9]", "_");
LocalVariableGen l = localVarGenBySlot.get(slot);
LocalVariableGen l = (LocalVariableGen)localVarGenBySlot.get(islot);
l.setEnd(lastInstrHandles[end_pc-1]);
if (start_pc > 1)
l.setStart(lastInstrHandles[start_pc-2]);