diff --git a/dune-project b/dune-project index f07cb1e42518..24a49004ea78 100644 --- a/dune-project +++ b/dune-project @@ -2,6 +2,7 @@ (name dune) (implicit_transitive_deps false) +(generate_opam_files true) (license MIT) (maintainers "Jane Street Group, LLC ") diff --git a/src/dune_project.ml b/src/dune_project.ml index 77ac0a46c29e..3a55fa5d5d1a 100644 --- a/src/dune_project.ml +++ b/src/dune_project.ml @@ -537,7 +537,7 @@ let anonymous = lazy ( ; parsing_context ; dune_version = lang.version ; allow_approx_merlin = true - ; generate_opam_files = true + ; generate_opam_files = false }) let default_name ~dir ~packages = @@ -672,7 +672,7 @@ in your project.") in let allow_approx_merlin = Option.value ~default:false allow_approx_merlin in - let generate_opam_files = Option.value ~default:true generate_opam_files in + let generate_opam_files = Option.value ~default:false generate_opam_files in { name ; root = dir ; version diff --git a/src/install_rules.ml b/src/install_rules.ml index 53b915c32579..cd6d49290f19 100644 --- a/src/install_rules.ml +++ b/src/install_rules.ml @@ -303,12 +303,13 @@ let install_file sctx (package : Local_package.t) entries = :: docs in let files = - let project = Local_package.project package in - if Dune_project.generate_opam_files project then + let package = Local_package.package package in + match package.kind with + | Dune false -> files + | Dune true + | Opam -> (None, Install.Entry.make Lib opam_file ~dst:"opam") :: files - else - files in local_install_rules sctx ~package:package_name ~install_paths files |> List.rev_append entries diff --git a/test/blackbox-tests/test-cases/dune-project-meta/bad-opam-file/dune-project b/test/blackbox-tests/test-cases/dune-project-meta/bad-opam-file/dune-project index 1535317c0e68..d2a7e4f51249 100644 --- a/test/blackbox-tests/test-cases/dune-project-meta/bad-opam-file/dune-project +++ b/test/blackbox-tests/test-cases/dune-project-meta/bad-opam-file/dune-project @@ -4,6 +4,8 @@ (license ISC) (authors "Anil Madhavapeddy" "Rudi Grinberg") +(generate_opam_files true) + (package (name cohttp) (synopsis "An OCaml library for HTTP clients and servers") diff --git a/test/blackbox-tests/test-cases/dune-project-meta/test-fields/dune-project b/test/blackbox-tests/test-cases/dune-project-meta/test-fields/dune-project index e228c7b8e24a..d876ea2a651f 100644 --- a/test/blackbox-tests/test-cases/dune-project-meta/test-fields/dune-project +++ b/test/blackbox-tests/test-cases/dune-project-meta/test-fields/dune-project @@ -4,6 +4,8 @@ (license ISC) (authors "Anil Madhavapeddy" "Rudi Grinberg") +(generate_opam_files true) + (package (name cohttp) (synopsis "An OCaml library for HTTP clients and servers")