Skip to content

Commit

Permalink
Opam file generation: Use {dev} instead of {pinned} when calling dune…
Browse files Browse the repository at this point in the history
… subst

Signed-off-by: Kate <kit.ty.kate@disroot.org>
  • Loading branch information
kit-ty-kate committed Jul 23, 2020
1 parent fff4be1 commit 4bc629a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/dune/opam_create.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let default_build_command =
[ "dune" "build" "-p" name "@doc"] {with-doc}
]
|}))
and from_1_11 =
and from_1_11_before_2_07 =
lazy
(Opam_file.parse_value
(Lexbuf.from_string ~fname:"<internal>"
Expand All @@ -26,14 +26,30 @@ let default_build_command =
"@doc" {with-doc}
]
]
|}))
and from_2_07 =
lazy
(Opam_file.parse_value
(Lexbuf.from_string ~fname:"<internal>"
{|
[
[ "dune" "subst" ] {dev}
[ "dune" "build" "-p" name "-j" jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
|}))
in
fun project ->
Lazy.force
( if Dune_project.dune_version project < (1, 11) then
before_1_11
else
from_1_11 )
before_1_11
else if Dune_project.dune_version project < (2, 7) then
from_1_11_before_2_07
else
from_2_07 )

let package_fields
{ Package.synopsis
Expand Down
27 changes: 27 additions & 0 deletions test/blackbox-tests/test-cases/dune-project-meta/main/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,30 @@ Same with version of the language >= 2.6, we now add the constraint:
depends: [
"dune" {>= "2.6"}
]

When the version of the language >= 2.7 we use dev instead of pinned
when calling dune subst:

$ cat > dune-project <<EOF
> (lang dune 2.7)
> (name foo)
> (generate_opam_files true)
> (package (name foo))
> EOF

$ dune build foo.opam
$ grep -A13 ^build: foo.opam
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]

0 comments on commit 4bc629a

Please sign in to comment.