Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove action runners from public dune #10794

Merged
Merged
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
24 changes: 1 addition & 23 deletions bin/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,6 @@ let cache_debug_flags_term : Cache_debug_flags.t Term.t =
value initial
;;

module Action_runner = struct
type t =
| No
| Yes of
(Dune_lang.Dep_conf.t Dune_rpc_impl.Server.t
-> (Dune_engine.Action_exec.input -> Dune_engine.Action_runner.t option) Staged.t)
end

module Builder = struct
type t =
{ debug_dep_path : bool
Expand Down Expand Up @@ -602,14 +594,12 @@ module Builder = struct
; stats_trace_extended : bool
; allow_builds : bool
; default_root_is_cwd : bool
; action_runner : Action_runner.t
; log_file : Dune_util.Log.File.t
}

let set_root t root = { t with root = Some root }
let forbid_builds t = { t with allow_builds = false; no_print_directory = true }
let set_default_root_is_cwd t x = { t with default_root_is_cwd = x }
let set_action_runner t x = { t with action_runner = x }
let set_log_file t x = { t with log_file = x }
let disable_log_file t = { t with log_file = No_log_file }
let set_promote t v = { t with promote = Some v }
Expand Down Expand Up @@ -1029,7 +1019,6 @@ module Builder = struct
; stats_trace_extended
; allow_builds = true
; default_root_is_cwd = false
; action_runner = No
; log_file = Default
}
;;
Expand Down Expand Up @@ -1160,16 +1149,14 @@ let build (builder : Builder.t) =
| Yes Passive -> Some 1.0
| _ -> None
in
let action_runner = Dune_engine.Action_runner.Rpc_server.create () in
Dune_rpc_impl.Server.create
~lock_timeout
~registry
~root:root.dir
~handle:Dune_rules_rpc.register
~watch_mode_config:builder.watch
~parse_build:Dune_rules_rpc.parse_build
stats
action_runner))
stats))
else `Forbid_builds
in
if builder.print_metrics then Dune_metrics.enable ();
Expand Down Expand Up @@ -1226,16 +1213,7 @@ let init (builder : Builder.t) =
"Shared cache location: %s"
(Path.to_string Dune_cache_storage.Layout.root_dir)
];
let action_runner =
match builder.action_runner with
| No -> None
| Yes f ->
(match rpc c with
| `Forbid_builds -> Code_error.raise "action runners require building" []
| `Allow server -> Some (Staged.unstage @@ f server))
in
Dune_rules.Main.init
?action_runner
~stats:c.stats
~sandboxing_preference:config.sandboxing_preference
~cache_config
Expand Down
9 changes: 0 additions & 9 deletions bin/common.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,13 @@ val watch : t -> Dune_rpc_impl.Watch_mode_config.t
val file_watcher : t -> Dune_engine.Scheduler.Run.file_watcher
val prefix_target : t -> string -> string

module Action_runner : sig
type t =
| No
| Yes of
(Dune_lang.Dep_conf.t Dune_rpc_impl.Server.t
-> (Dune_engine.Action_exec.input -> Dune_engine.Action_runner.t option) Staged.t)
end

(** [Builder] describes how to initialize Dune. *)
module Builder : sig
type t

val set_root : t -> string -> t
val forbid_builds : t -> t
val set_default_root_is_cwd : t -> bool -> t
val set_action_runner : t -> Action_runner.t -> t
val set_log_file : t -> Dune_util.Log.File.t -> t
val disable_log_file : t -> t
val set_promote : t -> Dune_engine.Clflags.Promote.t -> t
Expand Down
2 changes: 1 addition & 1 deletion boot/libs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ let local_libraries =
; ("src/dune_output_truncation", Some "Dune_output_truncation", false,
None)
; ("src/csexp_rpc", Some "Csexp_rpc", false, None)
; ("src/dune_rpc_server", Some "Dune_rpc_server", false, None)
; ("src/dune_rpc_client", Some "Dune_rpc_client", false, None)
; ("src/dune_thread_pool", Some "Dune_thread_pool", false, None)
; ("otherlibs/ocamlc-loc/src", Some "Ocamlc_loc", false, None)
Expand Down Expand Up @@ -91,6 +90,7 @@ let local_libraries =
; ("src/upgrader", Some "Dune_upgrader", false, None)
; ("src/dune_pkg_outdated", Some "Dune_pkg_outdated", false, None)
; ("vendor/cmdliner/src", None, false, None)
; ("src/dune_rpc_server", Some "Dune_rpc_server", false, None)
; ("src/dune_rpc_impl", Some "Dune_rpc_impl", false, None)
; ("src/dune_rules_rpc", Some "Dune_rules_rpc", false, None)
]
Expand Down
Loading
Loading