Build and bundle for multiple platforms from the command line


#1

At work we have a nice Python based build system that wraps bob.jar and adds a lot of convenience functionality when building from the command line or on a CI system. The scripts are very useful when you need to run unit tests against your code or when you need to build binaries for multiple platforms.

Since I’m unable to share those scripts I decided to put together a small bash script that at least takes care of the process of building and bundling for multiple platforms. I put the script on GitHub as a Gist. I hope someone finds it useful.


Make bundles for few platforms in one time
Help with Bob and dmengine (SOLVED)
Defold 1.2.89 has been released
Pre-Configured Bundling?
Pre/Post Build Hooks?
#2

This is really useful thanks!


#3

I trying to use your script, but I recieve an errors:

ERROR game.project:0 Unable to create ManifestFile, hashing algorithm is not supported!

Exception in thread “main” com.dynamo.bob.CompileExceptionError: /Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc (No such file or directory)

Exception in thread “main” com.dynamo.bob.CompileExceptionError: Source ‘/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc’ does not exist

etc

Maybe you can help?
Full log:

MacBook-Pro-2:cam alexeygulev$ sh bundle.sh 
Project: Camera
-e 
[Building]
100%                           
The build failed for the following reasons:
ERROR game.project:0 Unable to create ManifestFile, hashing algorithm is not supported!

-e 
[Bundling]
armv7-android
Exception in thread "main" com.dynamo.bob.CompileExceptionError: /Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc (No such file or directory)
	at com.dynamo.bob.Project.build(Project.java:337)
	at com.dynamo.bob.Bob.main(Bob.java:294)
Caused by: java.io.FileNotFoundException: /Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1112)
	at com.dynamo.bob.bundle.AndroidBundler.bundleApplication(AndroidBundler.java:215)
	at com.dynamo.bob.Project.bundle(Project.java:477)
	at com.dynamo.bob.Project.doBuild(Project.java:626)
	at com.dynamo.bob.Project.build(Project.java:329)
	... 1 more
x86-win32
Exception in thread "main" com.dynamo.bob.CompileExceptionError: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at com.dynamo.bob.Project.build(Project.java:337)
	at com.dynamo.bob.Bob.main(Bob.java:294)
Caused by: java.io.FileNotFoundException: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1074)
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038)
	at com.dynamo.bob.bundle.Win32Bundler.bundleApplicationForPlatform(Win32Bundler.java:45)
	at com.dynamo.bob.bundle.Win32Bundler.bundleApplication(Win32Bundler.java:24)
	at com.dynamo.bob.Project.bundle(Project.java:477)
	at com.dynamo.bob.Project.doBuild(Project.java:626)
	at com.dynamo.bob.Project.build(Project.java:329)
	... 1 more
x86-darwin
Exception in thread "main" com.dynamo.bob.CompileExceptionError: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at com.dynamo.bob.Project.build(Project.java:337)
	at com.dynamo.bob.Bob.main(Bob.java:294)
Caused by: java.io.FileNotFoundException: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1074)
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038)
	at com.dynamo.bob.bundle.OSXBundler.bundleApplication(OSXBundler.java:70)
	at com.dynamo.bob.Project.bundle(Project.java:477)
	at com.dynamo.bob.Project.doBuild(Project.java:626)
	at com.dynamo.bob.Project.build(Project.java:329)
	... 1 more
x86-linux
Exception in thread "main" com.dynamo.bob.CompileExceptionError: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at com.dynamo.bob.Project.build(Project.java:337)
	at com.dynamo.bob.Bob.main(Bob.java:294)
Caused by: java.io.FileNotFoundException: Source '/Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc' does not exist
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1074)
	at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:1038)
	at com.dynamo.bob.bundle.LinuxBundler.bundleApplication(LinuxBundler.java:40)
	at com.dynamo.bob.Project.bundle(Project.java:477)
	at com.dynamo.bob.Project.doBuild(Project.java:626)
	at com.dynamo.bob.Project.build(Project.java:329)
	... 1 more
js-web
Exception in thread "main" com.dynamo.bob.CompileExceptionError: /Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc (No such file or directory)
	at com.dynamo.bob.Project.build(Project.java:337)
	at com.dynamo.bob.Bob.main(Bob.java:294)
Caused by: java.io.FileNotFoundException: /Applications/Defold-macosx.cocoa.x86_64/branches/60193/13615/cam/build/default/game.projectc (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at com.dynamo.bob.bundle.HTML5Bundler$SplitFile.performSplit(HTML5Bundler.java:60)
	at com.dynamo.bob.bundle.HTML5Bundler.createSplitFiles(HTML5Bundler.java:250)
	at com.dynamo.bob.bundle.HTML5Bundler.bundleApplication(HTML5Bundler.java:220)
	at com.dynamo.bob.Project.bundle(Project.java:477)
	at com.dynamo.bob.Project.doBuild(Project.java:626)
	at com.dynamo.bob.Project.build(Project.java:329)
	... 1 more
-e 
[Archiving]
-eCamera.apk
mv: rename build/armv7-android/Camera/Camera.apk to -eCamera.apk: No such file or directory
-eCamera_x86-win32.zip
rm: illegal option -- e
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
-eCamera_x86-darwin.zip
rm: illegal option -- e
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
-eCamera_x86-linux.zip
rm: illegal option -- e
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
-eCamera_js-web.zip
rm: illegal option -- e
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file
MacBook-Pro-2:cam alexeygulev$ clea
-bash: clea: command not found
MacBook-Pro-2:cam alexeygulev$ clear


#4

I’ve updated the gist. bob.jar was previously run like this:

java -Djava.ext.dirs= -jar bob.jar

The reason for the -Djava.ext.dirs= part was to avoid a potential conflict with vecmath.jar but now we actually need a working ext dirs path to give bob access to the cryptographic functionality needed for LiveUpdate.

If you’re running into an issue with vecmath.jar you could probably set ext dirs to point to the ext folder inside your Defold installation. Do a recursive search for vecmath.jar and set your exit dirs to the containing folder. Something like this:

java -Djava.ext.dirs=./Users/bjorn.ritzl/Defold-macosx.cocoa.x86_64/configuration/org.eclipse.osgi/bundles/1578/1/.cp/ext/ -jar bob.jar

Error message when building with bob
#5

It works, thank you!!!


#6

Great! Did you have to modify -Djava.ext.dirs?


#7

No i just use you updtaed gist script, and it works without any problem.

I made only one modification with adding install_to_device method for testing on ios (install using https://www.npmjs.com/package/ipa-deploy ) and android (adb install)

I try to find simple way for testing native extensions.