diff options
author | Celeste Wouters <perso@elementw.net> | 2021-12-11 18:08:44 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2021-12-15 21:21:29 +0100 |
commit | c5148d8c7365ae4da237cdb9b8f8b7904aac80ff (patch) | |
tree | 965a178ef478407e0567b052639eeb01f834d9eb /docs/markdown | |
parent | a2934ca9d13ede4eb97b320bc768319ecad7b525 (diff) | |
download | meson-c5148d8c7365ae4da237cdb9b8f8b7904aac80ff.zip meson-c5148d8c7365ae4da237cdb9b8f8b7904aac80ff.tar.gz meson-c5148d8c7365ae4da237cdb9b8f8b7904aac80ff.tar.bz2 |
rewriter: create {add,rm}_extra_files commands
Add ability to mutate a target's `extra_files` list through the
rewriter.
The logic is copied from sources add/rm, but changes the `extra_files`
kwarg instead of the sources positional argument.
Has additional logic to handle creating the `extra_files` list if it
doesn't exist.
Diffstat (limited to 'docs/markdown')
-rw-r--r-- | docs/markdown/Rewriter.md | 13 | ||||
-rw-r--r-- | docs/markdown/snippets/rewriter_extra_files.md | 26 |
2 files changed, 38 insertions, 1 deletions
diff --git a/docs/markdown/Rewriter.md b/docs/markdown/Rewriter.md index 018434f..535093b 100644 --- a/docs/markdown/Rewriter.md +++ b/docs/markdown/Rewriter.md @@ -77,6 +77,17 @@ and print an error message. For more information see the help output of the rewriter target command. +### Adding and removing `extra_files` + +*Since 0.61.0* + +In the same way you can add and remove source files from a target, you can modify a target's +`extra_files` list: + +```bash +meson rewrite target <target name/id> {add_extra_files/rm_extra_files} [list of extra files] +``` + ### Setting the project version It is also possible to set kwargs of specific functions with the @@ -191,7 +202,7 @@ The format for the type `target` is defined as follows: { "type": "target", "target": "target ID/name/assignment variable", - "operation": "one of ['src_add', 'src_rm', 'target_rm', 'target_add', 'info']", + "operation": "one of ['src_add', 'src_rm', 'target_rm', 'target_add', 'extra_files_add', 'extra_files_rm', 'info']", "sources": ["list", "of", "source", "files", "to", "add, remove"], "subdir": "subdir where the new target should be added (only has an effect for operation 'tgt_add')", "target_type": "function name of the new target -- same as in the CLI (only has an effect for operation 'tgt_add')" diff --git a/docs/markdown/snippets/rewriter_extra_files.md b/docs/markdown/snippets/rewriter_extra_files.md new file mode 100644 index 0000000..c46f076 --- /dev/null +++ b/docs/markdown/snippets/rewriter_extra_files.md @@ -0,0 +1,26 @@ +## `meson rewrite` can modify `extra_files` + +The build script rewriter can now modify targets' `extra_files` lists, +or create them if absent. It it used in the same way as with rewriting +source lists: + +```bash +meson rewrite target <target name/id> {add_extra_files/rm_extra_files} [list of extra files] +``` + +The rewriter's script mode also supports these actions: + +```json +{ + "type": "target", + "target": "<target name>", + "operation": "extra_files_add / extra_files_rm", + "sources": ["list", "of", "extra", "files", "to", "add, remove"], +} +``` + +## `meson rewrite target <target> info` outputs *target*'s `extra_files` + +Targets' `extra_files` lists are now included in the rewriter's target info dump +as a list of file paths, in the same way `sources` are. This applies to both +`meson rewrite` CLI and script mode. |