1425bb815Sopenharmony_ci### About profile files 2425bb815Sopenharmony_ci 3425bb815Sopenharmony_ciSpecify compile definitions in profile files to use when compiling the `jerry-core` target. 4425bb815Sopenharmony_ci 5425bb815Sopenharmony_ciThe default profile is ``es5.1`` which disables the ES2015 features. 6425bb815Sopenharmony_ci 7425bb815Sopenharmony_ci### Using profiles with the build system 8425bb815Sopenharmony_ci 9425bb815Sopenharmony_ciYou can specify the profile for the build system in the following ways: 10425bb815Sopenharmony_ci * with absolute path 11425bb815Sopenharmony_ci * with a name (this options selects profiles/$(name).profile file) 12425bb815Sopenharmony_ci 13425bb815Sopenharmony_ci#### Restrictions 14425bb815Sopenharmony_ciOnly single line options are allowed in the profile file. Any line starting with hash-mark is ignored. Semicolon character is not allowed. 15425bb815Sopenharmony_ci 16425bb815Sopenharmony_ci 17425bb815Sopenharmony_ci### Example usage 18425bb815Sopenharmony_ci 19425bb815Sopenharmony_ci#### 1. Using the build script 20425bb815Sopenharmony_ci 21425bb815Sopenharmony_ciIf you want to use a predefined profile, run the build script as follows 22425bb815Sopenharmony_ci(assuming that you are in the project root folder): 23425bb815Sopenharmony_ci 24425bb815Sopenharmony_ci``` 25425bb815Sopenharmony_ci./tools/build.py --profile=minimal 26425bb815Sopenharmony_ci``` 27425bb815Sopenharmony_ci 28425bb815Sopenharmony_ciAlternatively, if you want to use a custom profile at 29425bb815Sopenharmony_ci`/absolute/path/to/my.profile`: 30425bb815Sopenharmony_ci 31425bb815Sopenharmony_ci``` 32425bb815Sopenharmony_ci# Turn off every ES2015 feature EXCEPT the module system 33425bb815Sopenharmony_ciJERRY_ES2015_BUILTIN_DATAVIEW=0 34425bb815Sopenharmony_ciJERRY_ES2015_BUILTIN_MAP=0 35425bb815Sopenharmony_ciJERRY_ES2015_BUILTIN_PROMISE=0 36425bb815Sopenharmony_ciJERRY_ES2015_BUILTIN_SET=0 37425bb815Sopenharmony_ciJERRY_ES2015_BUILTIN_TYPEDARRAY=0 38425bb815Sopenharmony_ci``` 39425bb815Sopenharmony_ci 40425bb815Sopenharmony_ciRun the build script as follows (assuming that you are in the project root 41425bb815Sopenharmony_cifolder): 42425bb815Sopenharmony_ci 43425bb815Sopenharmony_ci``` 44425bb815Sopenharmony_ci./tools/build.py --profile=/absolute/path/to/my.profile 45425bb815Sopenharmony_ci``` 46425bb815Sopenharmony_ci 47425bb815Sopenharmony_ci 48425bb815Sopenharmony_ci#### 2. Using only CMake build system 49425bb815Sopenharmony_ci 50425bb815Sopenharmony_ciSet FEATURE_PROFILE option to one of the following values: 51425bb815Sopenharmony_ci* the profile with absolute path 52425bb815Sopenharmony_ci* name of the profile (which needs to exist in the `profiles` folder) 53425bb815Sopenharmony_ci 54425bb815Sopenharmony_ci 55425bb815Sopenharmony_ci### Configurations 56425bb815Sopenharmony_ci 57425bb815Sopenharmony_ciIn JerryScript all of the features are enabled by default, so an empty profile file turns on all of the available ECMA features. 58425bb815Sopenharmony_ciThe defines can have a value of `0` or `1`. If for whatever reason one of them are not defined, it is treated as if it were 59425bb815Sopenharmony_cidefined to `1`. 60425bb815Sopenharmony_ci 61425bb815Sopenharmony_ci#### ES 5.1 features 62425bb815Sopenharmony_ci 63425bb815Sopenharmony_ci* `JERRY_BUILTIN_ANNEXB`: 64425bb815Sopenharmony_ci Enables or disables the [Annex B](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-B) of the ECMA5.1 standard. 65425bb815Sopenharmony_ci* `JERRY_BUILTIN_ARRAY`: 66425bb815Sopenharmony_ci Enables or disable the [Array](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.4) built-in. 67425bb815Sopenharmony_ci* `JERRY_BUILTIN_BOOLEAN`: 68425bb815Sopenharmony_ci Enables or disables the [Boolean](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.6) built-in. 69425bb815Sopenharmony_ci* `JERRY_BUILTIN_DATE`: 70425bb815Sopenharmony_ci Enables or disables the [Date](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.9) built-in. 71425bb815Sopenharmony_ci* `JERRY_BUILTIN_ERRORS`: 72425bb815Sopenharmony_ci Enables or disables the [Native Error Types](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.11.6) (EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError). 73425bb815Sopenharmony_ci **Note**: The [Error](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.11.2) object remains available. 74425bb815Sopenharmony_ci* `JERRY_BUILTIN_JSON`: 75425bb815Sopenharmony_ci Enables or disables the [JSON](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.12) built-in. 76425bb815Sopenharmony_ci* `JERRY_BUILTIN_MATH`: 77425bb815Sopenharmony_ci Enables or disables the [Math](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.8) built-in. 78425bb815Sopenharmony_ci* `JERRY_BUILTIN_NUMBER`: 79425bb815Sopenharmony_ci Enables or disables the [Number](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.7) built-in. 80425bb815Sopenharmony_ci* `JERRY_BUILTIN_REGEXP`: 81425bb815Sopenharmony_ci Enables or disables the [RegExp](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.10) built-in. 82425bb815Sopenharmony_ci* `JERRY_BUILTIN_STRING`: 83425bb815Sopenharmony_ci Enables or disables the [String](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15.5) built-in. 84425bb815Sopenharmony_ci* `JERRY_BUILTINS`: 85425bb815Sopenharmony_ci Enables or disable all of the [Standard Built-in ECMAScript 5.1 Objects](http://www.ecma-international.org/ecma-262/5.1/index.html#sec-15) 86425bb815Sopenharmony_ci This option is evaulated first, any other `JERRY_BUILTIN_<name>` defines will override that specific builtin config. 87425bb815Sopenharmony_ci Equivalent with setting the following defines to the `JERRY_BUILTINS` value: 88425bb815Sopenharmony_ci * `JERRY_BUILTIN_ANNEXB` 89425bb815Sopenharmony_ci * `JERRY_BUILTIN_ARRAY` 90425bb815Sopenharmony_ci * `JERRY_BUILTIN_BOOLEAN` 91425bb815Sopenharmony_ci * `JERRY_BUILTIN_DATE` 92425bb815Sopenharmony_ci * `JERRY_BUILTIN_ERRORS` 93425bb815Sopenharmony_ci * `JERRY_BUILTIN_JSON` 94425bb815Sopenharmony_ci * `JERRY_BUILTIN_MATH` 95425bb815Sopenharmony_ci * `JERRY_BUILTIN_NUMBER` 96425bb815Sopenharmony_ci * `JERRY_BUILTIN_REGEXP` 97425bb815Sopenharmony_ci * `JERRY_BUILTIN_STRING` 98425bb815Sopenharmony_ci 99425bb815Sopenharmony_ci#### ES6 (ES 2015) features 100425bb815Sopenharmony_ci 101425bb815Sopenharmony_ci* `JERRY_ES2015_BUILTIN_DATAVIEW`: 102425bb815Sopenharmony_ci Enables or disables the [DataView](https://www.ecma-international.org/ecma-262/6.0/#sec-dataview-objects) built-in. 103425bb815Sopenharmony_ci* `JERRY_ES2015_BUILTIN_MAP`: 104425bb815Sopenharmony_ci Enables or disables the [Map](http://www.ecma-international.org/ecma-262/6.0/#sec-keyed-collection) built-ins. 105425bb815Sopenharmony_ci* `JERRY_ES2015_BUILTIN_SET`: 106425bb815Sopenharmony_ci Enables or disables the [SET](https://www.ecma-international.org/ecma-262/6.0/#sec-set-objects) built-in. 107425bb815Sopenharmony_ci* `JERRY_ES2015_BUILTIN_PROMISE`: 108425bb815Sopenharmony_ci Enables or disables the [Promise](http://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects) built-in. 109425bb815Sopenharmony_ci* `JERRY_ES2015_BUILTIN_TYPEDARRAY`: 110425bb815Sopenharmony_ci Enables or disables the [ArrayBuffer](http://www.ecma-international.org/ecma-262/6.0/#sec-arraybuffer-objects) and [TypedArray](http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects) built-ins. 111425bb815Sopenharmony_ci* `JERRY_ES2015_MODULE_SYSTEM`: 112425bb815Sopenharmony_ci Enables or disable the [module system](http://www.ecma-international.org/ecma-262/6.0/#sec-modules) language element. 113425bb815Sopenharmony_ci* `JERRY_ES2015`: Enables or disable all of the implemented [ECMAScript2015 features](http://www.ecma-international.org/ecma-262/6.0/). 114425bb815Sopenharmony_ci * [arrow functions](http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions) language element. 115425bb815Sopenharmony_ci * [class](https://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions) language element. 116425bb815Sopenharmony_ci * [default value](http://www.ecma-international.org/ecma-262/6.0/#sec-function-definitions) for formal parameters. 117425bb815Sopenharmony_ci * [destructuring assignment](http://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-assignment) language element. 118425bb815Sopenharmony_ci * [destructuring binding pattern](http://www.ecma-international.org/ecma-262/6.0/#sec-destructuring-binding-patterns) declarations. 119425bb815Sopenharmony_ci * [enhanced object initializer](http://www.ecma-international.org/ecma-262/6.0/#sec-object-initializer) language element. 120425bb815Sopenharmony_ci * [for-of](https://www.ecma-international.org/ecma-262/6.0/#sec-for-in-and-for-of-statements) language element. 121425bb815Sopenharmony_ci * [generator functions](http://www.ecma-international.org/ecma-262/6.0/#sec-generator-function-definitions) language element. 122425bb815Sopenharmony_ci * [iterator](https://www.ecma-international.org/ecma-262/6.0/#sec-iterator-interface) built-in. 123425bb815Sopenharmony_ci * [rest parameter](http://www.ecma-international.org/ecma-262/6.0/#sec-function-definitions) language element. 124425bb815Sopenharmony_ci * [symbol](https://www.ecma-international.org/ecma-262/6.0/#sec-symbol-objects) language element. 125425bb815Sopenharmony_ci * [template strings](http://www.ecma-international.org/ecma-262/6.0/#sec-static-semantics-templatestrings) language element. 126425bb815Sopenharmony_ci Furthermore all builtins follow the ES2015 specification including those which behave differently in ES5.1. 127425bb815Sopenharmony_ci This option is evaulated first, any other `JERRY_ES2015_<name>` defines will override that specific entry. 128425bb815Sopenharmony_ci Equivalent with setting the following defines to the `JERRY_ES2015` value: 129425bb815Sopenharmony_ci * `JERRY_ES2015_BUILTIN_DATAVIEW` 130425bb815Sopenharmony_ci * `JERRY_ES2015_BUILTIN_MAP` 131425bb815Sopenharmony_ci * `JERRY_ES2015_BUILTIN_SET` 132425bb815Sopenharmony_ci * `JERRY_ES2015_BUILTIN_PROMISE` 133425bb815Sopenharmony_ci * `JERRY_ES2015_BUILTIN_TYPEDARRAY` 134425bb815Sopenharmony_ci * `JERRY_ES2015_MODULE_SYSTEM` 135425bb815Sopenharmony_ci 136