fix expunged pacakges

Ignore-this: 105de7e1d9d2cc2a95d492fae5945450

Expunge only packages tagged for a pragraam

darcs-hash:20120122025410-c41ad-f3df3a4e3e331b262003c522c1c5e5c9594832b5
This commit is contained in:
Jeremie Dimino 2012-01-22 03:54:10 +01:00
parent 0506de1850
commit cf0fde1559
3 changed files with 39 additions and 25 deletions

7
_tags
View File

@ -6,11 +6,8 @@
# Do not use optcomp on syntax extensions
<syntax/*.ml>: -pa_optcomp
# Needed for building toplevels
<src/**>: use_compiler_libs, pkg_lambda-term, pkg_findlib
<**/*.top>: use_utop
<src/emacs/uTop_emacs_top.top>: pkg_threads
<src/gtk/uTop_gtk_top.top>: pkg_threads, pkg_lablgtk2, pkg_lwt.glib
# Completion needs compiler interfaces
<src/common/*.ml>: use_compiler_libs
# OASIS_START
# OASIS_STOP

View File

@ -10,6 +10,9 @@
(* OASIS_START *)
(* OASIS_STOP *)
(* List of toplevels. *)
let toplevels = ["console"; "emacs"; "gtk"]
let () =
dispatch
(fun hook ->
@ -19,12 +22,22 @@ let () =
Options.make_links := false
| After_rules ->
(* Copy tags from *.byte to *.top *)
List.iter
(fun name ->
let src = "src" / name / ("uTop_" ^ name ^ "_top.byte")
and dst = "src" / name / ("uTop_" ^ name ^ "_top.top") in
tag_file
dst
(List.filter
(* Remove the "file:..." tag *)
(fun tag -> not (String.is_prefix "file:" tag))
(Tags.elements (tags_of_pathname src))))
toplevels;
(* Use -linkpkg for creating toplevels *)
flag ["ocaml"; "link"; "toplevel"] & A"-linkpkg";
(* Allow -g for toplevels. *)
flag ["ocaml"; "link"; "toplevel"; "debug"] & A "-g";
(* Optcomp *)
flag ["ocaml"; "compile"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"];
flag ["ocaml"; "ocamldep"; "pa_optcomp"] & S[A"-ppopt"; A "syntax/pa_optcomp.cmo"];
@ -37,22 +50,29 @@ let () =
(* Add directories for compiler-libraries: *)
let paths = List.filter Sys.file_exists [path; path / "typing"; path / "parsing"; path / "utils"] in
let paths = List.map (fun path -> S[A "-I"; A path]) paths in
List.iter
(fun stage -> flag ["ocaml"; stage; "use_compiler_libs"] & S paths)
["compile"; "ocamldep"; "doc"; "link"];
let paths = List.map (fun path -> S [A "-I"; A path]) paths in
flag ["ocaml"; "compile"; "use_compiler_libs"] & S paths;
flag ["ocaml"; "ocamldep"; "use_compiler_libs"] & S paths;
flag ["ocaml"; "doc"; "use_compiler_libs"] & S paths;
(* Expunge compiler modules *)
rule "toplevel expunge"
~dep:"%.top"
~prod:"%.byte"
(fun env _ ->
(* Build the list of explicit dependencies. *)
let packages =
Tags.fold
(fun tag packages ->
if String.is_prefix "pkg_" tag then
String.after tag 4 :: packages
else
packages)
(tags_of_pathname (env "%.byte"))
[]
in
(* Build the list of dependencies. *)
let deps = Findlib.topological_closure [Findlib.query "lambda-term";
Findlib.query "findlib";
Findlib.query "threads";
Findlib.query "lablgtk2";
Findlib.query "lwt.glib"] in
let deps = Findlib.topological_closure (List.rev_map Findlib.query packages) in
(* Build the set of locations of dependencies. *)
let locs = List.fold_left (fun set pkg -> StringSet.add pkg.Findlib.location set) StringSet.empty deps in
(* Directories to search for .cmi: *)
@ -72,11 +92,9 @@ let () =
(Array.to_list (Pathname.readdir directory)))
directories StringSet.empty
in
Cmd(S[A(stdlib / "expunge");
A(env "%.top");
A(env "%.byte");
A"UTop"; A"Outcometree"; A"Topdirs"; A"Toploop";
S(List.map (fun x -> A x) (StringSet.elements modules))]))
Cmd (S [A (stdlib / "expunge");
A (env "%.top");
A (env "%.byte");
A "UTop"; S(List.map (fun x -> A x) (StringSet.elements modules))]))
| _ ->
())

View File

@ -174,5 +174,4 @@ and loop prompt buffer length =
| Some (command, argument) ->
process prompt buffer length command argument
let () =
Toploop.read_interactive_input := read_input
let () = Toploop.read_interactive_input := read_input