Skip to content

Commit

Permalink
test: rename may_be_empty to allow_empty
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed Nov 8, 2021
1 parent c553624 commit 1314577
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion otherlibs/build-info/test/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Test embedding of build information
$ dune build
Warning: The package d does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
$ dune install --prefix _install 2> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion otherlibs/site/test/bug_4219.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Test when sites name which are ocaml keyword
$ dune build
Warning: The package my-package does not have any user defined stanzas
attached to it. If this is intentional, add (may_be_empty) to the package
attached to it. If this is intentional, add (allow_empty) to the package
definition in the dune-project file
6 changes: 3 additions & 3 deletions otherlibs/site/test/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Test %{version:installed-pkg}
$ OCAMLPATH=_install/lib:$OCAMLPATH dune build --root=f
Entering directory 'f'
Warning: The package f does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
$ cat $(pwd)/f/_build/default/test.target
a = 0.a
Expand All @@ -409,7 +409,7 @@ Test %{version:installed-pkg}
$ OCAMLPATH=_install/lib:$OCAMLPATH dune build --root=f
Entering directory 'f'
Warning: The package f does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
File "dune", line 6, characters 15-32:
6 | (echo "a = %{version:a.test}\n")
Expand Down Expand Up @@ -446,7 +446,7 @@ Test error location
$ dune build -j1
Warning: The package f does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
File "a/dune", line 4, characters 45-57:
4 | (generate_sites_module (module sites) (sites non-existent))
Expand Down
20 changes: 10 additions & 10 deletions src/dune_engine/package.ml
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ type t =
; tags : string list
; deprecated_package_names : Loc.t Name.Map.t
; sites : Section.t Section.Site.Map.t
; may_be_empty : bool
; allow_empty : bool
}

(* Package name are globally unique, so we can reasonably expect that there will
Expand All @@ -581,7 +581,7 @@ let encode (name : Name.t)
; tags
; deprecated_package_names
; sites
; may_be_empty
; allow_empty
} =
let open Dune_lang.Encoder in
let fields =
Expand All @@ -600,7 +600,7 @@ let encode (name : Name.t)
; field_l "sits"
(pair Section.Site.encode Section.encode)
(Section.Site.Map.to_list sites)
; field_b "may_be_empty" may_be_empty
; field_b "allow_empty" allow_empty
]
in
list sexp (string "package" :: fields)
Expand Down Expand Up @@ -641,8 +641,8 @@ let decode ~dir =
Section.Site.Map.of_list_map Section.Site.to_string "sites"
(pair Section.decode Section.Site.decode)
Section.to_string "Site location name"
and+ may_be_empty =
field_b "may_be_empty"
and+ allow_empty =
field_b "allow_empty"
~check:(Dune_lang.Syntax.since Stanza.syntax (3, 0))
in
let id = { Id.name; dir } in
Expand All @@ -659,7 +659,7 @@ let decode ~dir =
; tags
; deprecated_package_names
; sites
; may_be_empty
; allow_empty
}

let to_dyn
Expand All @@ -676,7 +676,7 @@ let to_dyn
; loc = _
; deprecated_package_names
; sites
; may_be_empty
; allow_empty
} =
let open Dyn.Encoder in
record
Expand All @@ -693,7 +693,7 @@ let to_dyn
; ( "deprecated_package_names"
, Name.Map.to_dyn Loc.to_dyn_hum deprecated_package_names )
; ("sites", Section.Site.Map.to_dyn Section.to_dyn sites)
; ("may_be_empty", Bool may_be_empty)
; ("allow_empty", Bool allow_empty)
]

let opam_file t = Path.Source.relative t.id.dir (Name.opam_fn t.id.name)
Expand Down Expand Up @@ -725,7 +725,7 @@ let default name dir =
; tags = [ "topics"; "to describe"; "your"; "project" ]
; deprecated_package_names = Name.Map.empty
; sites = Section.Site.Map.empty
; may_be_empty = false
; allow_empty = false
}

