您的位置:首页 > 编程语言 > Lua

LDT自定义启动模拟器

2014-07-04 10:40 363 查看
最近使用LUA开发手游,团队里大神自研了个框架,底层C++渲染,上层LUA处理逻辑。
LUA的IDE选择LDT,不爽的是它不能自动启动模拟器,看过COCOSIDE能自启动,于是我想改造下LDT让它支持自启动模拟器。

参考原型:http://wiki.eclipse.org/Koneki/LDT/Developer_Area/Building_LDT_from_source
注意地方:
1.安装git,在Git Shell下输入 git clone  
git://git.eclipse.org/gitroot/koneki/org.eclipse.koneki.ldt.git

2.安装mvn编译环境http://maven.apache.org/download.html,特别注意要下载3.0.5版本apache-maven-3.0.5-bin.zip
其他的版本不行,在使用mvn clean package -P build-product命令时会下载一些依赖包,要三小时左右。
3.在1中检出的LDT源代码,打开org.eclipse.koneki.ldt.debug.ui.internal.launchconfiguration.attach.LuaAttachMainTab,
修改UI,在doCreateControl方法里添加下面代码
// ======= SIMULATOR GROUP ==========
final Group grpSimulator = new Group(composite, SWT.NONE);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(grpSimulator);
GridDataFactory.fillDefaults().grab(true, false).applyTo(grpSimulator);
grpSimulator.setText(Messages.LuaAttachMainTab_simulator_group);

Label lblWin32 = new Label(grpSimulator, SWT.NONE);
lblWin32.setText(Messages.LuaAttachMainTab_win32_label);
GridDataFactory.swtDefaults().applyTo(lblWin32);

txtWin32 = new Text(grpSimulator, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(txtWin32);
txtWin32.addModifyListener(textModifyListener);


在doInitializeForm方法里初始化文本框路径内容,doPerformApply方法保存属性。
执行bat的入口在org.eclipse.koneki.ldt.debug.core.internal.attach.LuaAttachDebuggingEngineRunner里,
createDebugTarget方法头部加上

try {
ILaunchConfiguration configuration = launch.getLaunchConfiguration();
String path = configuration.getAttribute("simulator_path", "");
// Runtime.getRuntime().exec("cmd.exe /c start D:\\trunk_data\\tools\\Simulator\\Simulator_start.bat");
if(path != "") {
Runtime.getRuntime().exec("cmd.exe /c start " + path);
}
} catch (IOException e) {
}

 
4.做完这些后就是编译代码了,先cd切到代码所在的目录,如 cd C:\Users\Administrator\Documents\GitHub\org.eclipse.koneki.ldt
然后编译mvn clean package -P build-product
大约5分钟时间,提示SUCCESS则成功,如果FAILURE的话,看下报错,如果是显示代码哪行的话就是代码错了要改。还有一种情况是编译器
的问题,如doc.user插件,这时只要重新编译,总会成功的。
 
成功后会在org.eclipse.koneki.ldt\product\target\products目录下生成几个不同系统的IDE包,注意不要覆盖,要解压到新文件夹才起作用。

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  LUA LDT BAT