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

Drop support for upgrading jbuilder projects #4473

Merged
1 commit merged into from Apr 9, 2021
Merged
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -95,6 +95,8 @@ Unreleased
- Allow dune-file as an alternative file name for dune files (needs to be
enabled in the dune-project file) (#4428, @nojb)

- Drop support for upgrading jbuilder projects (#...., @jeremiedimino)

2.8.5 (28/03/2021)
------------------

5 changes: 2 additions & 3 deletions bin/common.ml
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ let print_entering_message c =
in
Console.print [ Pp.verbatim (sprintf "Entering directory '%s'" dir) ]

let init ?log_file ?(recognize_jbuilder_projects = false) c =
let init ?log_file c =
if c.root.dir <> Filename.current_dir_name then Sys.chdir c.root.dir;
Path.set_root (normalize_path (Path.External.cwd ()));
Path.Build.set_build_dir (Path.Build.Kind.of_string c.build_dir);
@@ -156,8 +156,7 @@ let init ?log_file ?(recognize_jbuilder_projects = false) c =
|> S.set_ancestor_vcs c.root.ancestor_vcs
|> S.set_execution_parameters
(Dune_engine.Execution_parameters.builtin_default
|> Dune_rules.Workspace.update_execution_parameters w)
|> S.set_recognize_jbuilder_projects recognize_jbuilder_projects);
|> Dune_rules.Workspace.update_execution_parameters w));
Dune_rules.Global.init ~capture_outputs:c.capture_outputs;
(* CR-soon amokhov: Right now, types [Dune_config.Caching.Duplication.t] and
[Dune_cache_storage.Mode.t] are the same. They will be unified after
6 changes: 1 addition & 5 deletions bin/common.mli
Original file line number Diff line number Diff line change
@@ -22,11 +22,7 @@ val prefix_target : t -> string -> string

Return the final configuration, which is the same as the one returned in the
[config] field of [Dune_rules.Workspace.workspace ()]) *)
val init :
?log_file:Dune_util.Log.File.t
-> ?recognize_jbuilder_projects:bool
-> t
-> Dune_config.t
val init : ?log_file:Dune_util.Log.File.t -> t -> Dune_config.t