let load_opam_file file name =
Expand Down Expand Up @@ -790,7 +790,7 @@ let load_opam_file file name =
; tags = Option.value (get_many "tags") ~default:[]
; deprecated_package_names = Name.Map.empty
; sites = Section.Site.Map.empty
; may_be_empty = false
; allow_empty = false
}

let equal = Poly.equal
Expand Down
2 changes: 1 addition & 1 deletion src/dune_engine/package.mli
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ type t =
; tags : string list
; deprecated_package_names : Loc.t Name.Map.t
; sites : Section.t Section.Site.Map.t
; may_be_empty : bool
; allow_empty : bool
}

val equal : t -> t -> bool
Expand Down
6 changes: 3 additions & 3 deletions src/dune_rules/install_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ let install_rules sctx (package : Package.t) =
List.map entries
~f:(Install.Entry.add_install_prefix ~paths:install_paths ~prefix)
in
(if not package.may_be_empty then
(if not package.allow_empty then
if
List.for_all entries_with_metadata
~f:(fun (e : Install.Entry.Sourced.t) ->
Expand All @@ -901,8 +901,8 @@ let install_rules sctx (package : Package.t) =
User_warning.emit ~is_error
[ Pp.textf
"The package %s does not have any user defined stanzas \
attached to it. If this is intentional, add (may_be_empty) \
to the package definition in the dune-project file"
attached to it. If this is intentional, add (allow_empty) to \
the package definition in the dune-project file"
(Package.Name.to_string package_name)
]);
Install.gen_install_file entries)
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/opam_create.ml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ let package_fields
; loc = _
; deprecated_package_names = _
; sites = _
; may_be_empty = _
; allow_empty = _
} ~project =
let open Opam_file.Create in
let tags =
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/bin-eager-deps.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ when the rule needs to be used to build a target.
> EOF
$ dune build @install
Warning: The package randompackage does not have any user defined stanzas
attached to it. If this is intentional, add (may_be_empty) to the package
attached to it. If this is intentional, add (allow_empty) to the package
definition in the dune-project file
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/custom-build-dir.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Test with a build directory that doesn't start with _
$ dune build --build-dir build pkg.opam
$ dune build --build-dir build
Warning: The package pkg does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tests that the "old_public_name" field is evaluated lazily
> dune build @install --root .
> dune install --prefix $PWD/../_install)
Warning: The package a does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
Installing $TESTCASE_ROOT/a/../_install/lib/a/META
Installing $TESTCASE_ROOT/a/../_install/lib/a/dune-package
Expand Down Expand Up @@ -207,7 +207,7 @@ Checks that we can migrate top-level libraries across packages.
$ (cd d && dune build --root . @install)
Warning: The package p does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
$ dune_cmd cat d/_build/install/default/lib/top1/META
Expand All @@ -229,7 +229,7 @@ old public name:
$ (cd d && dune build --root . @all)
Warning: The package p does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
$ dune_cmd cat d/_build/install/default/lib/top2/META
Expand Down Expand Up @@ -407,5 +407,5 @@ across projects.
$ (cd d/p && dune build --root . @all)
Warning: The package b does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/dune-init.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Can build the multiple library project but fails because empty
$ echo '(lang dune 3.0)' > ./_test_lib/dune-project
$ (cd _test_lib && touch test_lib1.opam && dune build)
Error: The package test_lib1 does not have any user defined stanzas attached
to it. If this is intentional, add (may_be_empty) to the package definition
to it. If this is intentional, add (allow_empty) to the package definition
in the dune-project file
-> required by _build/default/test_lib1.install
-> required by alias all
Expand All @@ -189,7 +189,7 @@ Can build the multiple library project but fails because empty
Can build the multiple library project
$ echo '(package (name test_lib1) (may_be_empty))' >> ./_test_lib/dune-project
$ echo '(package (name test_lib1) (allow_empty))' >> ./_test_lib/dune-project
$ (cd _test_lib && dune build)
Clan up the multiple library project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Reproduction case for #2927
$ dune build
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ cat foo.opam
Expand Down
16 changes: 8 additions & 8 deletions test/blackbox-tests/test-cases/dune-project-meta/main.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ The `dune build` should generate the opam file
$ dune build @install --root test1
Entering directory 'test1'
Warning: The package cohttp does not have any user defined stanzas attached
to it. If this is intentional, add (may_be_empty) to the package definition
to it. If this is intentional, add (allow_empty) to the package definition
in the dune-project file
Warning: The package cohttp-async does not have any user defined stanzas
attached to it. If this is intentional, add (may_be_empty) to the package
attached to it. If this is intentional, add (allow_empty) to the package
definition in the dune-project file
$ cat test1/cohttp.opam
Expand Down Expand Up @@ -138,7 +138,7 @@ Package information fields can be overridden per-package:
$ dune build @install --root test2
Entering directory 'test2'
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ cat test2/foo.opam
Expand Down Expand Up @@ -255,7 +255,7 @@ Generation of opam files with lang dune >= 1.11
$ dune build @install --root gen-v1.11
Entering directory 'gen-v1.11'
Warning: The package test does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ cat gen-v1.11/test.opam
# This file is generated by dune, edit dune-project instead
Expand Down Expand Up @@ -300,7 +300,7 @@ sorted in a way that pleases "opam lint".
$ dune build @install --root template
Entering directory 'template'
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ tail -n 1 template/foo.opam
x-foo: "blah"
Expand All @@ -311,7 +311,7 @@ sorted in a way that pleases "opam lint".
$ dune build @install --root template
Entering directory 'template'
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ tail -n 1 template/foo.opam
libraries: [ "blah" ]
Expand All @@ -322,7 +322,7 @@ sorted in a way that pleases "opam lint".
$ dune build @install --root template
Entering directory 'template'
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ tail -n 1 template/foo.opam
depends: [ "overridden" ]
Expand Down Expand Up @@ -366,7 +366,7 @@ Supported since 2.1:
$ dune build @install --root binops
Entering directory 'binops'
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ grep conf-libX11 binops/foo.opam
"conf-libX11" {os != "win32"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Dune doesn't need opam anymore
$ dune build @install
Warning: The package bar does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/enabled_if-exec.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This one is enabled
Installing should silently ignore disabled executables
$ dune build @install
Warning: The package eif does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
Tests for enabled_if in install stanza. Only bar.x should be installed.
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github24.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ This test makes sure that @install doesn't build anything.
$ dune build @install --display short --debug-dependency-path
Warning: The package x does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github4821.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Ensure that a public, non-optional library can be disabled.
$ dune build @install;
> cat _build/install/default/lib/foo/dune-package;
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
(lang dune 3.0)
(name foo)
Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/github992.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ context to the menhir files when package bar was hidden.
$ (cd menhir-and-dash-p && dune build -p foo)
Warning: The package foo does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
package field without public_name field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Dune does not fail if the `packages` are not available at evaluation time

$ dune build -p unrelated-package
Warning: The package unrelated-package does not have any user defined stanzas
attached to it. If this is intentional, add (may_be_empty) to the package
attached to it. If this is intentional, add (allow_empty) to the package
definition in the dune-project file

Dune fails if the `packages` are not available at execution time
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/misc.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Allowed combinations
$ dune build --release --only-packages toto
Warning: The package toto does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
$ dune build --release --only-packages toto --profile foo
Warning: The package toto does not have any user defined stanzas attached to
it. If this is intentional, add (may_be_empty) to the package definition in
it. If this is intentional, add (allow_empty) to the package definition in
the dune-project file
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Odig files should be detected relative to the package directory
$ dune build @install --root .
Warning: The package foobar does not have any user defined stanzas attached
to it. If this is intentional, add (may_be_empty) to the package definition
to it. If this is intentional, add (allow_empty) to the package definition
in the dune-project file
$ dune_cmd cat _build/default/project/foobar.install
lib: [
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/optional-executable.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ Test optional executable
$ dune build @install
Warning: The package x does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
$ dune build @all
Warning: The package x does not have any user defined stanzas attached to it.
If this is intentional, add (may_be_empty) to the package definition in the
If this is intentional, add (allow_empty) to the package definition in the
dune-project file
File "dune", line 3, characters 12-26:
3 | (libraries does-not-exist)
Expand Down

0 comments on commit 1314577

Please sign in to comment.