diff --git a/infer/src/jbuild.in b/infer/src/jbuild.in index 2191ef2d9..da53a67bb 100644 --- a/infer/src/jbuild.in +++ b/infer/src/jbuild.in @@ -3,46 +3,24 @@ let ( ^/ ) = Filename.concat -(* Compute the list of all the source files. - - This is needed until jbuilder supports finding sources in subdirectories somehow - (https://github.com/janestreet/jbuilder/issues/34). *) - -let sources = - let src_dirs = - ( if facebook then - (* do not use the symlinks in src/facebook/: jbuilder will not detect that the files have changed if they are hidden behind a symlink *) - "../../facebook/skel/infer/src/facebook" - else "opensource" ) - :: ( ( if clang then ["clang"; ("unit" ^/ "clang")] - else ["clang_stubs"; ("unit" ^/ "clang_stubs")] ) - @ [ (if java then "java" else "java_stubs") - ; (if python && facebook then "python" else "python_stubs") - ; "absint" - ; "backend" - ; "base" - ; "bufferoverrun" - ; "checkers" - ; "eradicate" - ; "harness" - ; "integration" - ; "IR" - ; "labs" - ; "quandary" - ; "unit" ] ) - in - let files = ref [] in - let ml_suffixes = [".ml"; ".mli"; ".mll"; ".mly"] in - let add_file dir file = - if List.exists (Filename.check_suffix file) ml_suffixes then files := (dir ^/ file) :: !files - in - let one_dir dir = - (* absolute path so that running jbuilder from any subdirectory (in particular from src/Makefile) - points at the right original files in ocamlc's error messages *) - let abs_dir = Sys.getcwd () ^/ dir in - Array.iter (add_file abs_dir) (Sys.readdir dir) - in - List.iter one_dir src_dirs ; !files +let source_dirs = + (if facebook then "facebook" else "opensource") + :: ( ( if clang then ["clang"; ("unit" ^/ "clang")] + else ["clang_stubs"; ("unit" ^/ "clang_stubs")] ) + @ [ (if java then "java" else "java_stubs") + ; (if python && facebook then "python" else "python_stubs") + ; "absint" + ; "backend" + ; "base" + ; "bufferoverrun" + ; "checkers" + ; "eradicate" + ; "harness" + ; "integration" + ; "IR" + ; "labs" + ; "quandary" + ; "unit" ] ) let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else [] @@ -52,16 +30,6 @@ let infer_cflags = let infer_libraries = "InferStdlib" :: "InferGenerated" :: common_libraries -(** Return the best copy action for a given [source] file. That is, when possibly, use "copy#" so - that jump-to-defition and compiler errors go to the right original source file, otherwise do a - normal copy. *) -let copy_action_of_source source = - if Filename.check_suffix source ".mly" then - (* menhir doesn't support '# 1 ""' directives at the start of the file inserted by - copy# actions *) - "copy" - else "copy#" - (** The build stanzas to be passed to jbuilder *) let stanzas = ( if clang then @@ -107,10 +75,13 @@ let stanzas = |} (String.concat " " infer_cflags) (String.concat " " common_optflags) (String.concat " " infer_binaries) ] - @ List.map - (fun source -> - Printf.sprintf "(rule (%s %s %s))" (copy_action_of_source source) source - (Filename.basename source)) - sources + @ ( List.map + (fun source_dir -> + [ Printf.sprintf "(copy_files# %s/*.ml{,i,l})" source_dir + ; (* menhir doesn't support '# 1 ""' directives at the start of the file inserted by + copy# actions *) + Printf.sprintf "(copy_files %s/*.mly)" source_dir ]) + source_dirs + |> List.concat ) ;; String.concat "\n" stanzas |> Jbuild_plugin.V1.send diff --git a/opam b/opam index 98ba69aaf..1f80452f2 100644 --- a/opam +++ b/opam @@ -34,7 +34,7 @@ depends: [ "ctypes" {>="0.9.2"} "extlib-compat" "javalib" {>="2.3.3"} - "jbuilder" {build & >="1.0+beta11"} + "jbuilder" {build & >="1.0+beta14"} "mtime" "ocamlfind" {build} "ounit" {="2.0.0"} diff --git a/opam.lock b/opam.lock index 6c5ed8387..2f6fbaedd 100644 --- a/opam.lock +++ b/opam.lock @@ -24,7 +24,7 @@ fieldslib = v0.9.0 integers = 0.2.2 jane-street-headers = v0.9.0 javalib = 2.3.3 -jbuilder = 1.0+beta13 +jbuilder = 1.0+beta14 menhir = 20170712 mtime = 1.1.0 num = 0