@@ -105,7 +105,6 @@ module Lib = struct
105105 let melange_runtime_deps = additional_paths (Lib_info. melange_runtime_deps info) in
106106 let jsoo_runtime = Lib_info. jsoo_runtime info in
107107 let wasmoo_runtime = Lib_info. wasmoo_runtime info in
108- let virtual_ = Lib_info. virtual_ info in
109108 let instrumentation_backend = Lib_info. instrumentation_backend info in
110109 let native_archives =
111110 match Lib_info. native_archives info with
@@ -124,7 +123,6 @@ module Lib = struct
124123 record_fields
125124 @@ [ field " name" Lib_name. encode name
126125 ; field " kind" Lib_kind. encode kind
127- ; field_b " virtual" virtual_
128126 ; field_o " synopsis" string synopsis
129127 ; field_o " orig_src_dir" path orig_src_dir
130128 ; mode_paths " archives" archives
@@ -192,7 +190,20 @@ module Lib = struct
192190 let + synopsis = field_o " synopsis" string
193191 and + loc = loc
194192 and + modes = field_l " modes" Lib_mode. decode
195- and + kind = field " kind" Lib_kind. decode
193+ and + kind =
194+ let * kind = field " kind" Lib_kind. decode in
195+ let + virtual_ = field_b " virtual" in
196+ match kind with
197+ | (Dune_file Normal | Virtual ) when virtual_ ->
198+ (* Backward compatible support for dune-project files
199+ that include the [(virtual)] field. *)
200+ Lib_kind. Virtual
201+ | incompatible_kind when virtual_ ->
202+ Code_error. raise
203+ " invalid combination of 'kind' and 'virtual' fields in library stanza of \
204+ dune-package file"
205+ [ " kind" , Lib_kind. to_dyn incompatible_kind; " virtual" , Dyn. Bool virtual_ ]
206+ | otherwise -> otherwise
196207 and + archives = mode_paths " archives"
197208 and + plugins = mode_paths " plugins"
198209 and + foreign_objects = paths " foreign_objects"
@@ -218,7 +229,6 @@ module Lib = struct
218229 and + melange_runtime_deps = paths " melange_runtime_deps"
219230 and + requires = field_l " requires" (Lib_dep. decode ~allow_re_export: true )
220231 and + ppx_runtime_deps = libs " ppx_runtime_deps"
221- and + virtual_ = field_b " virtual"
222232 and + sub_systems = Sub_system_info. record_parser
223233 and + orig_src_dir = field_o " orig_src_dir" path
224234 and + modules = field " modules" (Modules. decode ~src_dir: base)
@@ -284,7 +294,6 @@ module Lib = struct
284294 ~enabled
285295 ~virtual_deps
286296 ~dune_version
287- ~virtual_
288297 ~entry_modules
289298 ~implements
290299 ~default_implementation
0 commit comments