Skip to content

Commit

Permalink
Merge pull request #10522 from gridbugs/merge-main-into-toolchains1
Browse files Browse the repository at this point in the history
Merge main into toolchains
  • Loading branch information
gridbugs authored May 13, 2024
2 parents bafff6a + f665c49 commit 15c9b4a
Show file tree
Hide file tree
Showing 142 changed files with 2,623 additions and 1,057 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Binaries

on:
workflow_dispatch:

jobs:
binary:
name: Create
strategy:
fail-fast: false
matrix:
include:
- os: macos-13
name: mac-intel
installable: .#
- os: macos-14
name: mac-arm
installable: .#
- os: ubuntu-22.04
name: linux-intel
installable: .#
- os: ubuntu-22.04
name: linux-intel-static
installable: .#dune-static
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v22
- run: nix build ${{ installable }}
- uses: actions/upload-artifact@v4
with:
path: result/bin/dune
name: dune-${{ matrix.name }}
combine:
runs-on: ubuntu-latest
needs: binary
steps:
- uses: actions/upload-artifact/merge@v4
with:
separate-directories: true
6 changes: 5 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- 4.14.x
include:
# OCaml trunk:
- ocaml-compiler: ocaml-variants.5.2.0+trunk
- ocaml-compiler: ocaml-variants.5.3.0+trunk
os: ubuntu-latest
skip_test: true
# OCaml 5:
Expand All @@ -44,6 +44,10 @@ jobs:
- ocaml-compiler: 5.1.x
os: macos-latest
skip_test: true
# macOS x86_64 (Intel)
- ocaml-compiler: 4.14.x
os: macos-13
skip_test: true
# OCaml 4:
- ocaml-compiler: 4.13.x
os: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ install-ocamlformat:
dev-depext:
opam depext -y $(TEST_DEPS)

# v4-414-dev
.PHONY: melange
melange:
opam pin add -n melange.dev https://github.com/melange-re/melange.git#v4-414-dev
opam pin add -n melange.dev https://github.com/melange-re/melange.git#24e21cc42

.PHONY: dev-deps
dev-deps: melange
Expand Down
3 changes: 1 addition & 2 deletions bench/bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ let () =
Dune_engine.Clflags.display := Quiet;
{ Scheduler.Config.concurrency = 10
; stats = None
; insignificant_changes = `React
; signal_watcher = `No
; print_ctrl_c_warning = false
; watch_exclusions = []
}
in
Expand Down
3 changes: 1 addition & 2 deletions bench/micro/dune_bench/scheduler_bench.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ let config =
Dune_engine.Clflags.display := Short;
{ Scheduler.Config.concurrency = 1
; stats = None
; insignificant_changes = `React
; signal_watcher = `No
; print_ctrl_c_warning = false
; watch_exclusions = []
}
;;
Expand Down
8 changes: 0 additions & 8 deletions bin/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,14 +1047,6 @@ let rpc t =
| `Allow rpc -> `Allow (Lazy.force rpc)
;;

let signal_watcher t =
match t.rpc with
| `Allow _ -> `Yes
| `Forbid_builds ->
(* if we aren't building anything, then we don't mind interrupting dune immediately *)
`No
;;

let watch_exclusions t = t.builder.watch_exclusions
let stats t = t.stats

