diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-06-17 13:12:40 +0000 |
---|---|---|
committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2013-06-17 13:12:40 +0000 |
commit | e7a503dc2a836e5d1ec6495d56e48255c9cbb71f (patch) | |
tree | 9724f213c0241b452ea789549e1de65472ee38db | |
parent | 9d3592791cde79cee4a77e3a0b8aca0e828f7ff1 (diff) |
PR#4502: ocamlbuild now reliably excludes the build-dir from hygiene check
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13794 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | ocamlbuild/main.ml | 14 | ||||
-rw-r--r-- | ocamlbuild/testsuite/level0.ml | 34 |
4 files changed, 45 insertions, 8 deletions
@@ -57,6 +57,7 @@ Bug fixes: - PR#3679: Warning display problems - PR#3963: Graphics.wait_next_event in Win32 hangs if window closed - PR#4079: Queue.copy is now tail-recursive +- PR#4502: ocamlbuild now reliably excludes the build-dir from hygiene check - PR#4762: ?? is not used at all, but registered as a lexer token - PR#4887: input_char after close_in crashes ocaml (msvc runtime) - PR#4994: ocaml-mode doesn't work with xemacs21 @@ -746,9 +746,9 @@ ocamlbuild.byte: ocamlc ocamlbuild-mixed-boot ./build/ocamlbuild-byte-only.sh #endif -ocamlbuild.native: ocamlopt ocamlbuild-mixed-boot +ocamlbuild.native: ocamlopt ocamlbuild-mixed-boot otherlibrariesopt ./build/ocamlbuild-native-only.sh -ocamlbuildlib.native: ocamlopt ocamlbuild-mixed-boot +ocamlbuildlib.native: ocamlopt ocamlbuild-mixed-boot otherlibrariesopt ./build/ocamlbuildlib-native-only.sh ocamlbuild-mixed-boot: ocamlc diff --git a/ocamlbuild/main.ml b/ocamlbuild/main.ml index c65a1afb3..6cfecc458 100644 --- a/ocamlbuild/main.ml +++ b/ocamlbuild/main.ml @@ -121,16 +121,20 @@ let proceed () = (List.mem name ["_oasis"] || (String.length name > 0 && name.[0] <> '_')) && (name <> !Options.build_dir && not (List.mem name !Options.exclude_dirs)) && begin - if path_name <> Filename.current_dir_name && Pathname.is_directory path_name then + not (path_name <> Filename.current_dir_name && Pathname.is_directory path_name) + || begin let tags = tags_of_pathname path_name in - if Tags.mem "include" tags - || List.mem path_name !Options.include_dirs then + (if Tags.mem "include" tags + || List.mem path_name !Options.include_dirs then (entry_include_dirs := path_name :: !entry_include_dirs; true) else Tags.mem "traverse" tags || List.exists (Pathname.is_prefix path_name) !Options.include_dirs - || List.exists (Pathname.is_prefix path_name) target_dirs - else true + || List.exists (Pathname.is_prefix path_name) target_dirs) + && ((* beware: !Options.build_dir is an absolute directory *) + Pathname.normalize !Options.build_dir + <> Pathname.normalize (Pathname.pwd/path_name)) + end end end (Slurp.slurp Filename.current_dir_name) diff --git a/ocamlbuild/testsuite/level0.ml b/ocamlbuild/testsuite/level0.ml index defa249bd..20e8cebd4 100644 --- a/ocamlbuild/testsuite/level0.ml +++ b/ocamlbuild/testsuite/level0.ml @@ -132,10 +132,42 @@ test "SyntaxFlag" ~targets:("dummy.native",[]) ();; test "NativeMliCmi" - ~description:"check that ocamlopt is used for .mli->.cmi when tag 'native' is set" + ~description:"check that ocamlopt is used for .mli->.cmi when tag 'native' is set \ + (part of PR#4613)" ~tree:[T.f "foo.mli" ~content:"val bar : int"] ~options:[`ocamlc "toto";(*using ocamlc would fail*) `tags["native"]] ~matching:[M.f "_build/foo.cmi"] ~targets:("foo.cmi",[]) ();; +test "NoIncludeNoHygiene1" + ~description:"check that hygiene checks are only done in traversed directories\ + (PR#4502)" + ~tree:[T.d "must_ignore" [ T.f "dirty.mli" ~content:"val bug : int"]; + T.f "hello.ml" ~content:"print_endline \"Hello, World!\""; + T.f "_tags" ~content:"<must_ignore>: -traverse"] + ~pre_cmd:"ocamlc -c must_ignore/dirty.mli" + (* will make hygiene fail if must_ignore/ is checked *) + ~targets:("hello.byte",[]) ();; + +test "NoIncludeNoHygiene2" + ~description:"check that hygiene checks are not done on the -build-dir \ + (PR#4502)" + ~tree:[T.d "must_ignore" [ T.f "dirty.mli" ~content:"val bug : int"]; + T.f "hello.ml" ~content:"print_endline \"Hello, World!\""; + T.f "_tags" ~content:""] + ~options:[`build_dir "must_ignore"] + ~pre_cmd:"ocamlc -c must_ignore/dirty.mli" + (* will make hygiene fail if must_ignore/ is checked *) + ~targets:("hello.byte",[]) ();; + +test "NoIncludeNoHygiene3" + ~description:"check that hygiene checks are not done on excluded dirs (PR#4502)" + ~tree:[T.d "must_ignore" [ T.f "dirty.mli" ~content:"val bug : int"]; + T.f "hello.ml" ~content:"print_endline \"Hello, World!\""; + T.f "_tags" ~content:""] + ~options:[`X "must_ignore"] + ~pre_cmd:"ocamlc -c must_ignore/dirty.mli" + (* will make hygiene fail if must_ignore/ is checked *) + ~targets:("hello.byte",[]) ();; + run ~root:"_test";; |