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

Remove the "dune compute" command #4540

Merged
2 commits merged into from Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Unreleased
way to rerun all actions failed due to errors without restarting the build,
e.g. via a Dune RPC call. (#4522, Andrey Mokhov)

- Remove `dune compute`. It was broken and unused (#....,
@jeremiedimino)

2.9.0 (unreleased)
------------------

Expand Down
82 changes: 0 additions & 82 deletions bin/compute.ml

This file was deleted.

1 change: 0 additions & 1 deletion bin/compute.mli

This file was deleted.

11 changes: 10 additions & 1 deletion bin/internal.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
open Import

let latest_lang_version =
( (let+ () = Term.const () in
print_endline
(Dune_lang.Syntax.greatest_supported_version Dune_engine.Stanza.syntax
|> Dune_lang.Syntax.Version.to_string))
, Term.info "latest-lang-version" )

let group =
(Term.Group.Group [ in_group Internal_dump.command ], Term.info "internal")
( Term.Group.Group
[ in_group Internal_dump.command; in_group latest_lang_version ]
, Term.info "internal" )
1 change: 0 additions & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ let all : _ Term.Group.t list =
; Printenv.command
; Help.command
; Format_dune_file.command
; Compute.command
; Upgrade.command
; Cache.command
; Describe.command
Expand Down
9 changes: 0 additions & 9 deletions doc/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@
(package dune)
(files dune-clean.1))

(rule
(with-stdout-to dune-compute.1
(run dune compute --help=groff)))

(install
(section man)
(package dune)
(files dune-compute.1))

(rule
(with-stdout-to dune-describe.1
(run dune describe --help=groff)))
Expand Down
2 changes: 1 addition & 1 deletion doc/test/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When changing Dune version, you need to update the docs too to make this test pa
Occasionally we do want to mention an older Dune version in documentation. This
is fine, but you then need to update the list of such exceptions below.

