7
7
; preprocess : Preprocess.Without_instrumentation .t Preprocess.Per_module .t
8
8
; preprocessor_deps : Dep_conf .t list
9
9
; runtime_deps : Dep_conf .t list
10
+ ; cinaps_version : Syntax.Version .t
10
11
}
11
12
12
13
let name = " cinaps"
@@ -31,9 +32,17 @@ let decode =
31
32
and + runtime_deps =
32
33
field ~default: [] " runtime_deps"
33
34
(Dune_lang.Syntax. since syntax (1 , 1 ) >>> repeat Dep_conf. decode)
35
+ and + cinaps_version = Dune_lang.Syntax. get_exn syntax
34
36
(* TODO use this field? *)
35
37
and + _flags = Ocaml_flags.Spec. decode in
36
- { loc; files; libraries; preprocess; preprocessor_deps; runtime_deps })
38
+ { loc
39
+ ; files
40
+ ; libraries
41
+ ; preprocess
42
+ ; preprocessor_deps
43
+ ; runtime_deps
44
+ ; cinaps_version
45
+ })
37
46
38
47
let () =
39
48
let open Dune_lang.Decoder in
@@ -85,9 +94,7 @@ let gen_rules sctx t ~dir ~scope =
85
94
let * () =
86
95
(* Ask cinaps to produce a .ml file to build *)
87
96
let sandbox =
88
- let project = Scope. project scope in
89
- if Dune_project. dune_version project > = (3 , 5 ) then
90
- Sandbox_config. needs_sandboxing
97
+ if t.cinaps_version > = (1 , 1 ) then Sandbox_config. needs_sandboxing
91
98
else Sandbox_config. default
92
99
in
93
100
Super_context. add_rule sctx ~loc: t.loc ~dir
@@ -135,7 +142,11 @@ let gen_rules sctx t ~dir ~scope =
135
142
let module A = Action in
136
143
let cinaps_exe = Path. build cinaps_exe in
137
144
let runtime_deps, sandbox =
138
- Dep_conf_eval. unnamed ~expander t.runtime_deps
145
+ let sandbox =
146
+ if t.cinaps_version > = (1 , 1 ) then Sandbox_config. needs_sandboxing
147
+ else Sandbox_config. no_special_requirements
148
+ in
149
+ Dep_conf_eval. unnamed ~sandbox ~expander t.runtime_deps
139
150
in
140
151
let * () = runtime_deps in
141
152
let + () = Action_builder. path cinaps_exe in
0 commit comments