<commit_before>Build-Time Hooks
----------------

A package specifies custom commands in its ``pkg.yml`` file.  There are
three types of commands:

1. pre_build_cmds (run before the build)
2. pre_link_cmds (run after compilation, before linking)
3. post_build_cmds (run after the build)

Example
~~~~~~~

Example (apps/blinky/pkg.yml):

.. code-block:: yaml

    pkg.pre_build_cmds:
        scripts/pre_build1.sh: 100
        scripts/pre_build2.sh: 200

    pkg.pre_link_cmds:
        scripts/pre_link.sh: 500

    pkg.post_build_cmds:
        scripts/post_build.sh: 100


For each command, the string on the left specifies the command to run.
The number on the right indicates the command's relative ordering.  All
paths are relative to the project root.

When newt builds this example, it performs the following sequence:

- scripts/pre_build1.sh
- scripts/pre_build2.sh
- [compile]
- scripts/pre_link.sh
- [link]
- scripts/post_build.sh

If other packages specify custom commands, those commands would also be
executed during the above sequence.  For example, if another package
specifies a pre build command with an ordering of 150, that command<commit_msg>doc: Fix post_link_cmds newt extcmd documentation<commit_after>Build-Time Hooks
----------------

A package specifies custom commands in its ``pkg.yml`` file.  There are
three types of commands:

1. pre_build_cmds (run before the build)
2. pre_link_cmds (run after compilation, before linking)
3. post_link_cmds (run after linking)

Example
~~~~~~~

Example (apps/blinky/pkg.yml):

.. code-block:: yaml

    pkg.pre_build_cmds:
        scripts/pre_build1.sh: 100
        scripts/pre_build2.sh: 200

    pkg.pre_link_cmds:
        scripts/pre_link.sh: 500

    pkg.post_link_cmds:
        scripts/post_link.sh: 100


For each command, the string on the left specifies the command to run.
The number on the right indicates the command's relative ordering.  All
paths are relative to the project root.

When newt builds this example, it performs the following sequence:

- scripts/pre_build1.sh
- scripts/pre_build2.sh
- [compile]
- scripts/pre_link.sh
- [link]
- scripts/post_link.sh

If other packages specify custom commands, those commands would also be
executed during the above sequence.  For example, if another package
specifies a pre build command with an ordering of 150, that command
{'fraction_non_alphanumeric': 0.08715986394557823, 'fraction_numerical': 0.01870748299319728, 'mean_word_length': 3.533718689788054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6323839', 'n_tokens_mistral': 762, 'n_tokens_neox': 698, 'n_words': 267}