Runs cocos2d-x tasks like build, deploy, run, and release in the Atom
editor.
And captures build and runtime errors.
This package requires atom-build and cocos-console to be installed.
A project are consider as a cocos2d-x project if there is a .cocos-project.json
at project root. And it takes project_type
key in this file for the project
type (cpp|lua|js).
For Run simulator without build
tasks, it find simulator executable name in:
init_cfg.name
in config.json
for lua projectsname
in manifest.webapp
for js projects.and runs debug build executables create by cocos compile -p mac|win32
as simulator.
Do make sure the above config are correct for your project and
cocos compile -p mac|win32
commands works well.
Supports run build, deploy, run, and release tasks inside Atom
.
Build targets for a Lua project:
Cpp build errors:
Lua runtime errors:
Additional key for .cocos-project.json
:
androidABI
: Set APP_ABI
for Android build, multiple abi can be set like armeabi-v7a:x86
. Default armeabi
.androidStudio
: Set true
to build Android Studio project in proj.android-studio
rather than proj.android
. Default false
.iosCodeSignIdentity
: iOS code sign identity used to run iOS: Release
target. eg. iPhone Distribution: xxx... (XXXXXXXXXX)
.luaEncrypt
: Set false
to disable encryption of Lua scripts when run Release
targets. Default true
.luaEncryptKey
: The key used to encrypt Lua scripts when run Release
targets. Default 2dxLua
.luaEncryptSign
: File signature for encrypted Lua script files when run Release
targets. Default XXTEA
apm install build build-cocos
.Global cocos console path
. eg: /Users/xpol/Workspace/cocos2d-x/tools/cocos2d-console
.framewroks/cocos2d-x/tools/cocos2d-console
.cocos-console
(up vote this pending pull request to make it official) to run simulator and captures the runtime Lua errors.src/?.lua;
rather than add src/
to FileUtils' search path, see example main.lua
.xpcall
to your main function and call os.exit(1)
in error handler. see example main.lua
..cocos-project.json
, run cmd-alt-t
/ ctrl-alt-t
/ f7
to displays the available build targets..cocos-project.json
:iosCodeSignIdentity
if you needs build iOS release ipa.luaEncrypt
luaEncryptKey
and luaEncryptSign
to enable encryption for Lua scripts.androidStudio
if you want build in project in proj.android-studio
.Examples
src/main.lua
package.path = 'src/?.lua;src/packages/?.lua'local fu = cc.FileUtils:getInstance()fu:setPopupNotify(false)fu:addSearchPath("res/") -- only add 'res/' for cocos search path, do not add 'src/'.local function main()-- your code here...endlocal traceback = __G__TRACKBACK__function __G__TRACKBACK__(msg)traceback(msg)os.exit(1) -- exit on error so that the error will be parsed by atom-build.endxpcall(main, __G__TRACKBACK__)
Ideas, bugs and pull requests please go to GitHub xpol/atom-build-cocos.
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.