(** [examples \[("description", "dune cmd foo"); ...\]] is an [EXAMPLES] manpage
section of enumerated examples illustrating how to run the documented
8 changes: 2 additions & 6 deletions bin/ocaml_merlin.ml
Original file line number Diff line number Diff line change
@@ -29,9 +29,7 @@ let term =
ouptut.")
in
let common = Common.set_print_directory common false in
let config =
Common.init common ~log_file:No_log_file ~recognize_jbuilder_projects:true
in
let config = Common.init common ~log_file:No_log_file in
Scheduler.go ~common ~config (fun () ->
match dump_config with
| Some s -> Dune_rules.Merlin_server.dump s
@@ -66,9 +64,7 @@ module Dump_dot_merlin = struct
"The path to the folder of which the configuration should be \
printed. Defaults to the current directory.")
in
let config =
Common.init common ~log_file:No_log_file ~recognize_jbuilder_projects:true
in
let config = Common.init common ~log_file:No_log_file in
Scheduler.go ~common ~config (fun () ->
match path with
| Some s -> Dune_rules.Merlin_server.dump_dot_merlin s
2 changes: 1 addition & 1 deletion bin/upgrade.ml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ let info = Term.info "upgrade" ~doc ~man

let term =
let+ common = Common.term in
let config = Common.init common ~recognize_jbuilder_projects:true in
let config = Common.init common in
Scheduler.go ~common ~config (fun () -> Dune_upgrader.upgrade ())

let command = (term, info)
1 change: 0 additions & 1 deletion boot/libs.ml
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ let local_libraries =
; ("src/section", Some "Dune_section", false, None)
; ("vendor/build_path_prefix_map/src", Some "Build_path_prefix_map", false,
None)
; ("src/jbuild_support", Some "Jbuild_support", false, None)
; ("otherlibs/dune-rpc/private", Some "Dune_rpc_private", false, None)
; ("src/dune_rpc_server", Some "Dune_rpc_server", false, None)
; ("src/csexp_rpc", Some "Csexp_rpc", false, None)
3 changes: 1 addition & 2 deletions src/dune_engine/action_builder.ml
Original file line number Diff line number Diff line change
@@ -147,8 +147,7 @@ let strings p =

let read_sexp p =
let+ s = contents p in
Dune_lang.Parser.parse_string s ~lexer:Dune_lang.Lexer.token
~fname:(Path.to_string p) ~mode:Single
Dune_lang.Parser.parse_string s ~fname:(Path.to_string p) ~mode:Single

let if_file_exists p ~then_ ~else_ = If_file_exists (p, then_, else_)

1 change: 0 additions & 1 deletion src/dune_engine/dune
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@
ocaml_config
chrome_trace
stats
jbuild_support
dune_action_plugin
dune_util
build_path_prefix_map
5 changes: 1 addition & 4 deletions src/dune_engine/include_stanza.ml
Original file line number Diff line number Diff line change
@@ -45,8 +45,5 @@ let load_sexps ~context:{ current_file; include_stack } (loc, fn) =
Path.Source.equal f current_file)
then
error { current_file; include_stack };
let sexps =
Dune_lang.Parser.load ~lexer:Dune_lang.Lexer.token
(Path.source current_file) ~mode:Many
in
let sexps = Dune_lang.Parser.load (Path.source current_file) ~mode:Many in
(sexps, { current_file; include_stack })
37 changes: 3 additions & 34 deletions src/dune_engine/source_tree.ml
Original file line number Diff line number Diff line change
@@ -54,8 +54,6 @@ module Dune_file = struct

let alternative_fname = "dune-file"

let jbuild_fname = "jbuild"

type kind =
| Plain
| Ocaml_script
@@ -358,21 +356,16 @@ end
module Settings = struct
type t =
{ ancestor_vcs : Vcs.t option
; recognize_jbuilder_projects : bool
; execution_parameters : Execution_parameters.t
}

let builtin_default =
{ ancestor_vcs = None
; recognize_jbuilder_projects = false
; execution_parameters = Execution_parameters.builtin_default
}

let set_ancestor_vcs x t = { t with ancestor_vcs = x }

let set_recognize_jbuilder_projects x t =
{ t with recognize_jbuilder_projects = x }

let set_execution_parameters x t = { t with execution_parameters = x }

let t : t Memo.Build.t Fdecl.t = Fdecl.create Dyn.Encoder.opaque
@@ -464,26 +457,10 @@ end = struct
(visited, init)
end

let dune_file ~(dir_status : Sub_dirs.Status.t) ~recognize_jbuilder_projects
~path ~files ~project =
let dune_file ~(dir_status : Sub_dirs.Status.t) ~path ~files ~project =
let file_exists =
if dir_status = Data_only then
None
else if
(not recognize_jbuilder_projects)
&& String.Set.mem files Dune_file.jbuild_fname
then
User_error.raise
~loc:
(Loc.in_file
(Path.source (Path.Source.relative path Dune_file.jbuild_fname)))
[ Pp.text
"jbuild files are no longer supported, please convert this file \
to a dune file instead."
; Pp.text
"Note: You can use \"dune upgrade\" to convert your project to \
dune."
]
else if
Dune_project.accept_alternative_dune_file_name project
&& String.Set.mem files Dune_file.alternative_fname
@@ -524,13 +501,7 @@ end = struct

let contents { Readdir.dirs; files } ~dirs_visited ~project ~path
~(dir_status : Sub_dirs.Status.t) =
let* recognize_jbuilder_projects =
let+ settings = Settings.get () in
settings.recognize_jbuilder_projects
in
let+ dune_file =
dune_file ~dir_status ~recognize_jbuilder_projects ~files ~project ~path
in
let+ dune_file = dune_file ~dir_status ~files ~project ~path in
let sub_dirs = Dune_file.sub_dirs dune_file in
let dirs_visited, sub_dirs =
Get_subdir.all ~dirs_visited ~dirs ~sub_dirs ~parent_status:dir_status
@@ -613,7 +584,6 @@ end = struct
| None -> Memo.Build.return None
| Some (parent_dir, dirs_visited, dir_status, virtual_) ->
let dirs_visited = Dirs_visited.Per_fn.find dirs_visited path in
let* settings = Settings.get () in
let readdir =
if virtual_ then
Readdir.empty
@@ -628,8 +598,7 @@ end = struct
else
Option.value
(Dune_project.load ~dir:path ~files:readdir.files
~infer_from_opam_files:settings.recognize_jbuilder_projects
~dir_status)
~infer_from_opam_files:false ~dir_status)
~default:parent_dir.project
in
let vcs = get_vcs ~default:parent_dir.vcs ~readdir ~path in
6 changes: 0 additions & 6 deletions src/dune_engine/source_tree.mli
Original file line number Diff line number Diff line change
@@ -8,8 +8,6 @@ module Dune_file : sig

val alternative_fname : string

val jbuild_fname : string

type kind = private
| Plain
| Ocaml_script
@@ -82,10 +80,6 @@ module Settings : sig
this is the vcs that will be used for the root. *)
val set_ancestor_vcs : Vcs.t option -> t -> t

(** Whether we recognise jbuilder projects. This is only set to [true] by the
upgrader. *)
val set_recognize_jbuilder_projects : bool -> t -> t

(** The default execution parameters. *)
val set_execution_parameters : Execution_parameters.t -> t -> t
end
32 changes: 0 additions & 32 deletions src/jbuild_support/atom.ml

This file was deleted.

1 change: 0 additions & 1 deletion src/jbuild_support/atom.mli

This file was deleted.

6 changes: 0 additions & 6 deletions src/jbuild_support/dune

This file was deleted.

1 change: 0 additions & 1 deletion src/jbuild_support/lexer.mli

This file was deleted.

Loading