Building Cocos Creator project from command line

we are now using cocos creator v1.1.1. Any chance we can do command line build (menu Project->Build -> Build button) ?

Any news about this ?

1 Like

I would like to know when having a post build script feature will go into the pipeline too.

Very appreciate cocos. basically, scripting build and compile task is very important when we build a game via a team work and all of development push to git and check out in deploy server. We need the automation process to build and deploy process script to handle it.

note: we use jenkins to handle deployment task…

So for in current version 1.3.3, we still cannot find this, how about future version?

Andy

Also trying to get this to work in order to set up continuous integration, echoing everyone’s comments here. In order to do any kind of serious development work with a team, we need a way of building from command line.

Can any of the engineers give us an idea of how to do this? Assume there’s no build directory at all, and that we’re running in the command line on a headless machine. What commands should we run to, say, generate Android Studio and iOS Xcode projects?

We really need this ASAP, thanks.

EDIT: @zhangxm ping!

I asked @zhangbin to take a look.

1 Like

Hello, everyone. Now Cocos Creator is support build project by command. Here is the document about the usage of command:
https://github.com/cocos-creator/creator-docs/tree/master/source/en/publish/publish-in-command-line.md

Hope it’s helpful!

2 Likes

Can you give specifics? What does that command actually do?

I spent the afternoon with dtrace and a few other tricks trying to see if Cocos Creator just called into the ./cocos binary, but it didn’t look like it. Ideally, my build step calls both the “Build” and the “Compile” steps within Cocos Creator via CLI.

If at all possible, I would like to avoid setting up an entire headless MacOS hackintosh VM in qemu/kvm on my Linux build server just to do CI.

EDIT: Might try darling next:
https://www.darlinghq.org/

I just need the build, not the editor.

The other problem is that the application doesn’t return a non-zero error code upon failure/errors. Really tricky to write scripts around without proper error codes (as expected for UNIX applications, including macOS).

EDIT: I guess I’ll just use a quick and dirty hack and just grep for the word “error” in the standard stream output for now until this is properly resolved.

We not support linux build yet. Still working on this.

Creator will call cocos binary with native engine ./cocos2d-x/tools/cocos2d-console/bin/cocos

1 Like

Creator will call cocos binary with native engine

Thanks for responding @jyinkailej!

Even for project code generation inside jsb-default/frameworks/runtime-src? As in the “Build” step, not the “Compile” step (as the Cocos Creator UI calls it).

If that’s the case, then I can definitely get Linux build working, given it’s relatively easy to get cocos2d-x set up and call the Linux version instead for the build. Otherwise, I’ll let you know how my adventures with darling go then. I bet I can make this work on Linux.

No, only native process will use cocos command, like compile, generate native project.

Other process depend on electron, we need to solve many problems with it.

1 Like

@pandamicro I’ve seen that you plan to have a build template feature in version 1.4, what is the release date?
Thanks :slight_smile:

I think it already works?
https://github.com/cocos-creator/creator-docs/blob/master/source/en/publish/custom-project-build-template.md

That said, I don’t trust it (better to have more control for this kind of thing), so I use my own template and build script.

@jyinkailej Speaking of build scripts, were you able to take a look at having the build process generate an x86 Cocos library?

Given that you have confirmed with me that the compile process is just calling into the cocos binary, it shouldn’t be too difficult to add an option to build for x86 in the Cocos Creator editor UI, which just calls cocos like so:

Has the problem been solved?

1 Like

Yes, and only on Mac and Windows, not Linux (it’s a little tricky even then, but still doable). I’m persevering to get a workaround going for Linux one way or another so that we can use Jenkins on our CI server to automate builds and deployment for my team.

Hello from Spain. My english is not as good as I’d like, so I apologize for any mistake although I hope I will be able to explain what I want to say.
I am new (just 1 week with it) with Cocos Creator and with Jenkins. I am trying to set up a CI server with Jenkins in a W10 machine.
When I do this:
c:\CocosCreator\CocosCreator.exe --path c:\Users\Alejandro\Desktop\cocosProjects\NewProject --build platform=web-desktop
directly in a Windows console or with a bat file all goes well. But when I try to do inside a Jenkins job, the job never finishes. I know you have talk about it months ago, but I would be gracefull for any ideas. Thank you very much in advance.

Getting a 404 on that creator-docs link. Here’s the same page on the cocos site: Publish with Command Line

1 Like

We are using Kubernetes to doing all the things. Including the ci building and publishing by using the gitlab-ci. Currently some of our games written with phaser and we are going to switch another game engine. Our main requirements for a game engine are html5 support and can be built inside Linux/Docker. Without Linux support a game engine is useless. I hope cocos creator adds support Linux soon.