Building a Tabris.js App

Tabris.js utilizes Apache Cordova to build and package apps. Apps can be built without any local setup using the free online build service on tabrisjs.com. To build an app on your local machine, you need to setup developer tools like Xcode or the Android SDK. The following features are supported by the two different build types.

The online build service is free for unlimited public GitHub repositories and 1 private repository. To build from unlimited private repositories, you need a Pro account. Local build is free for everyone. To build locally you need to follow the local build guide.

Project Layout

To prepare your project for the build, you have to create a subdirectory named cordova that contains the build configuration. The layout of a Tabris.js project might look like this:

The config.xml

The minimal build configuration you need is a config.xml file that describes your app. The config.xml contains information like the id of your app, its version, icons and splash screens. The format of the config.xml is the same as a standard Cordova config.xml file. A minimal example config could look like this:

The .tabrisignore file

The build service packages the contents of your project into the app. You can exclude certain files or directories that are not required in the packaged app, such as tests or developer documentation. Files and directories to be ignored by the build can be listed in a file named .tabrisignore. The format of this ignore file follows the same rules as a .gitignore file.

The .tabrisignore file is only relevant for the build service. In a local build, you have to manage the packaged files yourself (see below).

Build Service

Tabrisjs.com offers a free online build service for Tabris.js apps. After signing in you can create an app in the “My Apps” section by clicking “Create App”. Now you can select your GitHub repository in the list of repositories (if it’s not visible you may need to press the “synchronize” button). Users on the Pro plan can also use self hosted Git repositories.
After you have selected your repository it’s going to be validated. The validation checks if the selected repository contains a valid Tabris.js project layout. If you have a valid project structure and config.xml, your app should become valid shortly. If it’s invalid, the site will tell you what went wrong. In this case please follow the instructions displayed.
After your app has become valid, you are ready to execute the first build. Just select the newly created app and click the “Start Android Build” button. A few minutes later you will get an Android .apk file which is ready to be installed on your device. But what about iOS, production builds and signing? All these things can be configured using the “Settings”.

The build service installs the dependencies specified in your package.json from npm (except devDependencies). As a result, you don’t have to put the node_modules folder under version control.

Settings

Repository URL: This is the URL of your git repository. If you’re using the free build, it should point to a GitHub repository. Users who are on the Pro plan can also use custom repository locations.

SSH Private Key: A SSH private key to access your repository. Only relevant for git repositories which are not hosted on GitHub.

Branch: The git branch to build from. The default value is master. If you want to build from a feature branch, you may specify the branch here.

App Directory: The directory within your repository that contains your Tabris.js app. The value must be relative to the repository root.

iOS Signing Key: iOS apps can not be deployed to a mobile device without being signed. If you want to build an iOS app you need an Apple Developer account and provide the certificate together with the provisioning profile. A very good tutorial on how to get these files can be found in the Phonegap Build documentation.

Android Signing Key: Android apps needs to be signed with a certificate only if you want to deploy them to Google Play. You can find a very good tutorial in the Phonegap Build documentation as well.

Environment Variables: Key/Value pairs that will be stored and transferred encrypted to the build machines. They can be used within the config.xml or custom hooks. Use cases are adding plugins from private git repositories or handling access keys.

Builds to keep: Specifies the number of builds that should be kept before deleting them automatically.

Tabris.js Version: The Tabris.js client version to use in the app. In contrast to the “tabris” dependency to your package.json which defines the version of the JavaScript module, this setting defines the version of the native client that will interpret your JavaScript code. In most cases, the value latest is good enough here. But if you want to stick to a fixed Tabris.js version you can configure it here.

Debug: Enables the debug mode. If set to ON, your app will be built including debug symbols and it will be packaged into the Tabris.js developer app to make development easier. This allows you to use all the benefits like the developer console or the reload also with your own app. Please be aware that debug versions can not be submitted to the app stores. Debug OFF means your app will be built to be ready for release: no developer app, no console, no reload. Only your JavaScript code is executed.

Adding Plugins

To add a set of Apache Cordova Plugins you only need to add them to the config.xml. The online build supports the Cordova <plugin /> tag. This tag allows you to add plugins using an ID, an HTTP or a git URL. A sample config.xml including two Cordova plugins could look like this:

Configuration

In addition to the settings described in the Cordova config.xml Guide, Tabris.js also takes the following modified/additional config.xml attributes into account. These attributes apply to both, the online and the local build.

content

The optional <content> element defines the app’s starting page in ordinary Cordova apps. In Tabris.js you can use it to define the location of the package.json file within the www folder. E.g. <content src="mySubFolder/package.json"/>

Activate/Deactivate SSL certificate validation on XHR. When disabled self signed SSL certificates are accepted. Should be enabled in production.

Android specific preferences

Name

Value

Theme

<ul><li>com.eclipsesource.tabris.android.R.style.Theme_Tabris</li><li>com.eclipsesource.tabris.android.R.style.Theme_Tabris_Light</li><li>com.eclipsesource.tabris.android.R.style.Theme_Tabris_Light_DarkActionBar (Default)</ul> In addition to these three bundled themes, a reference to any other Android theme can be specified (must be a fully qualified name).