This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
Fatal error with opam file that is not listed in the dune-project file:
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 1.10)
|
||||
> (version 1.0.0)
|
||||
> (package (name bar))
|
||||
> EOF
|
||||
|
||||
$ echo "cannot parse me" > foo.opam
|
||||
$ dune build @install
|
||||
File "foo.opam", line 1, characters 0-0:
|
||||
Error: This opam file doesn't have a corresponding (package ...) stanza in
|
||||
the dune-project file. Since you have at least one other (package ...) stanza
|
||||
in your dune-project file, you must a (package ...) stanza for each opam
|
||||
package in your project.
|
||||
[1]
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
Simple test
|
||||
-----------
|
||||
|
||||
The `dune build` should generate the opam file
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 1.10)
|
||||
> (version 1.0.0)
|
||||
> (name cohttp)
|
||||
> (source (github mirage/ocaml-cohttp))
|
||||
> (license ISC)
|
||||
> (authors "Anil Madhavapeddy" "Rudi Grinberg")
|
||||
>
|
||||
> (generate_opam_files true)
|
||||
>
|
||||
> (package
|
||||
> (name cohttp)
|
||||
> (synopsis "An OCaml library for HTTP clients and servers")
|
||||
> (description "A longer description")
|
||||
> (depends
|
||||
> (alcotest :with-test)
|
||||
> (dune (and :build (> 1.5)))
|
||||
> (foo (and :dev (> 1.5) (< 2.0)))
|
||||
> (uri (>= 1.9.0))
|
||||
> (uri (< 2.0.0))
|
||||
> (fieldslib (> v0.12))
|
||||
> (fieldslib (< v0.13))))
|
||||
>
|
||||
> (package
|
||||
> (name cohttp-async)
|
||||
> (synopsis "HTTP client and server for the Async library")
|
||||
> (description "\
|
||||
> A really long multi line description that spans across lines to
|
||||
> make sure that the rendering of long strings stays compatible.
|
||||
> ")
|
||||
> (depends
|
||||
> (cohttp (>= 1.0.2))
|
||||
> (conduit-async (>= 1.0.3))
|
||||
> (async (>= v0.10.0))
|
||||
> (async (< v0.12))))
|
||||
>
|
||||
> (package
|
||||
> (name cohttp-lwt)
|
||||
> (synopsis "HTTP client and server for the Lwt library")
|
||||
> (description "
|
||||
> A really long description that is supposed to start with a
|
||||
> newline since it doesn't escape the line break.
|
||||
> ")
|
||||
> (depends
|
||||
> (cohttp (>= 1.0.2))
|
||||
> (conduit-lwt (>= 1.0.3))
|
||||
> (lwt (>= 5.0.0))
|
||||
> (lwt (< 6.0.0))))
|
||||
> EOF
|
||||
|
||||
$ dune build @install
|
||||
|
||||
$ cat cohttp.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
build: [
|
||||
["dune" "subst"] {pinned}
|
||||
["dune" "build" "-p" name "-j" jobs]
|
||||
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
||||
["dune" "build" "-p" name "@doc"] {with-doc}
|
||||
]
|
||||
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
|
||||
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
|
||||
homepage: "https://github.com/mirage/ocaml-cohttp"
|
||||
license: "ISC"
|
||||
version: "1.0.0"
|
||||
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
|
||||
synopsis: "An OCaml library for HTTP clients and servers"
|
||||
description: "A longer description"
|
||||
depends: [
|
||||
"alcotest" {with-test}
|
||||
"dune" {build & > "1.5"}
|
||||
"foo" {dev & > "1.5" & < "2.0"}
|
||||
"uri" {>= "1.9.0"}
|
||||
"uri" {< "2.0.0"}
|
||||
"fieldslib" {> "v0.12"}
|
||||
"fieldslib" {< "v0.13"}
|
||||
]
|
||||
|
||||
$ cat cohttp-async.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
build: [
|
||||
["dune" "subst"] {pinned}
|
||||
["dune" "build" "-p" name "-j" jobs]
|
||||
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
||||
["dune" "build" "-p" name "@doc"] {with-doc}
|
||||
]
|
||||
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
|
||||
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
|
||||
homepage: "https://github.com/mirage/ocaml-cohttp"
|
||||
license: "ISC"
|
||||
version: "1.0.0"
|
||||
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
|
||||
synopsis: "HTTP client and server for the Async library"
|
||||
description: """
|
||||
A really long multi line description that spans across lines to
|
||||
make sure that the rendering of long strings stays compatible.
|
||||
"""
|
||||
depends: [
|
||||
"cohttp" {>= "1.0.2"}
|
||||
"conduit-async" {>= "1.0.3"}
|
||||
"async" {>= "v0.10.0"}
|
||||
"async" {< "v0.12"}
|
||||
]
|
||||
|
||||
$ cat cohttp-lwt.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
build: [
|
||||
["dune" "subst"] {pinned}
|
||||
["dune" "build" "-p" name "-j" jobs]
|
||||
["dune" "runtest" "-p" name "-j" jobs] {with-test}
|
||||
["dune" "build" "-p" name "@doc"] {with-doc}
|
||||
]
|
||||
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
|
||||
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
|
||||
homepage: "https://github.com/mirage/ocaml-cohttp"
|
||||
license: "ISC"
|
||||
version: "1.0.0"
|
||||
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
|
||||
synopsis: "HTTP client and server for the Lwt library"
|
||||
description: """
|
||||
|
||||
A really long description that is supposed to start with a
|
||||
newline since it doesn't escape the line break.
|
||||
"""
|
||||
depends: [
|
||||
"cohttp" {>= "1.0.2"}
|
||||
"conduit-lwt" {>= "1.0.3"}
|
||||
"lwt" {>= "5.0.0"}
|
||||
"lwt" {< "6.0.0"}
|
||||
]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(cram
|
||||
(applies_to version)
|
||||
(deps ../git-helpers.sh))
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
Version constraint on dune deps
|
||||
-------------------------------
|
||||
|
||||
Without the dune dependency declared in the dune-project file, we
|
||||
generate a dune dependency with a constraint:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.1)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A2 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.1"}
|
||||
]
|
||||
|
||||
With the dune dependency declared in the dune-project file and version
|
||||
of the language < 2.6 we don't add the constraint:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.5)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends dune))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep ^depends: foo.opam
|
||||
depends: ["dune"]
|
||||
|
||||
Same with version of the language >= 2.6, we now add the constraint:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.6)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends dune))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A2 ^depends: foo.opam
|
||||
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}
|
||||
]
|
||||
]
|
||||
|
||||
When the version of the language >= 2.7, odoc is automatically added to
|
||||
the doc dependencies:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A3 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A4 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"something"
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends odoc something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A4 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"odoc"
|
||||
"something"
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends (odoc :with-doc) something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A4 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"odoc" {with-doc}
|
||||
"something"
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends (odoc (and :with-doc (>= 1.5.0))) something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A4 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"odoc" {with-doc & >= "1.5.0"}
|
||||
"something"
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.7)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends (odoc :with-test) something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A5 ^depends: foo.opam
|
||||
depends: [
|
||||
"dune" {>= "2.7"}
|
||||
"odoc" {with-test}
|
||||
"something"
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.9)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A16 ^build: foo.opam
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"--promote-install-files=false"
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
["dune" "install" "-p" name "--create-install-files" name]
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.0)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (subst disabled)
|
||||
> (package (name foo) (depends (odoc :with-test) something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A15 ^build: foo.opam
|
||||
build: [
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.0)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (subst enabled)
|
||||
> (package (name foo) (depends (odoc :with-test) something))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.opam
|
||||
$ grep -A16 ^build: foo.opam
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Building the .install file should not depend on foo.opam being present in the
|
||||
source tree if (generate_opam_files true) is enabled.
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 3.8)
|
||||
> (package
|
||||
> (name foo))
|
||||
> (generate_opam_files true)
|
||||
> EOF
|
||||
|
||||
$ cat >dune <<EOF
|
||||
> (install
|
||||
> (section share)
|
||||
> (files dune))
|
||||
> EOF
|
||||
|
||||
$ dune build foo.install
|
||||
$ grep opam _build/default/foo.install
|
||||
"_build/install/default/lib/foo/opam"
|
||||
|
||||
$ dune build @check
|
||||
$ dune build foo.install
|
||||
$ grep opam _build/default/foo.install
|
||||
"_build/install/default/lib/foo/opam"
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
Generation of opam files is attached to @all
|
||||
--------------------------------------------
|
||||
Reproduction case for #2927
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 2.0)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
|
||||
$ cat foo.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
depends: [
|
||||
"dune" {>= "2.0"}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {pinned}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
Reject multiple licences in version [1.9, 3.2)
|
||||
----------------------------------------------
|
||||
|
||||
$ mkdir multi-licence-v1.9
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 1.9)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (license MIT ISC)
|
||||
> (package (name foo) (allow_empty))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
File "dune-project", line 4, characters 0-17:
|
||||
4 | (license MIT ISC)
|
||||
^^^^^^^^^^^^^^^^^
|
||||
Error: Parsing several licenses is only available since version 3.2 of the
|
||||
dune language. Please update your dune-project file to have (lang dune 3.2).
|
||||
[1]
|
||||
|
||||
Allow multiple licences in version >= 3.2
|
||||
-----------------------------------------
|
||||
|
||||
$ mkdir multi-license-v3.2
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.2)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (license MIT ISC)
|
||||
> (package (name foo) (allow_empty))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
$ grep "license:" foo.opam
|
||||
license: ["MIT" "ISC"]
|
||||
|
||||
Handle single license in version >= 3.2
|
||||
---------------------------------------
|
||||
|
||||
$ mkdir single-license-v3.2
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.2)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (license ISC)
|
||||
> (package (name foo) (allow_empty))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
$ grep "license:" foo.opam
|
||||
license: "ISC"
|
||||
|
||||
Reject empty license
|
||||
---------------------------------------
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.2)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (license)
|
||||
> (package (name foo) (allow_empty))
|
||||
> EOF
|
||||
|
||||
$ dune build
|
||||
File "dune-project", line 4, characters 0-9:
|
||||
4 | (license)
|
||||
^^^^^^^^^
|
||||
Error: Not enough arguments for "license"
|
||||
[1]
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
Using binary operators for dependencies
|
||||
---------------------------------------
|
||||
|
||||
Not supported before 2.1:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.0)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package
|
||||
> (name foo)
|
||||
> (depends (conf-libX11 (<> :os win32))))
|
||||
> EOF
|
||||
|
||||
$ dune build @install
|
||||
File "dune-project", line 6, characters 23-37:
|
||||
6 | (depends (conf-libX11 (<> :os win32))))
|
||||
^^^^^^^^^^^^^^
|
||||
Error: Passing two arguments to <> is only available since version 2.1 of the
|
||||
dune language. Please update your dune-project file to have (lang dune 2.1).
|
||||
[1]
|
||||
|
||||
Supported since 2.1:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.1)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package
|
||||
> (name foo)
|
||||
> (depends (conf-libX11 (<> :os win32))))
|
||||
> EOF
|
||||
|
||||
$ dune build @install
|
||||
$ grep conf-libX11 foo.opam
|
||||
"conf-libX11" {os != "win32"}
|
||||
|
||||
|
||||
Using negation operator for dependencies
|
||||
----------------------------------------
|
||||
|
||||
Not supported before 3.18:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.17)
|
||||
> (generate_opam_files)
|
||||
> (package
|
||||
> (name foo)
|
||||
> (allow_empty)
|
||||
> (depends
|
||||
> (ocp-indent
|
||||
> (not :with-test))))
|
||||
> EOF
|
||||
$ dune build
|
||||
File "dune-project", line 8, characters 4-20:
|
||||
8 | (not :with-test))))
|
||||
^^^^^^^^^^^^^^^^
|
||||
Error: Not operator is only available since version 3.18 of the dune
|
||||
language. Please update your dune-project file to have (lang dune 3.18).
|
||||
[1]
|
||||
|
||||
Supported since 3.18:
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 3.18)
|
||||
> (generate_opam_files)
|
||||
> (package
|
||||
> (name foo)
|
||||
> (allow_empty)
|
||||
> (depends
|
||||
> (ocp-indent
|
||||
> (not
|
||||
> (or
|
||||
> (and
|
||||
> (not :with-test)
|
||||
> (>= 1.0))
|
||||
> (not
|
||||
> (and
|
||||
> (not (= :os win32))
|
||||
> (not (>= 1.5)))))))
|
||||
> (not (>= 2.0))))
|
||||
> EOF
|
||||
$ dune build
|
||||
$ cat foo.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
depends: [
|
||||
"dune" {>= "3.18"}
|
||||
"ocp-indent" {!(!with-test & >= "1.0" | !(!os = "win32" & !>= "1.5"))}
|
||||
"not" {>= "2.0"}
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
x-maintenance-intent: ["(latest)"]
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
Package information fields can be overridden per-package:
|
||||
|
||||
$ cat >dune-project <<EOF
|
||||
> (lang dune 3.18)
|
||||
> (name foo)
|
||||
> (version 1.0.0)
|
||||
> (source (github mirage/ocaml-cohttp))
|
||||
> (license ISC)
|
||||
> (authors "Anil Madhavapeddy" "Rudi Grinberg")
|
||||
> (homepage https://my.home.page)
|
||||
> (maintenance_intent "(none)")
|
||||
> ;
|
||||
> (generate_opam_files true)
|
||||
> ;
|
||||
> (package
|
||||
> (name foo)
|
||||
> (version 1.0.1)
|
||||
> (source (github mirage/foo))
|
||||
> (license MIT)
|
||||
> (authors "Foo" "Bar")
|
||||
> (maintenance_intent "0.9" "1.0.1")
|
||||
> (allow_empty))
|
||||
> EOF
|
||||
|
||||
$ dune build @install
|
||||
|
||||
$ cat foo.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
version: "1.0.1"
|
||||
authors: ["Foo" "Bar"]
|
||||
license: "MIT"
|
||||
homepage: "https://my.home.page"
|
||||
bug-reports: "https://github.com/mirage/foo/issues"
|
||||
depends: [
|
||||
"dune" {>= "3.18"}
|
||||
"odoc" {with-doc}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {dev}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
dev-repo: "git+https://github.com/mirage/foo.git"
|
||||
x-maintenance-intent: ["0.9" "1.0.1"]
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
Templates
|
||||
---------
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 2.0)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo) (depends bar))
|
||||
> EOF
|
||||
|
||||
Test various fields in the template file. Fields coming from the
|
||||
template are always put at the end. Fields generated by Dune are
|
||||
sorted in a way that pleases "opam lint".
|
||||
|
||||
$ cat > foo.opam.template <<EOF
|
||||
> x-foo: "blah"
|
||||
> EOF
|
||||
$ dune build @install
|
||||
$ tail -n 1 foo.opam
|
||||
x-foo: "blah"
|
||||
|
||||
$ cat > foo.opam.template <<EOF
|
||||
> libraries: [ "blah" ]
|
||||
> EOF
|
||||
$ dune build @install
|
||||
$ tail -n 1 foo.opam
|
||||
libraries: [ "blah" ]
|
||||
|
||||
$ cat > foo.opam.template <<EOF
|
||||
> depends: [ "overridden" ]
|
||||
> EOF
|
||||
$ dune build @install
|
||||
$ tail -n 1 foo.opam
|
||||
depends: [ "overridden" ]
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
Generation of opam files with lang dune >= 1.11
|
||||
-----------------------------------------------
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 1.11)
|
||||
> (name test)
|
||||
> (generate_opam_files true)
|
||||
> (package (name test))
|
||||
> EOF
|
||||
|
||||
$ dune build @install
|
||||
$ cat test.opam
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
depends: [
|
||||
"dune" {>= "1.11"}
|
||||
]
|
||||
build: [
|
||||
["dune" "subst"] {pinned}
|
||||
[
|
||||
"dune"
|
||||
"build"
|
||||
"-p"
|
||||
name
|
||||
"-j"
|
||||
jobs
|
||||
"@install"
|
||||
"@runtest" {with-test}
|
||||
"@doc" {with-doc}
|
||||
]
|
||||
]
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
$ . ../git-helpers.sh
|
||||
|
||||
Version generated in opam and META files
|
||||
----------------------------------------
|
||||
|
||||
After calling `dune subst`, dune should embed the version inside the
|
||||
generated META and opam files.
|
||||
|
||||
### With opam files and no package stanzas
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 1.10)
|
||||
> (name foo)
|
||||
> EOF
|
||||
|
||||
$ cat > foo.opam <<EOF
|
||||
> EOF
|
||||
|
||||
$ cat > dune <<EOF
|
||||
> (library (public_name foo))
|
||||
> EOF
|
||||
|
||||
$ (git init -q
|
||||
> git add .
|
||||
> git commit -qm _
|
||||
> git tag -a 1.0 -m 1.0
|
||||
> dune subst)
|
||||
|
||||
$ dune build foo.opam META.foo
|
||||
|
||||
$ grep ^version foo.opam
|
||||
version: "1.0"
|
||||
|
||||
$ grep ^version _build/default/META.foo
|
||||
version = "1.0"
|
||||
|
||||
With package stanzas and generating the opam files
|
||||
|
||||
$ cat > dune-project <<EOF
|
||||
> (lang dune 1.10)
|
||||
> (name foo)
|
||||
> (generate_opam_files true)
|
||||
> (package (name foo))
|
||||
> EOF
|
||||
|
||||
$ (git tag -d 1.0 >/dev/null
|
||||
> git add .
|
||||
> git commit -qm _
|
||||
> git tag -a 1.0 -m 1.0
|
||||
> dune subst)
|
||||
|
||||
$ dune build foo.opam META.foo
|
||||
|
||||
$ grep ^version foo.opam
|
||||
version: "1.0"
|
||||
|
||||
$ grep ^version _build/default/META.foo
|
||||
version = "1.0"
|
||||
Loading…
Add table
Add a link
Reference in a new issue