Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,22 @@ jobs:
os: ubuntu-latest
# OCaml 5:
## ubuntu (x86)
- ocaml-compiler: 5.3.x
- ocaml-compiler: 5.4.x
os: ubuntu-latest
run_tests: true
## macos (Apple Silicon)
- ocaml-compiler: 5.3.x
- ocaml-compiler: 5.4.x
os: macos-latest
run_tests: true
## macos (x86)
- ocaml-compiler: 5.4.x
os: macos-15-intel
## MSVC
- ocaml-compiler: ocaml-compiler.5.3.0,system-msvc
- ocaml-compiler: ocaml-compiler.5.4.0,system-msvc
os: windows-latest
run_tests: true
## mingw
- ocaml-compiler: ocaml-base-compiler.5.3.0,system-mingw
- ocaml-compiler: ocaml-base-compiler.5.4.0,system-mingw
os: windows-latest
run_tests: true
# OCaml 4:
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DEV_DEPS := \
core_bench \
patdiff

TEST_OCAMLVERSION := 5.3.0
TEST_OCAMLVERSION := 5.4.0
# When updating this version, don't forget to also bump the number in the docs.

-include Makefile.dev
Expand Down Expand Up @@ -109,9 +109,6 @@ test-melange: $(BIN)
test-all: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-coq @runtest-melange

test-all-sans-melange: $(BIN)
$(BIN) build @runtest @runtest-js @runtest-coq

test-ox: $(BIN)
$(BIN) runtest test/blackbox-tests/test-cases/oxcaml

Expand Down
4 changes: 2 additions & 2 deletions doc/hacking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ Here are the most common commands you'll be running:
$ ./dune.exe build @foo


Note that tests are currently written for version 5.3.0 of the OCaml compiler.
Note that tests are currently written for version 5.4.0 of the OCaml compiler.
Some tests depend on the specific wording of compilation errors which can change
between compiler versions, so to reliably run the tests make sure that
``ocaml.5.3.0`` is installed. The ``TEST_OCAMLVERSION`` in the ``Makefile`` at
``ocaml.5.4.0`` is installed. The ``TEST_OCAMLVERSION`` in the ``Makefile`` at
the root of the Dune repo contains the current compiler version for which tests
are written.

Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/developing-with-dune/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Let's create a local switch: `cd` to this directory and run the following comman
This can take a few minutes.

```sh
opam switch create ./ 5.3.0
opam switch create ./ 5.4.0
```

