标签:des android io os ar 使用 java for sp
luajit -b main.lua ../bytecode/main.lua
使用js脚本进行批处理,把src的lua文件编译到bytecode目录里面
#!/usr/bin/env node var fs = require(‘fs‘); var spawn = require(‘child_process‘).spawn var src = "./"; var dest = "../bytecode/"; function filter(path) { var extendName = path.substring(path.lastIndexOf(‘.‘)+1, path.length); extendName = extendName.toLowerCase(); if (extendName == "lua") { return true; } return false; } (function build(src, dest) { var lists = fs.readdirSync(src); var tempDirs = []; if (!fs.existsSync(dest)) { fs.mkdirSync(dest); } lists.forEach(function(path) { var fullSrcPath = src + path; var fullDestPath = dest + path; var stats = fs.lstatSync(fullSrcPath); if (stats.isFile()) { if (filter(fullSrcPath)) { console.log("luajit -b " + fullSrcPath + " " + fullDestPath); var ps = spawn("luajit", ["-b", fullSrcPath, fullDestPath]); ps.on(‘error‘, function (data) { console.log(‘stderr: ‘ + data); }); } } else if(stats.isDirectory()) { tempDirs.push(path); } }); tempDirs.forEach(function(path) { build(src + path + "/", dest + path + "/"); }); })(src, dest);
在src目录下面运行命令 Luajitbuild.js。
编译发布版本的时候,要把src目录移除,把bytecode加入到复制路径。
打开proj.android/build-cfg.json
修改:
{ "from": "../../../src", "to": "src", "exclude": [ "*.gz" ] }
为
{ "from": "../../../bytecode", "to": "bytecode", "exclude": [ "*.gz" ] },
打开config.json
文件,把entry
变量改成bytecode下的main.lua
标签:des android io os ar 使用 java for sp
原文地址:http://my.oschina.net/skyhacker2/blog/334051