GIN Minification (Customer GIN creation)
The GIN minification feature is like the ‘Customer GIN’ feature in GWE2 and can be used to:
- Create a minified GIN file suitable for customers from a user defined template.
- Create a minification JSON template from a specified GIN file.
The sections below define their use and include examples.
Create a Minified GIN File
The command line option --minify[=source.gin] will create a minified version of the source GIN based on a template (and path) specified by the --minify-template=templatefile option. If no source is supplied, the last built GIN file will be used. If no template is supplied, the minifier will exit. The output path of the minified GIN is specified using the --minify-output=path option. If no output path is supplied, the compiler output file path will be used. The resultant minified GIN will have “.min” appended to the source GIN name.
The minifier will create a copy of the source GIN and keep only the options that are in the template. Templates can be GIN, GWE2 cgt or JSON files. If the template is a JSON file it must have the following format:
- Keep:
- Recommended (optional) - Set the Boolean flag “recommended”:true to add any required dependencies for the options that are included in the keep section, and avoid unexpected minified GIN behaviour.
- Categories (optional) - Add a category to the “all_in_category” array to keep all options in that category. See CATEGORY for more details.
- Groups (optional) – List any group of channels, options, tables, maps, etc., or set to true value to keep all in a group.
- Remove:
- Groups (mandatory) - To remove any group, add these as an array to the “remove” group. To remove all in a group, set the group to true.
A warning will be raised if:
- The keep section does not have at least one array, or the recommended flag set.
- There are some recommended options that are not being kept, and the “recommended” flag is set to false.
- The remove section does not have at least one array.
The general format of the JSON template file should look like this:
1{
2 "keep": {
3 "recommended": true,
4 "all_in_category": [
5 "category1",
6 "category2"
7 ],
8 "channels": [
9 "channel1",
10 "channel2"
11 ],
12 "options": [
13 //options to keep
14 ]
15 // other tables/maps/logmaps/strings/channeltables etc. to keep
16 },
17 "remove": {
18 "channels": [
19 "channel3"
20 // other channels to remove
21 ]
22 // other options/tables/maps etc. to remove
23 }
24}An example JSON template file:
1{
2 keep: {
3 channels:[
4 "DEBUG1",
5 "Map_Start"
6 ],
7 options:true,
8 tables:[
9 "TPSPRS",
10 "VCALTBL"
11 ]
12 },
13 remove: {
14 options:[
15 "MaxOnTime"
16 ],
17 channels:[
18 "CNT_DEM"
19 ]
20 }
21}Create a Minification JSON Template
The command line option –minify-list=source.gin will create a minification JSON template from the specified GIN file. If no GIN is supplied, the most recent GIN will be used. The output path for the template can be specified with --minify-list-output=output.json5. If not supplied, the path will be generated from the source GIN name. The resultant JSON template will have “.min” appended to the source GIN file’s name, and will have a similar format to the examples given above.
If there are no suitable templates available, the –minify-list=source.gin feature can be used to create one. This can then be trimmed in a text editor and re-imported to Ginmake via --minify[=source.gin] to create a minified GIN.