Config File
Every app and package has their own config.yml
file which is used to configure the project. Most of the settings have default values and are optional.
Key |
Values |
Description |
---|---|---|
title* |
|
The display name of the app. |
version* |
|
The version of the app. |
package-name* |
|
Package name. |
architecture |
|
The targeted CPU architecture. |
platform |
|
The targeted platform. |
definitions |
|
Preprocessor defines. |
build-type |
|
The type of this build. |
copyright |
|
Copyright notice. |
license |
|
What license the packages is released under. |
authors |
|
List of package authors. |
inherit |
|
Inherit settings from other config. |
packages |
|
List of dependencies. |
exclude-packages |
|
List of packages to exclude. |
repositories |
|
Repositories from where packages can be found. |
source-paths |
|
Paths to where source code can be found. |
include-paths |
|
Paths to where header files can be found. |
link-libraries |
|
Libraries to link with. |
library-paths |
|
Paths to where libraries can be found. |
screen-orientations |
|
List of supported orientations. |
pre-hook |
|
Script called when a package or app has been prepared. |
build-hook |
|
Called for the app it has been built. |
life-cycle |
|
Name of the class that receives life-cycle events. |
* is required.
Example
title: My Game
package-name: com.company.my-app
version: 1.0.0
packages:
- r8-core
Working With Configs
Every project will probably have multiple config files including different configurations depending on use-case.
The config files are hierarchical meaning that you may have a base config that other can inherit from and override its settings. When creating a new project using r8 app --init
you will automatically get a config.yml
, config.linux.yml
and a few others. If you open these two files you will see that config.linux.yml
inherits the settings from config.yml
and adds its own.
# config.yml
title: My Game
package-name: com.company.my-game
version: 0.1.0
life-cycle: App
packages:
- r8-core
# config.linux.yml
inherit:
- config.yml
packages:
- r8-glx
- r8-gles
In this example the config.linux.yml
uses the exact same settings as in config.yml
but also appends two values to the packages
section.
To make changes to a config file you should use the r8 config
command. This validates the entries entered into the file thus lowering the risk of adding invalid values. You may also validate the file manually by using r8 config --validate --filename ./config.yml
.
$ r8 config --get title
My Game
$ r8 config --set title "Another Game"
$ r8 config --get title
Another Game
$ r8 config --add packages "i18n"
$ r8 config --get packages
['r8-core', 'i18n']
$ r8 config --remove packages "i18n"
$ r8 config --get packages
['r8-core']
Hooks
prepare-hook This hook is called for every package and the app when the package or app has been prepared. build-hook This hook is called for the app after a build. Remember to make the called file executable and with a proper shebang.
prepare-hook: post-prepare.py
build-hook: post-build.sh