diff --git a/CHANGES.md b/CHANGES.md index 93555786c663..ae683673b2a7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -47,6 +47,9 @@ Unreleased - Fix permission errors when `sendfile` is not available (#8234, fixes #8210, @emillon) +- `enabled_if` now supports `arch_sixtyfour` variable (#8023, fixes #7997, + @Alizter) + 3.9.1 (2023-07-06) ------------------ diff --git a/src/dune_rules/enabled_if.ml b/src/dune_rules/enabled_if.ml index dd5d8d85c83f..0da00f8b220c 100644 --- a/src/dune_rules/enabled_if.ml +++ b/src/dune_rules/enabled_if.ml @@ -18,6 +18,7 @@ let common_vars_list = ; "profile" ; "ocaml_version" ; "context_name" + ; "arch_sixtyfour" ] let common_vars ~since = @@ -26,6 +27,7 @@ let common_vars ~since = ~f:(fun var -> match var with | "context_name" -> (var, (2, 7)) + | "arch_sixtyfour" -> (var, (3, 10)) | _ -> (var, since)) common_vars_list) diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/dune b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/dune new file mode 100644 index 000000000000..7e52945737e4 --- /dev/null +++ b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/dune @@ -0,0 +1,4 @@ +(executable + (name hello) + (enabled_if + (= %{arch_sixtyfour} %{arch_sixtyfour}))) diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/hello.ml b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/hello.ml new file mode 100644 index 000000000000..0b94899688b6 --- /dev/null +++ b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/hello.ml @@ -0,0 +1 @@ +let () = Printf.printf "Hello, World!\n" diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/run.t new file mode 100644 index 000000000000..777b5f44290c --- /dev/null +++ b/test/blackbox-tests/test-cases/enabled_if/eif-arch_sixtyfour.t/run.t @@ -0,0 +1,22 @@ +Testing %{arch_sixtyfour} in enabled_if + + $ cat > dune-project << EOF + > (lang dune 3.10) + > EOF + + $ dune exec -- ./hello.exe + Hello, World! + +Testing the version guard + + $ cat > dune-project << EOF + > (lang dune 3.9) + > EOF + + $ dune exec -- ./hello.exe + File "dune", line 4, characters 5-22: + 4 | (= %{arch_sixtyfour} %{arch_sixtyfour}))) + ^^^^^^^^^^^^^^^^^ + Error: %{arch_sixtyfour} is only available since version 3.10 of the dune + language. Please update your dune-project file to have (lang dune 3.10). + [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-exec-forbidden_var.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-exec-forbidden_var.t/run.t index dc37336201ae..34501f0f02b0 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-exec-forbidden_var.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-exec-forbidden_var.t/run.t @@ -8,9 +8,9 @@ The next ones use forbidden variables For dune 2.3 -> 2.5 it is a warning 3 | (enabled_if (<> %{project_root} ""))) ^^^^^^^^^^^^^^^ Warning: Only architecture, system, model, os_type, ccomp_type, profile, - ocaml_version and context_name variables are allowed in this 'enabled_if' - field. If you think that project_root should also be allowed, please file an - issue about it. + ocaml_version, context_name and arch_sixtyfour variables are allowed in this + 'enabled_if' field. If you think that project_root should also be allowed, + please file an issue about it. bar For dune >= 2.6 it is an error @@ -22,7 +22,7 @@ For dune >= 2.6 it is an error 3 | (enabled_if (<> %{project_root} ""))) ^^^^^^^^^^^^^^^ Error: Only architecture, system, model, os_type, ccomp_type, profile, - ocaml_version and context_name variables are allowed in this 'enabled_if' - field. If you think that project_root should also be allowed, please file an - issue about it. + ocaml_version, context_name and arch_sixtyfour variables are allowed in this + 'enabled_if' field. If you think that project_root should also be allowed, + please file an issue about it. [1] diff --git a/test/blackbox-tests/test-cases/enabled_if/eif-install-forbidden_var.t/run.t b/test/blackbox-tests/test-cases/enabled_if/eif-install-forbidden_var.t/run.t index a3c62dc62bb5..c075f3a6e46c 100644 --- a/test/blackbox-tests/test-cases/enabled_if/eif-install-forbidden_var.t/run.t +++ b/test/blackbox-tests/test-cases/enabled_if/eif-install-forbidden_var.t/run.t @@ -4,7 +4,7 @@ Tests for enabled_if in install stanza using forbidden variable. 6 | (enabled_if (= %{project_root} "")) ^^^^^^^^^^^^^^^ Error: Only architecture, system, model, os_type, ccomp_type, profile, - ocaml_version and context_name variables are allowed in this 'enabled_if' - field. If you think that project_root should also be allowed, please file an - issue about it. + ocaml_version, context_name and arch_sixtyfour variables are allowed in this + 'enabled_if' field. If you think that project_root should also be allowed, + please file an issue about it. [1]