Before this path, [Param_tags.init()] was run before
[Plugin.execute_plugin_if_needed()]. It had the downside of making
plugin compilation warn about any unknown parametrized tag present in
a _tags file, even those that would be defined by the plugin
itself. The fix is to [really_acknowledge] only the tags used for the
plugin compilation, and delay the full [Param_tags.init()] call to
after plugin execution.
This was discussed in detail in PR#5680, comment 0010186.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14015 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
The long-term goal is to allow composability of myocamlbuild.ml
plugins, as discussed in PR#5680 and PR#6093. The current attempt is
to give to the myocamlbuild.ml all the tags that apply to it according
to the _tags file and other configuration options passed to
ocamlbuild. For example, if -use-ocamlfind is used, any
(true: package(foo)) or ("myocamlbuild.ml": package(foo)) line would
have the ocamlfind package `foo` usable from myocamlbuild.ml.
The present implementation has two downsides:
(1) Relying on _tags is a bit unpleasant because people that write
(true: foo) lines do not expect it to get also applied to the
plugin compilation (though in fact the previous implementation
used "profile" and "debug" tags passed in this way). There might
be case of build breaking because the (true: tags) passed make
myocamlbuild.ml compilation fail. A workaround would be to add
("myocamlbuild.ml": -foo) for any problematic tag `foo` -- I don't
expect this situation to happen in practice, but you never know.
(2) The general tags passed to the myocamlbuild.ml compilation have
been rather arbitrarily set to (ocaml,program,link,byte)
(or native). OCamlbuild doesn't really have tags to describe going
straight from a .ml (or several) to an executable, as its usual
rules enforce separate compilation and linking steps. This means
that some ocamlbuild rule might misbehave due to the absence of
the "compile" step, but in practice most tag-driven compilation
options are such that the link-options are a superset of the
compile-options, so this will still work in many case
(in particular for ocamlfind packages). Long-term, it may be
better to split myocamlbuild.ml compilation in the usual compile
then link steps.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13999 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
If in the future we want to be able to use information from _tags when
compiling the myocamlbuild.ml plugin, we should compile the plugin
*after* the OCaml-tags rules of Ocaml_specific have been loaded
(OCaml_specific.init()). This patch does not change the plugin
compilation, but it delays it to the end of the initialization phase
to allow such future changes.
This means that the parsing of configuration files
(including traversing directories to find _tags files in depth) will
be done twice (once during the first run to compile the plugin, and
then once when run from the plugin). Of these operations, the only
that has user-visible consequences (and the first candidate to
performance degradations) is the hygiene checking, which we therefore
disable during the first run. Note that checksumming files is not
duplicated (it is done after the initialization phase).
Note that the semantics of _tags files in subdirectories is that they
are only ranging over files in that subhierarchy (even "true: foo"
lines do not apply to the files in ancestor or
sibling directories). This means that no _tags file in a subdirectory
can add tags to "myocamlbuild.ml". If performance of file traversing
ever was to become an issue, we could therefore skip it and read only
the root _tags file if present.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13998 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02