Skip to content

Commit

Permalink
Revert "Add support for bisect_ppx (ocaml#3403)"
Browse files Browse the repository at this point in the history
This reverts commit b398913.
  • Loading branch information
rgrinberg committed Jun 6, 2020
1 parent 074fa11 commit a930946
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 337 deletions.
3 changes: 1 addition & 2 deletions .travis-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ opam_install_test_deps () {
ocaml-migrate-parsetree \
result.1.4 \
utop.2.4.2 \
mdx.1.6.0 \
bisect_ppx
mdx.1.6.0
# We install Coq separatedly as to be more resistant w.r.t. the 10
# minutes Travis timeout; the travis_wait hack doesn't work well
# with Dune's current setup. Note that Travis caching should help
Expand Down
3 changes: 0 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ next
- Generate correct META files for sub-libraries (of the form `lib.foo`) that
contain .js runtime files. (#3445, @hhugo)

- Allow bisect_ppx to be enabled/disabled via dune-workspace. (#3404,
@stephanieyou)

- Add a `(no-infer ...)` action that prevents inference of targets and
dependencies in actions. (#3456, fixes #2006, @roddyyaga)

Expand Down
72 changes: 0 additions & 72 deletions doc/bisect.rst

This file was deleted.

1 change: 0 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Welcome to dune's documentation!
dune-files
concepts
tests
bisect
foreign-code
documentation
jsoo
Expand Down
15 changes: 5 additions & 10 deletions src/dune/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ let write_dot_dune_dir ~build_dir ~ocamlc ~ocaml_config_vars =

let create ~(kind : Kind.t) ~path ~env ~env_nodes ~name ~merlin ~targets
~host_context ~host_toolchain ~profile ~fdo_target_exe
~dynamically_linked_foreign_archives ~bisect_enabled =
~dynamically_linked_foreign_archives =
let prog_not_found_in_path prog =
Utils.program_not_found prog ~context:name ~loc:None
in
Expand Down Expand Up @@ -504,7 +504,6 @@ let create ~(kind : Kind.t) ~path ~env ~env_nodes ~name ~merlin ~targets
; ccomp_type = Ocaml_config.ccomp_type ocfg
; profile
; ocaml_version = Ocaml_config.version_string ocfg
; bisect_enabled
}
in
if Option.is_some fdo_target_exe then
Expand Down Expand Up @@ -617,10 +616,10 @@ let extend_paths t ~env =
Env.extend ~vars env

let default ~merlin ~env_nodes ~env ~targets ~fdo_target_exe
~dynamically_linked_foreign_archives ~bisect_enabled =
~dynamically_linked_foreign_archives =
let path = Env.path env in
create ~kind:Default ~path ~env ~env_nodes ~merlin ~targets ~fdo_target_exe
~dynamically_linked_foreign_archives ~bisect_enabled
~dynamically_linked_foreign_archives

let opam_version =
let f opam =
Expand Down Expand Up @@ -651,7 +650,7 @@ let opam_version =

let create_for_opam ~root ~env ~env_nodes ~targets ~profile ~switch ~name
~merlin ~host_context ~host_toolchain ~fdo_target_exe
~dynamically_linked_foreign_archives ~bisect_enabled =
~dynamically_linked_foreign_archives =
let opam =
match Memo.Lazy.force opam with
| None -> Utils.program_not_found "opam" ~loc:None
Expand Down Expand Up @@ -702,7 +701,6 @@ let create_for_opam ~root ~env ~env_nodes ~targets ~profile ~switch ~name
~kind:(Opam { root; switch })
~profile ~targets ~path ~env ~env_nodes ~name ~merlin ~host_context
~host_toolchain ~fdo_target_exe ~dynamically_linked_foreign_archives
~bisect_enabled

let instantiate_context env (workspace : Workspace.t)
~(context : Workspace.Context.t) ~host_context =
Expand All @@ -722,7 +720,6 @@ let instantiate_context env (workspace : Workspace.t)
; loc = _
; fdo_target_exe
; dynamically_linked_foreign_archives
; bisect_enabled
} ->
let merlin =
workspace.merlin_context = Some (Workspace.Context.name context)
Expand All @@ -738,7 +735,6 @@ let instantiate_context env (workspace : Workspace.t)
let env = extend_paths ~env paths in
default ~env ~env_nodes ~profile ~targets ~name ~merlin ~host_context
~host_toolchain ~fdo_target_exe ~dynamically_linked_foreign_archives
~bisect_enabled
| Opam
{ base =
{ targets
Expand All @@ -751,7 +747,6 @@ let instantiate_context env (workspace : Workspace.t)
; loc = _
; fdo_target_exe
; dynamically_linked_foreign_archives
; bisect_enabled
}
; switch
; root
Expand All @@ -760,7 +755,7 @@ let instantiate_context env (workspace : Workspace.t)
let env = extend_paths ~env paths in
create_for_opam ~root ~env_nodes ~env ~profile ~switch ~name ~merlin
~targets ~host_context ~host_toolchain:toolchain ~fdo_target_exe
~dynamically_linked_foreign_archives ~bisect_enabled
~dynamically_linked_foreign_archives

module Create = struct
module Output = struct
Expand Down
58 changes: 3 additions & 55 deletions src/dune/dune_file.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ let () =
Dune_project.Extension.register_deleted ~name:"library_variants"
~deleted_in:(2, 6)

let bisect_ppx_syntax =
Dune_lang.Syntax.create ~name:"bisect_ppx" ~desc:"the bisect_ppx extension"
[ ((1, 0), `Since (2, 6)) ]

let () =
Dune_project.Extension.register_simple bisect_ppx_syntax
(Dune_lang.Decoder.return [])

module Pps_and_flags = struct
let decode =
let+ l, flags =
Expand Down Expand Up @@ -211,30 +203,6 @@ module Preprocess_map = struct
List.fold_left (Preprocess.pps pp) ~init:acc ~f:(fun acc (loc, pp) ->
Lib_name.Map.set acc pp loc))
|> Lib_name.Map.foldi ~init:[] ~f:(fun pp loc acc -> (loc, pp) :: acc)

let add_bisect t =
let bisect_ppx =
let bisect_name = Lib_name.parse_string_exn (Loc.none, "bisect_ppx") in
(Loc.none, bisect_name)
in
Per_module.map t ~f:(fun pp ->
match pp with
| Preprocess.No_preprocessing ->
let loc = Loc.none in
let pps = [ bisect_ppx ] in
let flags = [] in
let staged = false in
Preprocess.Pps { loc; pps; flags; staged }
| Preprocess.Pps { loc; pps; flags; staged } ->
let pps = bisect_ppx :: pps in
Preprocess.Pps { loc; pps; flags; staged }
| Action (loc, _)
| Future_syntax loc ->
User_error.raise ~loc
[ Pp.text
"Preprocessing with actions and future syntax cannot be used \
in conjunction with (bisect_ppx)"
])
end

module Lint = struct
Expand Down Expand Up @@ -380,7 +348,6 @@ module Buildable = struct
; flags : Ocaml_flags.Spec.t
; js_of_ocaml : Js_of_ocaml.t
; allow_overlapping_dependencies : bool
; bisect_ppx : bool
}

let decode ~in_library ~allow_re_export =
Expand Down Expand Up @@ -446,9 +413,6 @@ module Buildable = struct
field "js_of_ocaml" Js_of_ocaml.decode ~default:Js_of_ocaml.default
and+ allow_overlapping_dependencies =
field_b "allow_overlapping_dependencies"
and+ bisect_ppx =
field_b "bisect_ppx"
~check:(Dune_lang.Syntax.since bisect_ppx_syntax (1, 0))
and+ version = Dune_lang.Syntax.get_exn Stanza.syntax in
let foreign_stubs =
foreign_stubs
Expand Down Expand Up @@ -493,7 +457,6 @@ module Buildable = struct
; flags
; js_of_ocaml
; allow_overlapping_dependencies
; bisect_ppx
}

let has_foreign t =
Expand All @@ -508,11 +471,8 @@ module Buildable = struct
else
Preprocess.No_preprocessing

let preprocess t ~(lib_config : Lib_config.t) =
if t.bisect_ppx && lib_config.bisect_enabled then
Preprocess_map.add_bisect t.preprocess
else
t.preprocess
let preprocess t ~lib_config:_ =
t.preprocess
end

module Public_lib = struct
Expand Down Expand Up @@ -1013,19 +973,7 @@ module Library = struct
let synopsis = conf.synopsis in
let sub_systems = conf.sub_systems in
let ppx_runtime_deps = conf.ppx_runtime_libraries in
let pps =
let pps_without_bisect = Preprocess_map.pps conf.buildable.preprocess in
if lib_config.bisect_enabled && conf.buildable.bisect_ppx then
let bisect_ppx =
let bisect_name =
Lib_name.parse_string_exn (Loc.none, "bisect_ppx")
in
(Loc.none, bisect_name)
in
bisect_ppx :: pps_without_bisect
else
pps_without_bisect
in
let pps = Preprocess_map.pps conf.buildable.preprocess in
let virtual_deps = conf.virtual_deps in
let dune_version = Some conf.dune_version in
let implements = conf.implements in
Expand Down
4 changes: 1 addition & 3 deletions src/dune/dune_file.mli
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ module Buildable : sig
; flags : Ocaml_flags.Spec.t
; js_of_ocaml : Js_of_ocaml.t
; allow_overlapping_dependencies : bool
; bisect_ppx : bool
}

(** Check if the buildable has any foreign stubs or archives. *)
Expand All @@ -107,8 +106,7 @@ module Buildable : sig
(** Preprocessing specification used by all modules or [No_preprocessing] *)
val single_preprocess : t -> Preprocess.t

(** Includes bisect_ppx if specified by [lib_config] *)
val preprocess : t -> lib_config:Lib_config.t -> Preprocess_map.t
val preprocess : t -> lib_config:Lib_config.t -> Lint.t
end

module Public_lib : sig
Expand Down
18 changes: 8 additions & 10 deletions src/dune/exe_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ let executables_rules ~sctx ~dir ~expander ~dir_contents ~scope ~compile_info
let ml_sources = Dir_contents.ocaml dir_contents in
Ml_sources.modules_of_executables ml_sources ~first_exe ~obj_dir
in
let ctx = SC.context sctx in
let preprocess =
Dune_file.Buildable.preprocess exes.buildable ~lib_config:ctx.lib_config
in
let pp =
let ctx = Super_context.context sctx in
let preprocess =
Dune_file.Buildable.preprocess exes.buildable ~lib_config:ctx.lib_config
in
Preprocessing.make sctx ~dir ~dep_kind:Required ~scope ~expander ~preprocess
~preprocessor_deps:exes.buildable.preprocessor_deps
~lint:exes.buildable.lint ~lib_name:None
Expand Down Expand Up @@ -47,6 +47,7 @@ let executables_rules ~sctx ~dir ~expander ~dir_contents ~scope ~compile_info
(Module_name.to_string mod_name)
])
in
let ctx = SC.context sctx in
let explicit_js_mode = Dune_project.explicit_js_mode (Scope.project scope) in
let linkages =
let module L = Dune_file.Executables.Link_mode in
Expand Down Expand Up @@ -172,14 +173,11 @@ let executables_rules ~sctx ~dir ~expander ~dir_contents ~scope ~compile_info
let rules ~sctx ~dir ~dir_contents ~scope ~expander
(exes : Dune_file.Executables.t) =
let dune_version = Scope.project scope |> Dune_project.dune_version in
let ctx = SC.context sctx in
let pps =
Dune_file.Preprocess_map.pps
(Dune_file.Buildable.preprocess exes.buildable ~lib_config:ctx.lib_config)
in
let compile_info =
Lib.DB.resolve_user_written_deps_for_exes (Scope.libs scope) exes.names
exes.buildable.libraries ~pps ~dune_version
exes.buildable.libraries
~pps:(Dune_file.Preprocess_map.pps exes.buildable.preprocess)
~dune_version
~allow_overlaps:exes.buildable.allow_overlapping_dependencies
~optional:exes.optional ~forbidden_libraries:exes.forbidden_libraries
in
Expand Down
5 changes: 3 additions & 2 deletions src/dune/install_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end = struct
(Some loc, Install.Entry.make Stublibs a))
]

let keep_if ~(ctx : Context.t) ~external_lib_deps_mode expander =
let keep_if ~external_lib_deps_mode expander =
if external_lib_deps_mode then
fun ~scope:_ ->
Option.some
Expand All @@ -156,6 +156,7 @@ end = struct
Scope.project scope |> Dune_project.dune_version
in
let pps =
let ctx = Expander.context expander in
Dune_file.Preprocess_map.pps
(Dune_file.Buildable.preprocess exes.buildable
~lib_config:ctx.lib_config)
Expand Down Expand Up @@ -234,7 +235,7 @@ end = struct
in
let keep_if =
let external_lib_deps_mode = !Clflags.external_lib_deps_mode in
keep_if ~ctx ~external_lib_deps_mode
keep_if ~external_lib_deps_mode
in
Dir_with_dune.deep_fold stanzas ~init ~f:(fun d stanza acc ->
let { Dir_with_dune.ctx_dir = dir; scope; _ } = d in
Expand Down
1 change: 0 additions & 1 deletion src/dune/lib_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type t =
; ccomp_type : Ocaml_config.Ccomp_type.t
; profile : Profile.t
; ocaml_version : string
; bisect_enabled : bool
}

let var_map =
Expand Down
1 change: 0 additions & 1 deletion src/dune/lib_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type t =
; ccomp_type : Ocaml_config.Ccomp_type.t
; profile : Profile.t
; ocaml_version : string
; bisect_enabled : bool
}

val allowed_in_enabled_if : (string * Dune_lang.Syntax.Version.t) list
Expand Down
Loading

0 comments on commit a930946

Please sign in to comment.