This command has created a directory named `_opam` in the current directory.
Expand Down
2 changes: 1 addition & 1 deletion dune.opam
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ depends: [
"ppx_expect" { with-dev-setup & >= "v0.17" & os != "win32" }
"spawn" { with-dev-setup }
"ppx_inline_test" { with-dev-setup & os != "win32" }
"ppxlib" { with-dev-setup & >= "0.35.0" & os != "win32" }
"ppxlib" { with-dev-setup & >= "0.37.0" & os != "win32" }
"ctypes" { with-dev-setup & os != "win32" }
"utop" { with-dev-setup & >= "2.6.0" & os != "win32" }
"melange" { with-dev-setup & >= "5.1.0-51" & os != "win32" }
Expand Down
2 changes: 1 addition & 1 deletion dune.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ depends: [
"ppx_expect" { with-dev-setup & >= "v0.17" & os != "win32" }
"spawn" { with-dev-setup }
"ppx_inline_test" { with-dev-setup & os != "win32" }
"ppxlib" { with-dev-setup & >= "0.35.0" & os != "win32" }
"ppxlib" { with-dev-setup & >= "0.37.0" & os != "win32" }
"ctypes" { with-dev-setup & os != "win32" }
"utop" { with-dev-setup & >= "2.6.0" & os != "win32" }
"melange" { with-dev-setup & >= "5.1.0-51" & os != "win32" }
Expand Down
56 changes: 37 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 26 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs-old.url = "github:nixos/nixpkgs/7f50d4b33363d3948543f6a02b90a2c66852a453";
flake-utils.url = "github:numtide/flake-utils";
melange = {
url = "github:melange-re/melange/refs/tags/5.1.0-53";
url = "github:melange-re/melange/refs/tags/6.0.0-54";
inputs.nixpkgs.follows = "nixpkgs";
};
ocaml-overlays = {
Expand All @@ -24,6 +25,7 @@
self,
flake-utils,
nixpkgs,
nixpkgs-old,
melange,
ocaml-overlays,
oxcaml,
Expand All @@ -35,7 +37,7 @@
pkgs = nixpkgs.legacyPackages.${system}.appendOverlays [
ocaml-overlays.overlays.default
(self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_3.overrideScope (
ocamlPackages = super.ocaml-ng.ocamlPackages_5_4.overrideScope (
oself: osuper: {
mdx = osuper.mdx.override {
logs = oself.logs;
Expand Down Expand Up @@ -63,8 +65,13 @@
oxcamlOpamRepo = oxcaml-opam-repository;
};

# Older nixpkgs for OCaml 4.02 support
pkgs-old = nixpkgs-old.legacyPackages.${system}.appendOverlays [
ocaml-overlays.overlays.default
];

dune-static-overlay = self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_3.overrideScope (
ocamlPackages = super.ocaml-ng.ocamlPackages_5_4.overrideScope (
oself: osuper: {
dune_3 = osuper.dune_3.overrideAttrs (a: {
src = ./.;
Expand All @@ -91,19 +98,16 @@

ocamlformat =
let
ocamlformat_version =
let
lists = pkgs.lib.lists;
strings = pkgs.lib.strings;
ocamlformat_config = strings.splitString "\n" (builtins.readFile ./.ocamlformat);
prefix = "version=";
ocamlformat_version_pred = line: strings.hasPrefix prefix line;
version_line = lists.findFirst ocamlformat_version_pred "not_found" ocamlformat_config;
version = strings.removePrefix prefix version_line;
in
builtins.replaceStrings [ "." ] [ "_" ] version;
lists = pkgs.lib.lists;
strings = pkgs.lib.strings;
ocamlformat_config = strings.splitString "\n" (builtins.readFile ./.ocamlformat);
prefix = "version=";
ocamlformat_version_pred = line: strings.hasPrefix prefix line;
version_line = lists.findFirst ocamlformat_version_pred "not_found" ocamlformat_config;
version_string = strings.removePrefix prefix version_line;
ocamlformat_attr = builtins.replaceStrings [ "." ] [ "_" ] version_string;
in
builtins.getAttr ("ocamlformat_" + ocamlformat_version) pkgs;
builtins.getAttr ("ocamlformat_" + ocamlformat_attr) nixpkgs.legacyPackages.${system};

testBuildInputs =
with pkgs;
Expand Down Expand Up @@ -287,11 +291,11 @@
fmt = pkgs.mkShell {
inherit INSIDE_NIX;
nativeBuildInputs = [ ocamlformat ];
# re shouldn't be needed. this is an issue with the fmt rules
inputsFrom = [
pkgs.dune_3
];
buildInputs = with pkgs.ocamlPackages; [
# These shouldn't be needed. this is an issue with the fmt rules
csexp
pp
re
Expand Down Expand Up @@ -355,9 +359,9 @@

bootstrap-check = pkgs.mkShell {
inherit INSIDE_NIX;
buildInputs = with pkgs; [
gnumake
ocaml-ng.ocamlPackages_4_02.ocaml
buildInputs = [
pkgs.gnumake
pkgs-old.ocaml-ng.ocamlPackages_4_02.ocaml
];
meta.description = ''
Provides a minimal shell environment with OCaml 4.02 in order
Expand All @@ -367,9 +371,9 @@

bootstrap-check_4_08 = pkgs.mkShell {
inherit INSIDE_NIX;
buildInputs = with pkgs; [
gnumake
ocaml-ng.ocamlPackages_4_08.ocaml
buildInputs = [
pkgs.gnumake
pkgs-old.ocaml-ng.ocamlPackages_4_08.ocaml
];
meta.description = ''
Provides a minimal shell environment with OCaml 4.08 in order
Expand Down
9 changes: 9 additions & 0 deletions src/dune_rules/module.ml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ let sources_without_pp t =
~f:(Option.map ~f:(fun (x : File.t) -> x.original_path))
;;

let source_without_pp ~ml_kind t =
let source =
match (ml_kind : Ml_kind.t) with
| Impl -> t.source.files.impl
| Intf -> t.source.files.intf
in
Option.map source ~f:(fun (x : File.t) -> x.original_path)
;;

module Obj_map = struct
include Map.Make (struct
type nonrec t = t
Expand Down
1 change: 1 addition & 0 deletions src/dune_rules/module.mli
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ end

val sources : t -> Path.t list
val sources_without_pp : t -> Path.t list
val source_without_pp : ml_kind:Ml_kind.t -> t -> Path.t option
val visibility : t -> Visibility.t
val encode : t -> src_dir:Path.t -> Dune_lang.t list
val decode : src_dir:Path.t -> t Dune_lang.Decoder.t
Expand Down
2 changes: 2 additions & 0 deletions src/dune_rules/module_compilation.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ let build_cm
let* compiler = compiler in
let ml_kind = Lib_mode.Cm_kind.source cm_kind in
let+ src = Module.file m ~ml_kind in
let original = Module.source_without_pp m ~ml_kind in
let dst = Obj_dir.Module.cm_file_exn obj_dir m ~kind:cm_kind in
let obj =
Obj_dir.Module.obj_file obj_dir m ~kind:(Ocaml Cmx) ~ext:ocaml.lib_config.ext_obj
Expand Down Expand Up @@ -324,6 +325,7 @@ let build_cm
; A "-c"
; Command.Ml_kind.flag ml_kind
; Dep src
; Hidden_deps (Dep.Set.of_files (Option.to_list original))
; other_targets
]
>>| Action.Full.add_sandbox sandbox))
Expand Down
4 changes: 2 additions & 2 deletions test/blackbox-tests/test-cases/hidden-deps-supported.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Test transitive deps can not be directly accessed, both for compiler versions su
> EOF

$ dune build ./runf.exe 2>&1 | grep -v ocamlc
File "runf.ml", line 1, characters 16-21:
File "runf.ml", line 1, characters 16-19:
1 | let _ = Bar.y + Foo.v
^^^^^
^^^
Error: Unbound module Foo
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ We should forbid lib interfaces modules from depending on themselves:
$ touch bar.ml

$ dune build @check
File "foo.ml", line 1, characters 9-14:
File "foo.ml", line 1, characters 9-12:
1 | let () = Foo.f ()
^^^^^
^^^
Error: Unbound module Foo
[1]
Loading
Loading