@@ -28,9 +28,10 @@ Tests for enabled_if in install stanza using forbidden variable.
28
28
File " dune" , line 6 , characters 18 -31:
29
29
6 | (enabled_if (= % {project_root} " " ))
30
30
^^^^^^^^^^^^ ^
31
- Error: Only architecture, system, model, os_type, ccomp_type, profile and
32
- ocaml_version variables are allowed in this ' enabled_if' field. If you think
33
- that project_root should also be allowed, please file an issue about it.
31
+ Error: Only architecture, system, model, os_type, ccomp_type, profile,
32
+ ocaml_version and context_name variables are allowed in this ' enabled_if'
33
+ field. If you think that project_root should also be allowed, please file an
34
+ issue about it.
34
35
[1 ]
35
36
36
37
The next ones use forbidden variables
@@ -43,9 +44,10 @@ For dune 2.3 -> 2.5 it is a warning
43
44
File " dune" , line 3 , characters 19 -32:
44
45
3 | (enabled_if (<> % {project_root} " " )))
45
46
^^^^^^^^^^^^ ^
46
- Warning: Only architecture, system, model, os_type, ccomp_type, profile and
47
- ocaml_version variables are allowed in this ' enabled_if' field. If you think
48
- that project_root should also be allowed, please file an issue about it.
47
+ Warning: Only architecture, system, model, os_type, ccomp_type, profile,
48
+ ocaml_version and context_name variables are allowed in this ' enabled_if'
49
+ field. If you think that project_root should also be allowed, please file an
50
+ issue about it.
49
51
Entering directory ' forbidden_var'
50
52
bar
51
53
@@ -58,7 +60,31 @@ For dune >= 2.6 it is an error
58
60
File " dune" , line 3 , characters 19 -32:
59
61
3 | (enabled_if (<> % {project_root} " " )))
60
62
^^^^^^^^^^^^ ^
61
- Error: Only architecture, system, model, os_type, ccomp_type, profile and
62
- ocaml_version variables are allowed in this ' enabled_if' field. If you think
63
- that project_root should also be allowed, please file an issue about it.
63
+ Error: Only architecture, system, model, os_type, ccomp_type, profile,
64
+ ocaml_version and context_name variables are allowed in this ' enabled_if'
65
+ field. If you think that project_root should also be allowed, please file an
66
+ issue about it.
64
67
[1 ]
68
+
69
+
70
+ For dune < 2.7 context_name is not allowed
71
+ $ cat > var_context_name/ dune-project << EOF
72
+ > (lang dune 2.6 )
73
+ > EOF
74
+ $ dune exec ./ foo. exe -- root var_context_name
75
+ Entering directory ' var_context_name'
76
+ File " dune" , line 3 , characters 18 -31:
77
+ 3 | (enabled_if (= % {context_name} " default" )))
78
+ ^^^^^^^^^^^^ ^
79
+ Error: This variable is only available since version 2.7 of the dune
80
+ language. Please update your dune-project file to have (lang dune 2.7 ).
81
+ [1 ]
82
+
83
+ For dune >= 2.7 context_name allowed
84
+ $ cat > var_context_name/ dune-project << EOF
85
+ > (lang dune 2.7 )
86
+ > EOF
87
+ $ dune exec ./ foo. exe -- root var_context_name
88
+ Entering directory ' var_context_name'
89
+ Entering directory ' var_context_name'
90
+ bar
0 commit comments