From 1825241ce7e4c4cd733fb1204bf6aa9a94d47fe2 Mon Sep 17 00:00:00 2001 From: Ulysse <5031221+voodoos@users.noreply.github.com> Date: Tue, 24 Mar 2020 17:33:45 +0100 Subject: [PATCH] Extensions versioning (#3270) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve and check extensions versioning. Signed-off-by: Ulysse GĂ©rard Co-authored-by: Jeremie Dimino --- CHANGES.md | 5 + doc/dune-files.rst | 6 +- doc/opam.rst | 2 +- src/dune/action_plugin.ml | 2 +- src/dune/cinaps.ml | 3 +- src/dune/dune_file.ml | 8 +- src/dune/dune_project.ml | 81 ++++++----- src/dune/format_config.ml | 6 +- src/dune/install_rules.ml | 2 +- src/dune/mdx.ml | 2 +- src/dune/menhir_stanza.ml | 6 +- src/dune/ocaml_stdlib.ml | 2 +- src/dune/stanza.ml | 9 +- src/dune_lang/syntax.ml | 137 +++++++++++++++--- src/dune_lang/syntax.mli | 14 +- src/dune_lang/versioned_file.ml | 11 +- test/blackbox-tests/dune.inc | 10 ++ .../test-cases/coq/base/dune-project | 2 +- .../test-cases/coq/ml_lib/dune-project | 2 +- .../test-cases/coq/rec_module/dune-project | 2 +- .../test-cases/extensions-versionning/run.t | 41 ++++++ .../using-generation/dune | 2 + .../using-generation/dune-project | 1 + .../version-mismatch/dune-project | 2 + .../version-unknown-2.5/dune-project | 2 + .../version-unknown/dune-project | 2 + .../formatting/enabled/dune-project | 2 +- .../formatting/partial/dune-project | 2 +- .../test-cases/mdx-stanza/run.t | 8 + .../menhir/general-2.0/dune-project | 2 +- .../stdlib-compilation/dune-project | 2 +- .../utop-default-implementation/dune-project | 2 +- .../1/dune-project | 2 +- .../2/dune-project | 2 +- .../3/dune-project | 2 +- .../not-a-vlib/dune-project | 2 +- .../public-private/dune-project | 2 +- .../vlib-dont-exist/dune-project | 2 +- .../prj1/dune-project | 2 +- .../variants-rogue-impl/prj1/dune-project | 2 +- .../prj1/dune-project | 2 +- 41 files changed, 296 insertions(+), 102 deletions(-) create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/run.t create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune-project create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/version-mismatch/dune-project create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/version-unknown-2.5/dune-project create mode 100644 test/blackbox-tests/test-cases/extensions-versionning/version-unknown/dune-project diff --git a/CHANGES.md b/CHANGES.md index 9fb01d02f75..88e797d81d0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,11 @@ Unreleased - [coq] Support for theory dependencies and compositional builds using new field `(theories ...)` (#2053, @ejgallego, @rgrinberg) + +- From now on, each version of a syntax extension must be explicitely tied to a + minimum version of the dune language. Inconsistent versions in a + `dune-project` will trigger a warning for version <=2.4 and an error for + versions >2.4 of the dune language. (#3270, fixes #2957, @voodoos) 2.4.0 (06/03/2020) ------------------ diff --git a/doc/dune-files.rst b/doc/dune-files.rst index fb7cc62447c..9ad05dd6f09 100644 --- a/doc/dune-files.rst +++ b/doc/dune-files.rst @@ -12,7 +12,7 @@ like: .. code:: scheme - (lang dune 2.4) + (lang dune 2.5) Additionally, they can contains the following stanzas. @@ -1696,7 +1696,7 @@ a typical ``dune-workspace`` file looks like: .. code:: scheme - (lang dune 2.4) + (lang dune 2.5) (context (opam (switch 4.02.3))) (context (opam (switch 4.03.0))) (context (opam (switch 4.04.0))) @@ -1708,7 +1708,7 @@ containing exactly: .. code:: scheme - (lang dune 2.4) + (lang dune 2.5) (context default) This allows you to use an empty ``dune-workspace`` file to mark the root of your diff --git a/doc/opam.rst b/doc/opam.rst index 8151d0435ee..baf4c99d1fa 100644 --- a/doc/opam.rst +++ b/doc/opam.rst @@ -94,7 +94,7 @@ configuration will tell ``dune`` to generate two opam files: ``cohttp.opam`` and .. code:: scheme - (lang dune 2.4) + (lang dune 2.5) (name cohttp) (generate_opam_files true) diff --git a/src/dune/action_plugin.ml b/src/dune/action_plugin.ml index 5cc1d4897d7..5dd882edb2b 100644 --- a/src/dune/action_plugin.ml +++ b/src/dune/action_plugin.ml @@ -1,3 +1,3 @@ let syntax = Dune_lang.Syntax.create ~name:"action-plugin" ~desc:"action plugin extension" - [ (0, 1) ] + [ ((0, 1), `Since (2, 0)) ] diff --git a/src/dune/cinaps.ml b/src/dune/cinaps.ml index 3b85e6def85..40f19b0df82 100644 --- a/src/dune/cinaps.ml +++ b/src/dune/cinaps.ml @@ -16,7 +16,8 @@ let name = "cinaps" type Stanza.t += T of t let syntax = - Dune_lang.Syntax.create ~name ~desc:"the cinaps extension" [ (1, 0) ] + Dune_lang.Syntax.create ~name ~desc:"the cinaps extension" + [ ((1, 0), `Since (1, 11)) ] let alias = Alias.make (Alias.Name.of_string name) diff --git a/src/dune/dune_file.ml b/src/dune/dune_file.ml index aa33fc36d8a..91a3b2c84b9 100644 --- a/src/dune/dune_file.ml +++ b/src/dune/dune_file.ml @@ -22,7 +22,8 @@ let relative_file = let library_variants = let syntax = Dune_lang.Syntax.create ~name:"library_variants" - ~desc:"the experimental library variants feature." [ (0, 2) ] + ~desc:"the experimental library variants feature." + [ ((0, 1), `Since (1, 9)); ((0, 2), `Since (1, 11)) ] in Dune_project.Extension.register_simple ~experimental:true syntax (Dune_lang.Decoder.return []); @@ -1538,7 +1539,8 @@ module Executables = struct let bootstrap_info_extension = let syntax = Dune_lang.Syntax.create ~name:"dune-bootstrap-info" - ~desc:"private extension to handle Dune bootstrap" [ (0, 1) ] + ~desc:"private extension to handle Dune bootstrap" + [ ((0, 1), `Since (2, 0)) ] in Dune_project.Extension.register syntax (return ((), [])) Dyn.Encoder.unit @@ -1992,7 +1994,7 @@ module Coq = struct let syntax = Dune_lang.Syntax.create ~name:"coq" ~desc:"the coq extension (experimental)" - [ (0, 1) ] + [ ((0, 1), `Since (1, 9)) ] let coq_public_decode = map_validate diff --git a/src/dune/dune_project.ml b/src/dune/dune_project.ml index 107b1056768..58903cf1b46 100644 --- a/src/dune/dune_project.ml +++ b/src/dune/dune_project.ml @@ -247,7 +247,9 @@ include Dune_lang.Versioned_file.Make (struct end) let default_dune_language_version = - ref (Dune_lang.Syntax.greatest_supported_version Stanza.syntax) + ref + (Option.value_exn + (Dune_lang.Syntax.greatest_supported_version Stanza.syntax)) let get_dune_lang () = { (Lang.get_exn "dune") with version = !default_dune_language_version } @@ -370,7 +372,8 @@ module Extension = struct let (_ : unit t) = register ?experimental syntax unit_stanzas Unit.to_dyn in () - let instantiate ~loc ~parse_args (name_loc, name) (ver_loc, ver) = + let instantiate ~dune_lang_ver ~loc ~parse_args (name_loc, name) (ver_loc, ver) + = match Table.find extensions name with | None -> User_error.raise ~loc:name_loc @@ -378,50 +381,55 @@ module Extension = struct ~hints: (User_message.did_you_mean name ~candidates:(Table.keys extensions)) | Some t -> - Dune_lang.Syntax.check_supported (syntax t) (ver_loc, ver); + Dune_lang.Syntax.check_supported ~dune_lang_ver (syntax t) (ver_loc, ver); { extension = t; version = ver; loc; parse_args } (* Extensions that are not selected in the dune-project file are automatically available at their latest version. When used, dune will automatically edit the dune-project file. *) - let automatic ~project_file ~f = + let automatic ~lang ~project_file ~f = Table.foldi extensions ~init:[] ~f:(fun name extension acc -> if f name then let version = if is_experimental extension then - (0, 0) + Some (0, 0) else - Dune_lang.Syntax.greatest_supported_version (syntax extension) + let dune_lang_ver = lang.Lang.Instance.version in + Dune_lang.Syntax.greatest_supported_version ~dune_lang_ver + (syntax extension) in - let parse_args p = - let open Dune_lang.Decoder in - let dune_project_edited = ref false in - let arg, stanzas = - parse (enter p) Univ_map.empty (List (Loc.of_pos __POS__, [])) + match version with + | Some version -> + let parse_args p = + let open Dune_lang.Decoder in + let dune_project_edited = ref false in + let arg, stanzas = + parse (enter p) Univ_map.empty (List (Loc.of_pos __POS__, [])) + in + let result_stanzas = + List.map stanzas ~f:(fun (name, p) -> + ( name + , let* () = return () in + if not !dune_project_edited then ( + dune_project_edited := true; + ignore + ( Project_file_edit.append project_file + (Dune_lang.to_string + (List + [ Dune_lang.atom "using" + ; Dune_lang.atom name + ; Dune_lang.atom + (Dune_lang.Syntax.Version.to_string + version) + ])) + : created_or_already_exist ) + ); + p )) + in + (arg, result_stanzas) in - let result_stanzas = - List.map stanzas ~f:(fun (name, p) -> - ( name - , let* () = return () in - if not !dune_project_edited then ( - dune_project_edited := true; - ignore - ( Project_file_edit.append project_file - (Dune_lang.to_string - (List - [ Dune_lang.atom "using" - ; Dune_lang.atom name - ; Dune_lang.atom - (Dune_lang.Syntax.Version.to_string - version) - ])) - : created_or_already_exist ) - ); - p )) - in - (arg, result_stanzas) - in - { extension; version; loc = Loc.none; parse_args } :: acc + { extension; version; loc = Loc.none; parse_args } :: acc + | None -> acc else acc) end @@ -438,7 +446,7 @@ let interpret_lang_and_extensions ~(lang : Lang.Instance.t) ~explicit_extensions [ Pp.textf "Extension %S specified for the second time." name ] | Ok map -> let implicit_extensions = - Extension.automatic ~project_file ~f:(fun name -> + Extension.automatic ~lang ~project_file ~f:(fun name -> not (String.Map.mem map name)) in let extensions = @@ -583,7 +591,8 @@ let parse ~dir ~lang ~opam_packages ~file = and+ parse_args = capture in (* We don't parse the arguments quite yet as we want to set the version of extensions before parsing them. *) - Extension.instantiate ~loc ~parse_args name ver) + Extension.instantiate ~dune_lang_ver:lang.Lang.Instance.version ~loc + ~parse_args name ver) and+ implicit_transitive_deps = field_o_b "implicit_transitive_deps" ~check:(Dune_lang.Syntax.since Stanza.syntax (1, 7)) diff --git a/src/dune/format_config.ml b/src/dune/format_config.ml index 74ef71d8b30..f7dcb0c4b6e 100644 --- a/src/dune/format_config.ml +++ b/src/dune/format_config.ml @@ -4,7 +4,11 @@ open Dune_lang.Decoder let syntax = Dune_lang.Syntax.create ~name:"fmt" - ~desc:"integration with automatic formatters" [ (1, 2) ] + ~desc:"integration with automatic formatters" + [ ((1, 0), `Since (1, 4)) + ; ((1, 1), `Since (1, 7)) + ; ((1, 2), `Since (1, 11)) + ] module Language = struct type t = diff --git a/src/dune/install_rules.ml b/src/dune/install_rules.ml index 22d77b92818..c77096b205f 100644 --- a/src/dune/install_rules.ml +++ b/src/dune/install_rules.ml @@ -295,7 +295,7 @@ let gen_dune_package sctx pkg = let meta_template = Package_paths.meta_template ctx pkg in let name = pkg.name in let dune_version = - Dune_lang.Syntax.greatest_supported_version Stanza.syntax + Option.value_exn (Dune_lang.Syntax.greatest_supported_version Stanza.syntax) in let lib_entries = Super_context.lib_entries_of_package sctx pkg.name in let deprecated_dune_packages = diff --git a/src/dune/mdx.ml b/src/dune/mdx.ml index 61e522ac4ba..72acb639b4c 100644 --- a/src/dune/mdx.ml +++ b/src/dune/mdx.ml @@ -128,7 +128,7 @@ type Stanza.t += T of t let syntax = let name = "mdx" in let desc = "mdx extension to verify code blocks in .md files" in - Dune_lang.Syntax.create ~name ~desc [ (0, 1) ] + Dune_lang.Syntax.create ~name ~desc [ ((0, 1), `Since (2, 4)) ] let default_files = let has_extention ext s = String.equal ext (Filename.extension s) in diff --git a/src/dune/menhir_stanza.ml b/src/dune/menhir_stanza.ml index 48b05326098..a7b8a924152 100644 --- a/src/dune/menhir_stanza.ml +++ b/src/dune/menhir_stanza.ml @@ -1,3 +1,7 @@ let syntax = Dune_lang.Syntax.create ~name:"menhir" ~desc:"the menhir extension" - [ (1, 1); (2, 1) ] + [ ((1, 0), `Since (1, 0)) + ; ((1, 1), `Since (1, 4)) + ; ((2, 0), `Since (1, 4)) + ; ((2, 1), `Since (2, 2)) + ] diff --git a/src/dune/ocaml_stdlib.ml b/src/dune/ocaml_stdlib.ml index 655bec0ca41..b94ee8bf5a6 100644 --- a/src/dune/ocaml_stdlib.ml +++ b/src/dune/ocaml_stdlib.ml @@ -9,7 +9,7 @@ let syntax = Dune_lang.Syntax.create ~name:"experimental_building_ocaml_compiler_with_dune" ~desc:"experimental feature for building the compiler with dune" - [ (0, 1) ] + [ ((0, 1), `Since (1, 3)) ] in Dune_project.Extension.register_simple ~experimental:true syntax (Dune_lang.Decoder.return []); diff --git a/src/dune/stanza.ml b/src/dune/stanza.ml index 180c3599df1..e15020757e0 100644 --- a/src/dune/stanza.ml +++ b/src/dune/stanza.ml @@ -6,8 +6,13 @@ module Parser = struct type nonrec t = string * t list Dune_lang.Decoder.t end -let latest_version = (2, 4) +let latest_version = (2, 5) + +let since v = (v, `Since v) + +let all_minors (major, minor) = + List.init (minor + 1) ~f:(fun i -> since (major, i)) let syntax = Dune_lang.Syntax.create ~name:"dune" ~desc:"the dune language" - [ (1, 12); latest_version ] + (all_minors (1, 12) @ all_minors latest_version) diff --git a/src/dune_lang/syntax.ml b/src/dune_lang/syntax.ml index 25d135f6173..c3697037f6a 100644 --- a/src/dune_lang/syntax.ml +++ b/src/dune_lang/syntax.ml @@ -44,22 +44,90 @@ module Version = struct end module Supported_versions = struct - type t = int Int.Map.t - - let to_dyn = Int.Map.to_dyn Int.to_dyn - - let make = Int.Map.of_list_exn - - let greatest_supported_version t = Option.value_exn (Int.Map.max_binding t) - - let is_supported t (major, minor) = + (* The extension supported versions are declared using an explicit list of all + versions but stored as a map from major versions to maps from minor version + to dune_lang required versions. For instance, if: + + - version 1.0 of an extension was introduced in Dune 1.4 + + - version 1.1 was introduced in Dune 1.6 + + - version 1.2 was introduced in Dune 2.3 + + - version 2.0 was introduced in Dune 2.4 + + we'd have the following map (in associative list syntax): + + {[ [ 1, [ 0, (1, 4); 1, (1, 6); 2, (2, 3) ]; 2, [ 0, (2, 3) ] ] ]} *) + type t = Version.t Int.Map.t Int.Map.t + + let to_dyn t = Int.Map.to_dyn (Int.Map.to_dyn Version.to_dyn) t + + (* We convert the exposed extension version type: {[ (Version.t * [ `Since of + Version.t ]) list ]} which is a list of fully qualified versions paired + with the corresponding dune_lang version. To the internal representation: + {[ (Version.t Int.Map.t) Int.Map.t ]} which is a list of major versions + paired with lists of minor versions paires with a dune_lang version. *) + let make (versions : (Version.t * [ `Since of Version.t ]) list) : t = + let v = + List.fold_left versions + ~init:(Int.Map.empty : t) + ~f:(fun major_map ((major, minor), `Since lang_ver) -> + let add_minor minor_map = + Some (Int.Map.add_exn minor_map minor lang_ver) + in + Int.Map.update major_map major ~f:(function + | Some minor_map -> add_minor minor_map + | None -> add_minor Int.Map.empty)) + in + v + + let remove_uncompatible_versions lang_ver = + Int.Map.filter_map ~f:(fun minors -> + let minors = + Int.Map.filter minors ~f:(fun min_lang -> lang_ver >= min_lang) + in + Option.some_if (not (Int.Map.is_empty minors)) minors) + + let rec greatest_supported_version ?dune_lang_ver t = + let open Option.O in + match dune_lang_ver with + | Some lang_ver -> + let compat = remove_uncompatible_versions lang_ver t in + greatest_supported_version compat + | None -> + let* major, minors = Int.Map.max_binding t in + let* minor, _ = Int.Map.max_binding minors in + Some (major, minor) + + let get_min_lang_ver t (major, minor) = + let open Option.O in + let* minors = Int.Map.find t major in + Int.Map.find minors minor + + let is_supported t (major, minor) lang_ver = match Int.Map.find t major with - | Some minor' -> minor' >= minor + | Some t -> ( + match Int.Map.find t minor with + | Some min_lang_ver -> lang_ver >= min_lang_ver + | None -> false ) | None -> false - let supported_ranges t = - Int.Map.to_list t - |> List.map ~f:(fun (major, minor) -> ((major, 0), (major, minor))) + let supported_ranges lang_ver (t : t) = + let compat = remove_uncompatible_versions lang_ver t in + Int.Map.to_list compat + |> List.map ~f:(fun (major, minors) -> + let max_minor, _ = Option.value_exn (Int.Map.max_binding minors) in + let lower_bound = + (* Map 0.0 to 0.1 since 0.0 is not a valid version number *) + if major = 0 then + (0, 1) + else + (major, 0) + in + let upper_bound = (major, max_minor) in + assert (lower_bound <= upper_bound); + (lower_bound, upper_bound)) end type t = @@ -125,23 +193,46 @@ let create ~name ~desc supported_versions = let name t = t.name -let check_supported t (loc, ver) = - if not (Supported_versions.is_supported t.supported_versions ver) then - User_error.raise ~loc - [ Pp.textf "Version %s of %s is not supported." (Version.to_string ver) - t.name - ; Pp.text "Supported versions:" - ; Pp.enumerate (Supported_versions.supported_ranges t.supported_versions) - ~f:(fun (a, b) -> +let check_supported ~dune_lang_ver t (loc, ver) = + if + not (Supported_versions.is_supported t.supported_versions ver dune_lang_ver) + then + let dune_ver_text v = + Printf.sprintf "version %s of the dune language" (Version.to_string v) + in + let until = + match Supported_versions.get_min_lang_ver t.supported_versions ver with + | Some v -> Printf.sprintf " until %s" (dune_ver_text v) + | None -> "" + in + let l = + Supported_versions.supported_ranges dune_lang_ver t.supported_versions + in + let supported = + ( if List.is_empty l then + Pp.textf "There are no supported versions of this extension in %s." + else + Pp.textf "Supported versions of this extension in %s:" ) + (dune_ver_text dune_lang_ver) + in + let message = + [ Pp.textf "Version %s of %s is not supported%s." (Version.to_string ver) + t.desc until + ; supported + ; Pp.enumerate l ~f:(fun (a, b) -> let open Version.Infix in if a = b then Pp.text (Version.to_string a) else Pp.textf "%s to %s" (Version.to_string a) (Version.to_string b)) ] + in + let is_error = String.is_empty until || dune_lang_ver >= (2, 5) in + User_warning.emit ~is_error ~loc message -let greatest_supported_version t = - Supported_versions.greatest_supported_version t.supported_versions +let greatest_supported_version ?dune_lang_ver t = + Supported_versions.greatest_supported_version ?dune_lang_ver + t.supported_versions let key t = t.key diff --git a/src/dune_lang/syntax.mli b/src/dune_lang/syntax.mli index 357a6f02fbd..a175e0b9555 100644 --- a/src/dune_lang/syntax.mli +++ b/src/dune_lang/syntax.mli @@ -58,18 +58,20 @@ module Warning : sig end (** [create ~name ~desc supported_versions] defines a new syntax. - [supported_version] is the list of the last minor version of each supported - major version. [desc] is used to describe what this syntax represent in - error messages. *) -val create : name:string -> desc:string -> Version.t list -> t + [supported_version] is the list of all the supported versions paired with + the versions of the dune lang in which they where introduced. [desc] is used + to describe what this syntax represent in error messages. *) +val create : + name:string -> desc:string -> (Version.t * [ `Since of Version.t ]) list -> t (** Return the name of the syntax. *) val name : t -> string (** Check that the given version is supported and raise otherwise. *) -val check_supported : t -> Loc.t * Version.t -> unit +val check_supported : dune_lang_ver:Version.t -> t -> Loc.t * Version.t -> unit -val greatest_supported_version : t -> Version.t +val greatest_supported_version : + ?dune_lang_ver:Version.t -> t -> Version.t option (** {1 S-expression parsing} *) diff --git a/src/dune_lang/versioned_file.ml b/src/dune_lang/versioned_file.ml index 4254ed54bb9..20f0c425ef1 100644 --- a/src/dune_lang/versioned_file.ml +++ b/src/dune_lang/versioned_file.ml @@ -59,7 +59,7 @@ struct let { First_line.lang = name_loc, name; version = ver_loc, ver } = first_line in - let ver = + let dune_lang_ver = Decoder.parse Syntax.Version.decode Univ_map.empty (Atom (ver_loc, Atom.of_string ver)) in @@ -69,14 +69,17 @@ struct [ Pp.textf "Unknown language %S." name ] ~hints:(User_message.did_you_mean name ~candidates:(Table.keys langs)) | Some t -> - Syntax.check_supported t.syntax (ver_loc, ver); - { syntax = t.syntax; data = t.data; version = ver } + Syntax.check_supported ~dune_lang_ver t.syntax (ver_loc, dune_lang_ver); + { syntax = t.syntax; data = t.data; version = dune_lang_ver } + (* TODO get_exn is only called with "dune" so far, but + greatest_supported_version may return None for extensions which are not + supported under the specified dune_lang version *) let get_exn name : Instance.t = let t = Table.find_exn langs name in { syntax = t.syntax ; data = t.data - ; version = Syntax.greatest_supported_version t.syntax + ; version = Option.value_exn (Syntax.greatest_supported_version t.syntax) } end diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index 58a5e73a70e..1ad616d92f5 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -644,6 +644,14 @@ test-cases/explicit_js_mode (progn (run dune-cram run run.t) (diff? run.t run.t.corrected))))) +(rule + (alias extensions-versionning) + (deps (package dune) (source_tree test-cases/extensions-versionning)) + (action + (chdir + test-cases/extensions-versionning + (progn (run dune-cram run run.t) (diff? run.t run.t.corrected))))) + (rule (alias external-lib-deps-github3143) (deps (package dune) (source_tree test-cases/external-lib-deps/github3143)) @@ -2471,6 +2479,7 @@ (alias exec-cmd) (alias exec-missing) (alias exes-with-c) + (alias extensions-versionning) (alias external-lib-deps-github3143) (alias external-lib-deps-simple) (alias extra-lang-line) @@ -2755,6 +2764,7 @@ (alias exec-cmd) (alias exec-missing) (alias exes-with-c) + (alias extensions-versionning) (alias external-lib-deps-github3143) (alias external-lib-deps-simple) (alias extra-lang-line) diff --git a/test/blackbox-tests/test-cases/coq/base/dune-project b/test/blackbox-tests/test-cases/coq/base/dune-project index 412ae241a3b..ec6655bea0e 100644 --- a/test/blackbox-tests/test-cases/coq/base/dune-project +++ b/test/blackbox-tests/test-cases/coq/base/dune-project @@ -1,3 +1,3 @@ -(lang dune 1.8) +(lang dune 1.9) (using coq 0.1) diff --git a/test/blackbox-tests/test-cases/coq/ml_lib/dune-project b/test/blackbox-tests/test-cases/coq/ml_lib/dune-project index 412ae241a3b..ec6655bea0e 100644 --- a/test/blackbox-tests/test-cases/coq/ml_lib/dune-project +++ b/test/blackbox-tests/test-cases/coq/ml_lib/dune-project @@ -1,3 +1,3 @@ -(lang dune 1.8) +(lang dune 1.9) (using coq 0.1) diff --git a/test/blackbox-tests/test-cases/coq/rec_module/dune-project b/test/blackbox-tests/test-cases/coq/rec_module/dune-project index 412ae241a3b..ec6655bea0e 100644 --- a/test/blackbox-tests/test-cases/coq/rec_module/dune-project +++ b/test/blackbox-tests/test-cases/coq/rec_module/dune-project @@ -1,3 +1,3 @@ -(lang dune 1.8) +(lang dune 1.9) (using coq 0.1) diff --git a/test/blackbox-tests/test-cases/extensions-versionning/run.t b/test/blackbox-tests/test-cases/extensions-versionning/run.t new file mode 100644 index 00000000000..a00aa92f349 --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/run.t @@ -0,0 +1,41 @@ +Test that version of extensions is compatible with dune_lang version + $ dune build --root version-mismatch + Entering directory 'version-mismatch' + File "dune-project", line 2, characters 14-17: + 2 | (using menhir 2.0) + ^^^ + Warning: Version 2.0 of the menhir extension is not supported until version + 1.4 of the dune language. + Supported versions of this extension in version 1.2 of the dune language: + - 1.0 + + $ dune build --root version-unknown + Entering directory 'version-unknown' + File "dune-project", line 2, characters 14-17: + 2 | (using menhir 4.0) + ^^^ + Error: Version 4.0 of the menhir extension is not supported. + Supported versions of this extension in version 1.2 of the dune language: + - 1.0 + [1] + + $ dune build --root version-unknown-2.5 + Entering directory 'version-unknown-2.5' + File "dune-project", line 2, characters 14-17: + 2 | (using menhir 4.0) + ^^^ + Error: Version 4.0 of the menhir extension is not supported. + Supported versions of this extension in version 2.5 of the dune language: + - 1.0 to 1.1 + - 2.0 to 2.1 + [1] + +TODO $ dune build --root version-mismatch-2.5 Should raise an error and +not a warning as in $ dune build --root version-mismatch + +Using fields in dune-project should be generated according to +the maximum supported version for the chosen dune lang version + $ dune build --root using-generation + Entering directory 'using-generation' + Info: Appending this line to dune-project: (using menhir 1.0) + diff --git a/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune b/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune new file mode 100644 index 00000000000..1791fba8f57 --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune @@ -0,0 +1,2 @@ +(menhir + (modules parser.mly)) diff --git a/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune-project b/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune-project new file mode 100644 index 00000000000..f75713fb8c4 --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/using-generation/dune-project @@ -0,0 +1 @@ +(lang dune 1.2) diff --git a/test/blackbox-tests/test-cases/extensions-versionning/version-mismatch/dune-project b/test/blackbox-tests/test-cases/extensions-versionning/version-mismatch/dune-project new file mode 100644 index 00000000000..cd8c61711b1 --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/version-mismatch/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.2) +(using menhir 2.0) diff --git a/test/blackbox-tests/test-cases/extensions-versionning/version-unknown-2.5/dune-project b/test/blackbox-tests/test-cases/extensions-versionning/version-unknown-2.5/dune-project new file mode 100644 index 00000000000..4943a5eecef --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/version-unknown-2.5/dune-project @@ -0,0 +1,2 @@ +(lang dune 2.5) +(using menhir 4.0) diff --git a/test/blackbox-tests/test-cases/extensions-versionning/version-unknown/dune-project b/test/blackbox-tests/test-cases/extensions-versionning/version-unknown/dune-project new file mode 100644 index 00000000000..d39b588d171 --- /dev/null +++ b/test/blackbox-tests/test-cases/extensions-versionning/version-unknown/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.2) +(using menhir 4.0) diff --git a/test/blackbox-tests/test-cases/formatting/enabled/dune-project b/test/blackbox-tests/test-cases/formatting/enabled/dune-project index 03b1bda7b44..57bb1ac26c3 100644 --- a/test/blackbox-tests/test-cases/formatting/enabled/dune-project +++ b/test/blackbox-tests/test-cases/formatting/enabled/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.2) +(lang dune 1.7) (using fmt 1.1) diff --git a/test/blackbox-tests/test-cases/formatting/partial/dune-project b/test/blackbox-tests/test-cases/formatting/partial/dune-project index 5c97e9c7c37..888693b676b 100644 --- a/test/blackbox-tests/test-cases/formatting/partial/dune-project +++ b/test/blackbox-tests/test-cases/formatting/partial/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.2) +(lang dune 1.4) (using fmt 1.0 (enabled_for ocaml)) diff --git a/test/blackbox-tests/test-cases/mdx-stanza/run.t b/test/blackbox-tests/test-cases/mdx-stanza/run.t index aa880812b4c..18a103ceea5 100644 --- a/test/blackbox-tests/test-cases/mdx-stanza/run.t +++ b/test/blackbox-tests/test-cases/mdx-stanza/run.t @@ -9,6 +9,14 @@ It also requires dune lang 2.4 or higher $ dune build @install --root lang-version/ Entering directory 'lang-version' + File "dune-project", line 3, characters 11-14: + 3 | (using mdx 0.1) + ^^^ + Warning: Version 0.1 of mdx extension to verify code blocks in .md files is + not supported until version 2.4 of the dune language. + There are no supported versions of this extension in version 2.3 of the dune + language. + File "dune", line 1, characters 0-5: 1 | (mdx) ^^^^^ diff --git a/test/blackbox-tests/test-cases/menhir/general-2.0/dune-project b/test/blackbox-tests/test-cases/menhir/general-2.0/dune-project index c463594c3e2..ba417fe0cf0 100644 --- a/test/blackbox-tests/test-cases/menhir/general-2.0/dune-project +++ b/test/blackbox-tests/test-cases/menhir/general-2.0/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.0) +(lang dune 1.4) (using menhir 2.0) diff --git a/test/blackbox-tests/test-cases/stdlib-compilation/dune-project b/test/blackbox-tests/test-cases/stdlib-compilation/dune-project index 0fa1c764879..ef8312b8f38 100644 --- a/test/blackbox-tests/test-cases/stdlib-compilation/dune-project +++ b/test/blackbox-tests/test-cases/stdlib-compilation/dune-project @@ -1,4 +1,4 @@ -(lang dune 1.2) +(lang dune 1.3) (using experimental_building_ocaml_compiler_with_dune 0.1) (package (name stdlib)) diff --git a/test/blackbox-tests/test-cases/utop/utop-default-implementation/dune-project b/test/blackbox-tests/test-cases/utop/utop-default-implementation/dune-project index 608ef20b1b1..870dce655b0 100644 --- a/test/blackbox-tests/test-cases/utop/utop-default-implementation/dune-project +++ b/test/blackbox-tests/test-cases/utop/utop-default-implementation/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.7) +(lang dune 1.9) (using library_variants 0.1) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/1/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/1/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/1/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/1/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/2/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/2/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/2/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/2/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/3/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/3/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/3/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/3/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/not-a-vlib/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/not-a-vlib/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/not-a-vlib/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/not-a-vlib/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/public-private/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/public-private/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/public-private/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/public-private/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/vlib-dont-exist/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/vlib-dont-exist/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/vlib-dont-exist/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration-conflict/vlib-dont-exist/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-external-declaration/prj1/dune-project b/test/blackbox-tests/test-cases/variants/variants-external-declaration/prj1/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-external-declaration/prj1/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-external-declaration/prj1/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-rogue-impl/prj1/dune-project b/test/blackbox-tests/test-cases/variants/variants-rogue-impl/prj1/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-rogue-impl/prj1/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-rogue-impl/prj1/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants/variants-wrong-external-declaration/prj1/dune-project b/test/blackbox-tests/test-cases/variants/variants-wrong-external-declaration/prj1/dune-project index 51cd215341f..dce08ffd19c 100644 --- a/test/blackbox-tests/test-cases/variants/variants-wrong-external-declaration/prj1/dune-project +++ b/test/blackbox-tests/test-cases/variants/variants-wrong-external-declaration/prj1/dune-project @@ -1,2 +1,2 @@ -(lang dune 1.10) +(lang dune 1.11) (using library_variants 0.2)