Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow libraries to be enabled/disabled based on the build profile #3344

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Unreleased
- Fix a bug preventing one from running inline tests in multiple modes
(#3352, @diml)

- Allow the use of the `%{profile}` variable in the `enabled_if` field of the
library stanza.
(#3344, @mrmr1993)

2.4.0 (06/03/2020)
------------------

Expand Down
1 change: 1 addition & 0 deletions src/dune/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ let create ~(kind : Kind.t) ~path ~env ~env_nodes ~name ~merlin ~targets
Dynlink_supported.By_the_os.of_bool natdynlink_supported
; stdlib_dir
; ccomp_type = Ocaml_config.ccomp_type ocfg
; profile = Profile.to_string profile
}
in
if Option.is_some fdo_target_exe then
Expand Down
3 changes: 3 additions & 0 deletions src/dune/lib_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type t =
; ext_dll : string
; stdlib_dir : Path.t
; ccomp_type : Ocaml_config.Ccomp_type.t
; profile : string
}

let var_map =
Expand All @@ -20,12 +21,14 @@ let var_map =
; ("model", fun t -> t.model)
; ("os_type", fun t -> Ocaml_config.Os_type.to_string t.os_type)
; ("ccomp_type", fun t -> Ocaml_config.Ccomp_type.to_string t.ccomp_type)
; ("profile", fun t -> t.profile)
]

let allowed_in_enabled_if =
List.map var_map ~f:(fun (var, _) ->
let min_version =
match var with
| "profile" -> (2, 5)
| "ccomp_type" -> (2, 0)
| _ -> (1, 0)
in
Expand Down
1 change: 1 addition & 0 deletions src/dune/lib_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type t =
; ext_dll : string
; stdlib_dir : Path.t
; ccomp_type : Ocaml_config.Ccomp_type.t
; profile : string
}

val allowed_in_enabled_if : (string * Dune_lang.Syntax.Version.t) list
Expand Down
1 change: 1 addition & 0 deletions test/expect-tests/findlib_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let findlib =
; ext_dll = ".so"
; stdlib_dir = Path.root
; ccomp_type = Other "gcc"
; profile = "dev"
}
in
Findlib.create ~stdlib_dir:cwd ~paths:[ db_path ]
Expand Down