Working with Codename One Sources

Checking out the Sources

$ mkdir workspace
$ cd workspace
$ git clone https://github.com/codenameone/CodenameOne
Creating a clean "workspace" directory is optional, and there is nothing special about the name "workspace". It is just recommended to create a clean directory into which you check out Codename One, because building Codename One will check out a few dependent projects and place then at the same level as the CodenameOne folder, so having a clean workspace will make it easier to manage.

Building Sources

$ cd CodenameOne
$ ant
The cd CodenameOne command should take you to the root project directory which contains subfolders "CodenameOne", "Ports", etc.. - not the subfolder named "CodenameOne".

Running Unit Tests

You can run the unit test suite locally in the Codename One simulator using the "test-javase" ant target.

$ ant test-javase

Running iOS Unit Tests

Running iOS Unit tests is currently limited to interal use only by Codename One.

TLDR: You can run Codename One’s unit tests on a local iOS simulator by running the "test-ios" ant target in the main CodenameOne directory. E.g.

ant test-ios

This assumes the following requirements

  1. You are running Mac OS X with Xcode 7.3 or higher installed.

  2. You have npm installed and in your environment PATH.

  3. You have appium installed and running.

Installing npm

Either download the installer from https://nodejs.org/en/ OR run brew install node from terminal.

Installing and Running Appium

Open a new terminal window, then

$ mkdir appium
$ cd appium
$ npm install appium
$ ./node_modules/.bin/appium
You may want to run the last command ./node_modules/.bin/appium as a daemon so that you can continue to use the same terminal window. E.g. ./node_modules/.bin/appium &

Running the Unit tests

$ cd CodenameOne
$ ant test-ios

Overriding the Codename One Build Server Target

$ ant test-ios -Dcn1.iphone.target=iphone_new

This will send to the "iphone_new" build server instead of the default "iphone" server.