$ DUNE_LANG=$(dune compute latest-lang-version | sed 's/"//g')
$ DUNE_LANG=$(dune internal latest-lang-version)
$ grep '(lang dune' ../*.rst | grep -v "$DUNE_LANG"
../formatting.rst:If using ``(lang dune 2.0)``, there is nothing to setup in dune, formatting will
../formatting.rst:.. note:: This section applies only to projects with ``(lang dune 1.x)``.
Expand Down
24 changes: 9 additions & 15 deletions src/dune_engine/build_system.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@ module Fs : sig
val assert_exists : loc:Loc.t -> Path.t -> unit Memo.Build.t
end = struct
let mkdir_p_def =
Memo.create "mkdir_p" ~doc:"mkdir_p"
Memo.create "mkdir_p"
~input:(module Path.Build)
~output:(Simple (module Unit))
~visibility:Hidden
(fun p ->
Path.mkdir_p (Path.build p);
Memo.Build.return ())

let mkdir_p = Memo.exec mkdir_p_def

let assert_exists_def =
Memo.create "assert_path_exists" ~doc:"Path.exists"
Memo.create "assert_path_exists"
~input:(module Path)
~output:(Simple (module Bool))
~visibility:Hidden
(fun p -> Memo.Build.return (Path.exists p))

let assert_exists ~loc path =
Expand Down Expand Up @@ -1139,9 +1137,7 @@ end = struct
let load_dir =
let load_dir_impl dir = load_dir_impl (t ()) ~dir in
let memo =
Memo.create_hidden "load-dir" ~doc:"load dir"
~input:(module Path)
load_dir_impl
Memo.create_hidden "load-dir" ~input:(module Path) load_dir_impl
in
fun ~dir -> Memo.exec memo dir
end
Expand Down Expand Up @@ -2064,36 +2060,34 @@ end = struct
|> Path.Set.of_list

let eval_memo =
Memo.create "eval-pred" ~doc:"Evaluate a predicate in a directory"
Memo.create "eval-pred"
~input:(module File_selector)
~output:(Allow_cutoff (module Path.Set))
~visibility:Hidden eval_impl
eval_impl

let eval = Memo.exec eval_memo

let build =
Memo.exec
(Memo.create "build-pred" ~doc:"build a predicate"
(Memo.create "build-pred"
~input:(module File_selector)
~output:(Allow_cutoff (module Dep.Fact.Files))
~visibility:Hidden build_impl)
build_impl)
end

let build_file_memo =
Memo.create "build-file"
~output:(Allow_cutoff (module Digest))
~doc:"Build a file."
~input:(module Path)
~visibility:Hidden build_file_impl
build_file_impl

let build_file = Memo.exec build_file_memo

let build_alias_memo =
Memo.create "build-alias"
~output:(Allow_cutoff (module Dep.Fact.Files))
~doc:"Build an alias."
~input:(module Alias)
~visibility:Hidden build_alias_impl
build_alias_impl

let build_alias = Memo.exec build_alias_memo

Expand Down
3 changes: 1 addition & 2 deletions src/dune_engine/fs_memo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ open Memo.Build.O
(* Files and directories have non-overlapping sets of paths, so we can track
them using the same memoization table. *)
let memo =
Memo.create "fs_memo" ~doc:"tracking files and directories on the file system"
Memo.create "fs_memo"
~input:(module Path)
~output:(Simple (module Unit))
~visibility:Hidden
(fun _path -> Memo.Build.return ())

(* Declare a dependency on a path. Instead of calling [depend] directly, you
Expand Down
7 changes: 3 additions & 4 deletions src/dune_engine/source_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,10 @@ end = struct
option (Output.to_dyn Dir0.to_dyn)
end in
let memo =
Memo.create "find-dir-raw" ~doc:"get file tree"
Memo.create "find-dir-raw"
~input:(module Path.Source)
~output:(Simple (module Output))
~visibility:Memo.Visibility.Hidden find_dir_raw_impl
find_dir_raw_impl
in
Memo.cell memo

Expand Down Expand Up @@ -657,10 +657,9 @@ let execution_parameters_of_dir =
in
let memo =
Memo.create "execution-parameters-of-dir"
~doc:"Return the execution parameters of a given directory"
~input:(module Path.Source)
~output:(Allow_cutoff (module Execution_parameters))
~visibility:Hidden f
f
in
Memo.exec memo

Expand Down
22 changes: 4 additions & 18 deletions src/dune_engine/vcs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module Kind = struct
, [] )

let equal = ( = )

let decode = Dune_lang.Decoder.enum [ ("git", Git); ("hg", Hg) ]
end

module T = struct
Expand All @@ -40,13 +38,6 @@ module T = struct

(* No need to hash the kind as there is only only kind per directory *)
let hash t = Path.hash t.root

let decode =
let open Dune_lang.Decoder in
fields
(let+ root = field "root" Dpath.decode
and+ kind = field "kind" Kind.decode in
{ root; kind })
end

include T
Expand Down Expand Up @@ -118,12 +109,8 @@ let hg_describe t =
in
s ^ dirty_suffix

let make_fun name ~output ~doc ~git ~hg =
let memo =
Memo.create name ~doc
~input:(module T)
~output ~visibility:(Public decode) (select git hg)
in
let make_fun name ~output ~git ~hg =
let memo = Memo.create name ~input:(module T) ~output (select git hg) in
Staged.stage (Memo.exec memo)

module Option_output (S : sig
Expand All @@ -140,7 +127,6 @@ end
let describe =
Staged.unstage
@@ make_fun "vcs-describe"
~doc:"Obtain a nice description of the tip from the vcs"
~output:(Simple (module Option_output (String)))
~git:(fun t -> run_git t [ "describe"; "--always"; "--dirty" ])
~hg:(fun x ->
Expand All @@ -150,7 +136,7 @@ let describe =

let commit_id =
Staged.unstage
@@ make_fun "vcs-commit-id" ~doc:"The hash of the head commit"
@@ make_fun "vcs-commit-id"
~output:(Simple (module Option_output (String)))
~git:(fun t -> run_git t [ "rev-parse"; "HEAD" ])
~hg:(fun t ->
Expand Down Expand Up @@ -180,7 +166,7 @@ let files =
List.map l ~f:Path.in_source
in
Staged.unstage
@@ make_fun "vcs-files" ~doc:"Return the files committed in the repo"
@@ make_fun "vcs-files"
~output:
(Simple
(module struct
Expand Down
12 changes: 5 additions & 7 deletions src/dune_rules/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ let create ~(kind : Kind.t) ~path ~env ~env_nodes ~name ~merlin ~targets
(sprintf "which-memo-for-%s" (Context_name.to_string name))
~input:(module Program.Name)
~output:(Allow_cutoff (module Program.Which_path))
~visibility:Hidden
(fun p -> Memo.Build.return (Program.which ~path p))
in
let which = Memo.exec which_memo in
Expand Down Expand Up @@ -791,10 +790,10 @@ end = struct
~dynamically_linked_foreign_archives ~instrument_with

let memo =
Memo.create "instantiate-context" ~doc:"instantiate contexts"
Memo.create "instantiate-context"
~input:(module Context_name)
~output:(Simple (module T_list))
~visibility:Memo.Visibility.Hidden instantiate_impl
instantiate_impl

let instantiate name = Memo.exec memo name
end
Expand All @@ -817,19 +816,18 @@ module DB = struct
all
in
let memo =
Memo.create "build-contexts" ~doc:"all build contexts"
Memo.create "build-contexts"
~input:(module Unit)
~output:(Simple (module T_list))
~visibility:Memo.Visibility.Hidden impl
impl
in
Memo.exec memo

let get =
let memo =
Memo.create "context-db-get" ~doc:"get context from db"
Memo.create "context-db-get"
~input:(module Context_name)
~output:(Simple (module T))
~visibility:Hidden
(fun name ->
let+ contexts = all () in
List.find_exn contexts ~f:(fun c -> Context_name.equal name c.name))
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/dir_contents.ml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ end = struct
Memo.create "dir-contents-get0"
~input:(module Key)
~output:(Simple (module Output))
~doc:"dir contents" ~visibility:Hidden get0_impl
get0_impl

let get sctx ~dir =
Memo.exec memo0 (sctx, dir) >>= function
Expand Down
3 changes: 1 addition & 2 deletions src/dune_rules/dir_status.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ module DB = struct
; fn =
Memo.create "get-dir-status"
~input:(module Path.Build)
~visibility:Hidden
~output:(Simple (module T))
~doc:"Get a directory status." Fn.get
Fn.get
}
end

Expand Down
Loading