Skip to content

Commit d72d953

Browse files
authored
Merge pull request #533 from awvwgk/extra
Allow extra section in package manifest
2 parents 613da74 + 5ea752d commit d72d953

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

manifest-reference.md

+23
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Every manifest file consists of the following sections:
4949
Dependencies only needed for tests
5050
- [*install*](#installation-configuration):
5151
Installation configuration
52+
- [*extra*](#additional-free-data-field):
53+
Additional free data field
5254

5355

5456
[TOML]: https://toml.io/
@@ -479,3 +481,24 @@ By default only executables are installed, library projects can set the *library
479481
[install]
480482
library = true
481483
```
484+
485+
486+
## Additional free data field
487+
488+
Third-party tools can store their configuration inside the *extra* section.
489+
This section will never be evaluated by fpm itself, the only constraint imposed is that it has to be valid TOML.
490+
491+
Since the format of this section is free, only recommendations are provided here for adding data to the *extra* section.
492+
493+
1. Only use subtables, never add configuration data to the top level of the *extra* section.
494+
Reasoning: different tools can avoid collisions of key names by placing their data in separate subtables.
495+
2. Use the concrete name of the tool rather than a generic name for the subtable.
496+
Reasoning: different formatter or linter tools might use conflicting keywords in a *format* or *lint* subtable.
497+
Also, users can tell from the table name which tool is preferred to use with the project.
498+
3. Fpm plugins should use a subtable with their plugin name in the *extra.fpm* section to store their data.
499+
Reasoning: following this convention provides the user of fpm plugins with one section to configure their used plugins.
500+
4. Use the fpm preferred style for keywords which is lowercase with dashes.
501+
Reasoning: while there is no style check in this section, a consistent style in the whole manifest will make it easier for the user to understand the whole package manifest.
502+
503+
Feedback for the recommendations above is very much welcome.
504+
If you have a tool that uses the *extra* section in the package manifest, feel free to post it in at the [fpm discussion board](https://github.com/fortran-lang/fpm/discussions).

src/fpm/manifest/package.f90

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
!>[[ executable ]]
3030
!>[[ example ]]
3131
!>[[ test ]]
32+
!>[extra]
3233
!>```
3334
module fpm_manifest_package
3435
use fpm_manifest_build, only: build_config_t, new_build_config
@@ -303,7 +304,7 @@ subroutine check(table, error)
303304
case("version", "license", "author", "maintainer", "copyright", &
304305
& "description", "keywords", "categories", "homepage", "build", &
305306
& "dependencies", "dev-dependencies", "test", "executable", &
306-
& "example", "library", "install")
307+
& "example", "library", "install", "extra")
307308
continue
308309

309310
end select

0 commit comments

Comments
 (0)