build-cocos

Runs cocos comand to build cocos2d-x C++/Lua/Javascript projects

xpol

1,437

3

0.5.3

MIT

GitHub

This package provides the following services:

Cocos build for Atom

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.

How It Works

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:

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.

Features

Add Build Targets for Cocos2d-x Projects

Supports run build, deploy, run, and release tasks inside Atom.

Build targets for a Lua project:

Targets

Captures Build and Runtime Errors

Cpp build errors:

Cpp Errors

Lua runtime errors:

Lua Errors

Support Additional Configure in .cocos-project.json

Additional key for .cocos-project.json:

Setup

  1. Install atom-build and this atom-build-cocos package apm install build build-cocos.
  2. To setup cocos path you have two options either:
  1. For Lua project
  1. After that, in Atom open you project root directory which contains .cocos-project.json, run cmd-alt-t / ctrl-alt-t / f7 to displays the available build targets.
  2. Set .cocos-project.json:

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...
end


local 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.
end

xpcall(main, __G__TRACKBACK__)

Contribute

Ideas, bugs and pull requests please go to GitHub xpol/atom-build-cocos.