Akos Kiss b43057c90b Add grouping macro guards for disabling engine features (#2084)
Until now, the engine's feature set was configurable either via
`CONFIG_*` macro guards defined individually on compiler command
line or via profiles (which are text files listing macro guards,
picked up by the cmake build system and turning them into compiler
command line options). And the features under profile control are
all enabled by default (i.e., all macros are `CONFIG_DISABLE_*`).

This causes a maintenance issue when new features are added to the
engine, because the disabling macros have to be added to all
profiles that don't include the new features. This can even cause
"compatibility break" for applications that embed JerryScript but
don't use the cmake or the python build system, because then
profiles are unavailable and all feature disabling guards have to
be explicitly passed to the compiler. (I.e., if such an application
wants to use the ES5.1 feature set, it must define all the ES2015
disable macros; if the engine is developed further and a new ES2015
feature gets implemented, then the new feature will sneak into the
application's binary unless its own build system is changed to add
the new feature guard.) Even the in-repo example Curie BSP target
seems to have suffered from this maintenance problem.

This patch introduces two new grouping macro guards that enable the
disabling of all ES5.1 builtins and all ES2015 features. As the
grouping logic is in config.h, the maintenance of non-cmake-based
build systems becomes easier (and there is no change for the python
and cmake-based build systems).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 16:31:30 +01:00
..

About profile files

Specify compile definitions in profile files to use when compiling the jerry-core target.

The default profile is es5.1 which disables the ES2015 features.

Using profiles with the build system

You can specify the profile for the build system in the following ways:

  • with absolute path
  • with a name (this options selects profiles/$(name).profile file)

Restrictions

Only single line options are allowed in the profile file. Any line starting with hash-mark is ignored. Semicolon character is not allowed.

Example usage:

1. Using the build script

# assuming you are in jerryscript folder
./tools/build.py --profile=/absolute/path/to/my_profile.any_extension

or

# assuming you are in jerryscript folder
./tools/build.py --profile=minimal

This command selects the profiles/minimal.profile file.

2. Using only CMake build system

Set FEATURE_PROFILE option to one of the following values:

  • the profile with absolute path
  • name of the profile (which needs to exist in the profiles folder)