You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/docs/reference/config/dune.md
+68-2Lines changed: 68 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,9 +89,21 @@ Stanza:
89
89
90
90
It is almost identical to its *name* sibling, thus we are not documenting it in details here. A notable difference is that the suggestions for the `(is_prefix my-package.)` predicate is improved when the prefix is a package name, as *dunolint* will indeed suggests to *replace* an existing package prefix if one if present. This is a minor ergonomic detail.
91
91
92
+
### libraries
93
+
94
+
`(dune (executable (libraries _)))` is a selector for the *libraries* field of an *executable* stanza:
95
+
96
+
Stanza:
97
+
```dune
98
+
(executable
99
+
(libraries <FRAGMENT>))
100
+
```
101
+
102
+
It is identical to the [library (libraries)](#libraries) selector. See that section for details on predicates and examples.
103
+
92
104
### Fields shared with other stanzas
93
105
94
-
This stanza share some sub selectors with other stanzas. See: *has_field*, *instrumentation*, *lint*, *preprocess*.
106
+
This stanza share some sub selectors with other stanzas. See: *has_field*, *instrumentation*, *libraries*, *lint*, *preprocess*.
95
107
96
108
For example, you can use the `(dune (executable (instrumentation _)))` syntax if you want the *instrumentation* selector to apply to the *executable* stanza only.
`(dune (library (libraries _)))` is a selector for the *libraries* field of a *library* stanza:
464
+
465
+
Stanza:
466
+
```dune
467
+
(library
468
+
(libraries <FRAGMENT>))
469
+
```
470
+
471
+
The predicates of the `libraries` selector are:
472
+
473
+
1.`(mem LIBRARY_NAMES)`
474
+
475
+
Returns *true* iff all the library names specified are present in the list of dependencies found in the fragment.
476
+
477
+
**Semantics**: The predicate `(mem a b c)` is best understood as the sequential application of individual membership checks: `(mem a) ; (mem b) ; (mem c)`, where `;` denotes conjunction (AND). Each library name is checked independently, and all must be present for the predicate to return *true*.
478
+
479
+
When enforced, *dunolint* suggests adding the library name(s) not already present. New libraries are added to the last section (when sections are delimited by comments) and sorted alphabetically within that section.
480
+
481
+
**Negation**: The negation `(not (mem a b c))` distributes as conjunction over the individual checks: `(not (mem a)) ; (not (mem b)) ; (not (mem c))`. This means "ensure none of the specified libraries are present" (all must be absent), not "ensure at least one is absent". When enforced, *dunolint* suggests removing all the supplied library name(s) from the fragment when present.
482
+
483
+
**Empty arguments**: Enforcing `(mem)` or `(not (mem))` with no arguments has no effect.
This stanza shares some sub selectors with other stanzas. See: *instrumentation*, *lint*, *preprocess*.
505
+
This stanza shares some sub selectors with other stanzas. See: *instrumentation*, *libraries*, *lint*, *preprocess*.
452
506
453
507
For example, you can use the `(dune (library (instrumentation _)))` syntax if you want the *instrumentation* selector to apply to the *library* stanza only.
454
508
509
+
## libraries
510
+
511
+
`(dune (libraries _))` is a selector for the *libraries* field found in stanzas *library* and *executable*.
512
+
513
+
Stanza:
514
+
```dune
515
+
(library
516
+
(libraries <FRAGMENT>))
517
+
```
518
+
519
+
Its predicates are documented in the [library (libraries)](#libraries) section above.
520
+
455
521
## lint
456
522
457
523
`(dune (lint _))` is a selector for the *lint* field found in stanzas *library*, *executable* and *executables*.
0 commit comments