Skip to content

Variable Substitutions

Jonathan Chan edited this page Aug 2, 2018 · 2 revisions

Throughout an app, references to variables enclosed like @THIS@ will be replaced by its environment variable ($THIS) during compile time. The following is a list of some of the valid variables and their uses. For a complete list, see the make.sh file.

Variable Description Example
SYS_ORGTLD Your organization top-level domain as set in the PROFILE file. com
SYS_ORGSLD Your organization second-level domain as set in the PROFILE file. specific.example
SYS_APPNAME The name of the directory of the app you are compiling. DemoHelloWorld
SYS_LOCASEAPPNAME SYS_APPNAME in all lowercase letters. demohelloworld
SYS_ORGDOMAIN_REVERSE_DOT Your full organization domain in reverse notation separated by ., i.e. SYS_ORGTLD.SYS_SLD in reverse notation. com.example.specific
SYS_PACKAGE_DOT The package name of the app in reverse notation separated by ., i.e. SYS_ORGDOMAIN_REVERSE_DOT.SYS_LOCASEAPPNAME. com.example.specific.demohelloworld
SYS_PACKAGE_UNDERSCORE SYS_PACKAGE_DOT but with subdomains separated by _ instead. com_example_specific_demohelloworld
SYS_PACKAGE_SLASH SYS_PACKAGE_DOT but with subdomains separated by / instead. com/example/specific/demoheloworld

Notes:

  • Do not use SYS_ORGTLD.SYS_ORGSLD.SYS_LOCASEAPPNAME to refer to your app's package name or bundle ID! If you have subdomains inside of SYS_ORGSLD, they will not be correctly reversed. Do use SYS_PACKAGE_DOTS in its place, or SYS_ORGDOMAIN_REVERSE_DOT when you need your organization domain.
  • Prefer using (system-appname) over using SYS_APPNAME when referencing the name of the app in Scheme code.
  • In Android builds, SYS_ORGDOMAIN_REVERSE_DOT is the keystore alias.
  • JNI native functions declared as native void fnName(...); in Java need to be declared in C as void Java_@SYS_PACKAGE_UNDERSCORE@_@SYS_APPNAME@_fnName(...) { ...}.
  • Finding the main class name in JNI, which needs a fully-qualified class name, is done by calling (*env)->FindClass(env, "@SYS_PACKAGE_SLASH@/@SYS_APPNAME@");.
Clone this wiki locally