-
Notifications
You must be signed in to change notification settings - Fork 413
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
feature(coq): coq_version variable #5913
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
open Import | ||
open Memo.O | ||
|
||
let impl bin = | ||
let* _ = Build_system.build_file bin in | ||
let+ line = | ||
Memo.of_non_reproducible_fiber | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that even within a single run we will re-exec? All Coq config is deterministic, just set a Coq configure time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And guarantee to change only if the hash changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should only run once since it is memoed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is memoed as non reproducible tho. |
||
@@ Process.run_capture_line Process.Strict bin [ "--print-version" ] | ||
in | ||
match String.lsplit2 ~on:' ' line with | ||
| Some (coq, _ocaml) -> Some coq | ||
| None -> None | ||
|
||
let memo = Memo.create "coq-version" ~input:(module Path) impl | ||
|
||
let version ~bin = Memo.exec memo bin |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
open Import | ||
|
||
val version : bin:Path.t -> string option Memo.t |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
$ cat >dune-project <<EOF | ||
> (lang dune 3.4) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (rule | ||
> (action (with-stdout-to file (echo "8.15.2"))) | ||
> (enabled_if (= %{coq_version} "8.15.2"))) | ||
> (rule | ||
> (action (with-stdout-to file (echo "8.15.1"))) | ||
> (enabled_if (= %{coq_version} "8.15.1"))) | ||
> EOF | ||
|
||
$ dune build ./file | ||
|
||
$ cat _build/default/file | ||
8.15.2 | ||
|
||
(>= 8.15.0-x12gn1 8.15.1) => false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let () = print_endline "1.2.3 x_x_x" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(executable | ||
(libraries axsxasdsdads) | ||
(public_name coqc)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(lang dune 3.4) | ||
|
||
(package | ||
(name foo)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
# $ cat >dune <<EOF | ||
# > (rule | ||
# > (action (with-stdout-to file (echo %{coq_version})))) | ||
# > EOF | ||
# | ||
# $ dune build ./file | ||
# $ cat _build/default/file | ||
|
||
$ mkdir sub | ||
$ cat >sub/dune <<EOF | ||
> (rule | ||
> (enabled_if (>= %{coq_version} 8.15)) | ||
> (action (with-stdout-to file (echo 123)))) | ||
> EOF | ||
|
||
$ cat >dune <<EOF | ||
> (rule | ||
> (action (with-stdout-to alwayspresent (echo 123)))) | ||
> EOF | ||
|
||
$ dune build ./alwayspresent | ||
|
||
(coq.theory | ||
(name foo) | ||
(native_theories mathcomp) | ||
(theories mathcomp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we could add a parameter to this to have a
%{coq:var}
form, WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ejgallego I am currently working on a
coq-config
macro that will subsume all of this