Expand Down
1 change: 0 additions & 1 deletion bin/common.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ val rpc
| `Forbid_builds (** Promise not to build anything. For now, this isn't checked *)
]

val signal_watcher : t -> [ `Yes | `No ]
val watch_exclusions : t -> string list
val stats : t -> Dune_stats.t option
val print_metrics : t -> bool
Expand Down
1 change: 1 addition & 0 deletions bin/describe/describe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let subcommands =
; Aliases_targets.Aliases_cmd.command
; Package_entries.command
; Describe_pkg.command
; Describe_contexts.command
]
;;

Expand Down
23 changes: 23 additions & 0 deletions bin/describe/describe_contexts.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
open Import

let term =
let+ builder = Common.Builder.term in
let common, config = Common.init builder in
Scheduler.go ~common ~config
@@ fun () ->
let open Fiber.O in
let* setup = Import.Main.setup () in
let+ setup = Memo.run setup in
let ctxts =
List.map
~f:(fun (name, _) -> Context_name.to_string name)
(Context_name.Map.to_list setup.scontexts)
in
List.iter ctxts ~f:print_endline
;;

let command =
let doc = "List the build contexts available in the workspace." in
let info = Cmd.info ~doc "contexts" in
Cmd.v info term
;;
4 changes: 4 additions & 0 deletions bin/describe/describe_contexts.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
open Import

(** Dune command to print out the available build contexts.*)
val command : unit Cmd.t
30 changes: 15 additions & 15 deletions bin/describe/describe_pkg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,21 @@ module List_locked_dependencies = struct
Pp.concat
~sep:Pp.cut
(List.map lock_dirs_by_path ~f:(fun (lock_dir_path, lock_dir) ->
match Package_universe.create local_packages lock_dir with
| Error e -> raise (User_error.E e)
| Ok package_universe ->
Pp.vbox
(Pp.concat
~sep:Pp.cut
[ Pp.hbox
(Pp.textf
"Dependencies of local packages locked in %s"
(Path.Source.to_string_maybe_quoted lock_dir_path))
; Pp.enumerate
(Package_name.Map.keys local_packages)
~f:(package_deps_in_lock_dir_pp package_universe ~transitive)
|> Pp.box
])))
let package_universe =
Package_universe.create local_packages lock_dir |> User_error.ok_exn
in
Pp.vbox
(Pp.concat
~sep:Pp.cut
[ Pp.hbox
(Pp.textf
"Dependencies of local packages locked in %s"
(Path.Source.to_string_maybe_quoted lock_dir_path))
; Pp.enumerate
(Package_name.Map.keys local_packages)
~f:(package_deps_in_lock_dir_pp package_universe ~transitive)
|> Pp.box
])))
|> Pp.vbox
in
Console.print [ pp ]
Expand Down
33 changes: 21 additions & 12 deletions bin/describe/describe_workspace.ml
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,13 @@ module Sanitize_for_tests = struct
let fake_workspace = lazy (Path.External.of_string "/WORKSPACE_ROOT")

let sanitize_with_findlib ~findlib_paths path =
let path = Path.external_ path in
List.find_map findlib_paths ~f:(fun candidate ->
let open Option.O in
let* candidate = Path.as_external candidate in
(* if the path to rename is an external path, try to find the
OCaml root inside, and replace it with a fixed string *)
let+ without_prefix = Path.External.drop_prefix ~prefix:candidate path in
let+ without_prefix = Path.drop_prefix ~prefix:(Path.external_ candidate) path in
(* we have found the OCaml root path: let's replace it with a
constant string *)
Path.External.append_local (Lazy.force fake_findlib) without_prefix)
Expand Down Expand Up @@ -371,7 +372,9 @@ module Crawl = struct

(* Builds the list of modules *)
let modules ~obj_dir ~deps_of modules_ : Descr.Mod.t list Memo.t =
Modules.fold_no_vlib ~init:(Memo.return []) modules_ ~f:(fun m macc ->
modules_
|> Modules.With_vlib.drop_vlib
|> Modules.fold ~init:(Memo.return []) ~f:(fun m macc ->
let* acc = macc in
let deps = deps_of m in
let+ { Ocaml.Ml_kind.Dict.intf = deps_for_intf; impl = deps_for_impl }, _ =
Expand All @@ -389,11 +392,14 @@ module Crawl = struct
Scope.DB.find_by_project (Super_context.context sctx |> Context.name) project
in
let* modules_, obj_dir =
Dir_contents.get sctx ~dir
>>= Dir_contents.ocaml
>>= Ml_sources.modules_and_obj_dir
~libs:(Scope.libs scope)
~for_:(Exe { first_exe })
let+ modules_, obj_dir =
Dir_contents.get sctx ~dir
>>= Dir_contents.ocaml
>>= Ml_sources.modules_and_obj_dir
~libs:(Scope.libs scope)
~for_:(Exe { first_exe })
in
Modules.With_vlib.modules modules_, obj_dir
in
let* pp_map =
let+ version =
Expand Down Expand Up @@ -454,11 +460,14 @@ module Crawl = struct
let* libs =
Scope.DB.find_by_dir (Path.as_in_build_dir_exn src_dir) >>| Scope.libs
in
Dir_contents.get sctx ~dir:(Path.as_in_build_dir_exn src_dir)
>>= Dir_contents.ocaml
>>= Ml_sources.modules_and_obj_dir
~libs
~for_:(Library (Lib_info.lib_id info |> Lib_id.to_local_exn))
let+ modules_, obj_dir_ =
Dir_contents.get sctx ~dir:(Path.as_in_build_dir_exn src_dir)
>>= Dir_contents.ocaml
>>= Ml_sources.modules_and_obj_dir
~libs
~for_:(Library (Lib_info.lib_id info |> Lib_id.to_local_exn))
in
Modules.With_vlib.modules modules_, obj_dir_
in
let* pp_map =
let+ version =
Expand Down
8 changes: 2 additions & 6 deletions bin/import.ml
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,11 @@ module Scheduler = struct
let go ~(common : Common.t) ~config:dune_config f =
let stats = Common.stats common in
let config =
let signal_watcher = Common.signal_watcher common in
let watch_exclusions = Common.watch_exclusions common in
Dune_config.for_scheduler
dune_config
stats
~insignificant_changes:`Ignore
~signal_watcher
~print_ctrl_c_warning:true
~watch_exclusions
in
let f =
Expand All @@ -218,13 +216,11 @@ module Scheduler = struct
in
let stats = Common.stats common in
let config =
let signal_watcher = Common.signal_watcher common in
let watch_exclusions = Common.watch_exclusions common in
Dune_config.for_scheduler
dune_config
stats
~insignificant_changes:`Ignore
~signal_watcher
~print_ctrl_c_warning:true
~watch_exclusions
in
let file_watcher = Common.file_watcher common in
Expand Down
3 changes: 1 addition & 2 deletions bin/monitor.ml
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ let command =
Dune_config.for_scheduler
config
stats
~insignificant_changes:`Ignore
~signal_watcher:`Yes
~print_ctrl_c_warning:true
~watch_exclusions:[]
in
Scheduler.Run.go
Expand Down
Loading

0 comments on commit 15c9b4a

Please sign in to comment.