@@ -7,7 +7,10 @@ type t =
7
7
| File of String_with_vars .t
8
8
| Alias of String_with_vars .t
9
9
| Alias_rec of String_with_vars .t
10
- | Glob_files of String_with_vars .t
10
+ | Glob_files of
11
+ { glob : String_with_vars .t
12
+ ; recursive : bool
13
+ }
11
14
| Source_tree of String_with_vars .t
12
15
| Package of String_with_vars .t
13
16
| Universe
@@ -18,7 +21,8 @@ let remove_locs = function
18
21
| File sw -> File (String_with_vars. remove_locs sw)
19
22
| Alias sw -> Alias (String_with_vars. remove_locs sw)
20
23
| Alias_rec sw -> Alias_rec (String_with_vars. remove_locs sw)
21
- | Glob_files sw -> Glob_files (String_with_vars. remove_locs sw)
24
+ | Glob_files g ->
25
+ Glob_files { g with glob = String_with_vars. remove_locs g.glob }
22
26
| Source_tree sw -> Source_tree (String_with_vars. remove_locs sw)
23
27
| Package sw -> Package (String_with_vars. remove_locs sw)
24
28
| Universe -> Universe
@@ -46,7 +50,12 @@ let decode =
46
50
[ (" file" , sw >> | fun x -> File x)
47
51
; (" alias" , sw >> | fun x -> Alias x)
48
52
; (" alias_rec" , sw >> | fun x -> Alias_rec x)
49
- ; (" glob_files" , sw >> | fun x -> Glob_files x)
53
+ ; ( " glob_files"
54
+ , sw >> | fun x -> Glob_files { glob = x; recursive = false } )
55
+ ; ( " glob_files_rec"
56
+ , let + () = Dune_lang.Syntax. since Stanza. syntax (2 , 9 )
57
+ and + x = sw in
58
+ Glob_files { glob = x; recursive = true } )
50
59
; (" package" , sw >> | fun x -> Package x)
51
60
; (" universe" , return Universe )
52
61
; ( " files_recursively_in"
@@ -76,9 +85,13 @@ let encode = function
76
85
| Alias_rec t ->
77
86
List
78
87
[ Dune_lang. unsafe_atom_of_string " alias_rec" ; String_with_vars. encode t ]
79
- | Glob_files t ->
88
+ | Glob_files { glob = t ; recursive } ->
80
89
List
81
- [ Dune_lang. unsafe_atom_of_string " glob_files"
90
+ [ Dune_lang. unsafe_atom_of_string
91
+ ( if recursive then
92
+ " glob_files_rec"
93
+ else
94
+ " glob_files" )
82
95
; String_with_vars. encode t
83
96
]
84
97
| Source_tree t ->
0 commit comments