[ocamlbuild] slides...
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7872 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
cd94bace32
commit
064941eb51
|
@ -0,0 +1,92 @@
|
|||
00:00:00 0 (0) STARTING -------- |
|
||||
00:00:00 1 (0) back.ml.depends O------- |
|
||||
00:00:00 8 (0) keyword.mli.depends O-b---i- |
|
||||
00:00:00 16 (0) mark.cmi O-B---I- /
|
||||
00:00:00 20 (0) stringSet.cmi O-B---I- /
|
||||
00:00:00 24 (0) time.mli.depends O-b---i- /
|
||||
00:00:00 32 (0) stdlib.ml.depends O-b---i- -
|
||||
00:00:00 35 (0) stringSet.cmx ONb---i- -
|
||||
00:00:00 37 (0) settings.cmx ONb---i- -
|
||||
00:00:00 44 (0) lineCount.cmx ONb---i- \
|
||||
00:00:00 45 (0) interface.ml.depends Onb---i- \
|
||||
00:00:00 45 (0) interface.ml.depends Onb---i- \
|
||||
00:00:01 52 (0) stringMap.ml.depends Onb---i- |
|
||||
00:00:01 53 (0) printer.cmx ONb---i- |
|
||||
00:00:01 53 (0) printer.cmx ONb---i- |
|
||||
00:00:01 57 (0) time.cmx ONb---i- /
|
||||
00:00:01 64 (0) partialGrammar.cmi OnB---I- /
|
||||
00:00:01 67 (0) parameters.ml.depends Onb---i- /
|
||||
00:00:01 72 (0) misc.ml.depends Onb---i- -
|
||||
00:00:01 74 (0) keyword.ml.depends Onb---i- -
|
||||
00:00:01 77 (0) error.cmi OnB---I- -
|
||||
00:00:01 82 (0) parameters.cmx ONb---i- \
|
||||
00:00:01 84 (0) action.cmx ONb---i- \
|
||||
00:00:01 87 (0) parser.mli.depends Onb---i- \
|
||||
00:00:02 96 (0) parserAux.cmx ONb---i- |
|
||||
00:00:02 103 (0) tarjan.ml.depends Onb---i- |
|
||||
00:00:02 106 (0) unionFind.cmx ONb---i- |
|
||||
00:00:02 108 (0) lexer.mll Onb---i- /
|
||||
00:00:02 108 (0) lexer.mll Onb---i- /
|
||||
00:00:02 110 (0) lexer.cmo OnB---i- -
|
||||
00:00:02 111 (0) parser.cmx ONb---i- -
|
||||
00:00:02 112 (0) partialGrammar.cmx ONb---i- -
|
||||
00:00:02 114 (0) lexer.cmx ONb---i- \
|
||||
00:00:02 116 (0) codeBits.mli.depends Onb---i- \
|
||||
00:00:03 118 (0) preFront.cmx ONb---i- |
|
||||
00:00:03 120 (0) tokenType.cmx ONb---i- |
|
||||
00:00:03 123 (0) inliner.cmi OnB---I- |
|
||||
00:00:03 126 (0) traverse.cmx ONb---i- /
|
||||
00:00:03 126 (0) traverse.cmx ONb---i- /
|
||||
00:00:03 129 (0) code.cmi OnB---I- /
|
||||
00:00:03 131 (0) lr1.mli.depends Onb---i- /
|
||||
00:00:03 134 (0) lookahead.mli.depends Onb---i- -
|
||||
00:00:03 137 (0) gMap.ml.depends Onb---i- -
|
||||
00:00:03 144 (0) lr1.cmi OnB---I- -
|
||||
00:00:03 146 (0) item.ml.depends Onb---i- -
|
||||
00:00:03 149 (0) patricia.cmi OnB---I- \
|
||||
00:00:03 151 (0) patricia.cmx ONb---i- \
|
||||
00:00:03 151 (0) patricia.cmx ONb---i- \
|
||||
00:00:04 154 (0) front.cmi OnB---I- |
|
||||
00:00:04 164 (0) listMonad.ml.depends Onb---i- |
|
||||
00:00:04 167 (0) listMonad.cmx ONb---i- |
|
||||
00:00:04 170 (0) infer.cmi OnB---I- /
|
||||
00:00:04 171 (0) lexmli.mll Onb---i- /
|
||||
00:00:04 172 (0) lexmli.ml.depends Onb---i- /
|
||||
00:00:04 174 (0) lexdep.mll Onb---i- -
|
||||
00:00:04 177 (0) interface.cmx ONb---i- -
|
||||
00:00:04 178 (0) IO.ml.depends Onb---i- \
|
||||
00:00:04 181 (0) lexmli.cmx ONb---i- \
|
||||
00:00:04 183 (0) IO.cmx ONb---i- \
|
||||
00:00:05 187 (0) infer.cmx ONb---i- |
|
||||
00:00:05 190 (0) dot.cmi OnB---I- |
|
||||
00:00:05 193 (0) compressedBitSet.cmi OnB---I- /
|
||||
00:00:05 195 (0) dot.cmx ONb---i- /
|
||||
00:00:05 197 (0) grammar.cmx ONb---i- /
|
||||
00:00:05 197 (0) grammar.cmx ONb---i- /
|
||||
00:00:05 197 (0) grammar.cmx ONb---i- -
|
||||
00:00:05 200 (0) infiniteArray.cmi OnB---I- -
|
||||
00:00:05 201 (0) item.cmx ONb---i- -
|
||||
00:00:05 204 (0) breadth.mli.depends Onb---i- \
|
||||
00:00:05 208 (0) invariant.ml.depends Onb---i- \
|
||||
00:00:06 212 (0) invariant.cmx ONb---i- |
|
||||
00:00:06 213 (0) inliner.cmx ONb---i- |
|
||||
00:00:06 214 (0) code.cmx ONb---i- /
|
||||
00:00:06 216 (0) back.native ONbP--iL -
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
||||
Finished, 216 targets (0 cached) in 00:00:06.
|
|
@ -1,6 +1,8 @@
|
|||
documentclass :beamer, :t, :compress, :red
|
||||
usepackage :inputenc, :utf8
|
||||
|
||||
words "**OCaml**", "**ocamlbuild**", "_Makefile_"
|
||||
|
||||
title "ocamlbuild, a tool for automatic compilation of OCaml projects"
|
||||
authors "Berke Durak", "Nicolas Pouillard"
|
||||
institute do
|
||||
|
@ -12,33 +14,41 @@ end
|
|||
usetheme :JuanLesPins
|
||||
usefonttheme :serif
|
||||
beamer_header '\setbeamercolor*{titlelike}{parent=structure}'
|
||||
at_begin_subsection do
|
||||
at_begin_section do
|
||||
slide "Outline" do
|
||||
tableofcontents 'sectionstyle=show/hide',
|
||||
tableofcontents 'sectionstyle=show/shaded',
|
||||
'subsectionstyle=show/shaded/hide'
|
||||
end
|
||||
end
|
||||
beamer_footline
|
||||
beamer_footline 50, 0
|
||||
|
||||
words "**OCaml**"
|
||||
|
||||
words "??ocamlbuild??"
|
||||
extend do
|
||||
module ::Rslide::Tags
|
||||
class CodeCaml < Code
|
||||
end
|
||||
class CodeTags < Code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
maketitle
|
||||
|
||||
slide "Why such a tool?" do
|
||||
* To make our OCaml life easier.
|
||||
* A Makefile is so painful.
|
||||
h1 "Introduction"
|
||||
|
||||
slide "Why such a tool?", '<+->' do
|
||||
* To make our OCaml life easier
|
||||
* To stop writing poor MakefileS
|
||||
* To have a tool that Just works™
|
||||
end
|
||||
|
||||
slide "What does ocamlbuild handle?" do
|
||||
slide "What does ocamlbuild handle?", '<+->' do
|
||||
|
||||
box "Regular OCaml projects of arbitrary size" do
|
||||
> Trivially handled using the command line options.
|
||||
end
|
||||
|
||||
box "Mostly regular OCaml projects with common exceptions" do
|
||||
> Requires writing one _tag_ file that declares those exceptions.
|
||||
> Requires writing one tag file (__tags_) that declares those exceptions.
|
||||
end
|
||||
|
||||
box "Almost any project" do
|
||||
|
@ -47,70 +57,272 @@ slide "What does ocamlbuild handle?" do
|
|||
|
||||
end
|
||||
|
||||
slide "What kind of services for a project?" do
|
||||
* Compilation of the whole project.
|
||||
* Minimal re-compilation after a change.
|
||||
* Other builds like the documentation.
|
||||
* Different build directories at a same time.
|
||||
* Cleaning of what's built.
|
||||
* Keeping an hygienic source directory.
|
||||
* Saving time!
|
||||
slide "What does ocamlbuild provide?" do
|
||||
list do
|
||||
overlay 1,2 do
|
||||
* Automated whole-project compilation
|
||||
* Minimal recompilation
|
||||
* Lots of useful targets (doc, debugging, profiling...)
|
||||
* Supports multiple build directories
|
||||
* Automatic and safe cleaning
|
||||
* A source directory uncluttered by object files
|
||||
end
|
||||
overlay 2 do
|
||||
* Saves time and money!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
h1 "Regular OCaml projects"
|
||||
|
||||
slide "What's a regular OCaml project?" do
|
||||
* OCaml compilation units (ml and mli files).
|
||||
* OCaml parsers and lexers specifications (mly and mll files).
|
||||
* Internal packages and libraries (mlpack, mllib).
|
||||
* Use of external libraries.
|
||||
* One main OCaml unit that represents the starting point.
|
||||
box "It's a project that needs no exceptions from the standard rules:" do
|
||||
* Has compilation units (_ml_ and _mli_ files)
|
||||
* May have parsers and lexers (_mly_ and _mll_ files)
|
||||
* May use packages, libraries and toplevels (_ml{pack,lib,top}_)
|
||||
* May link with external libraries
|
||||
* Has one main OCaml unit from which these units are reachable
|
||||
end
|
||||
end
|
||||
|
||||
slide "How difficult are regular projects?" do
|
||||
*
|
||||
slide "How difficult is it to compile regular projects by hand?" do
|
||||
box "OCaml has subtle compilation rules" do
|
||||
* Interfaces (_.mli_) can be absent, yet buildable (_.mly_)
|
||||
* Native and bytecode suffixes and settings differ
|
||||
* Native packages are difficult to do (_-for-pack_)
|
||||
* Linkage order must be correctly computed
|
||||
* Include directories must be ordered
|
||||
* _ocamldep_ gives partial information (too conservative)
|
||||
end
|
||||
end
|
||||
|
||||
slide "How does ocamlbuild manage all that?" do
|
||||
> It has a lot of hand-crafted Ocaml-specific compilation logic!
|
||||
box "A dynamic exploration approach", '<2>' do
|
||||
* Start from the given targets
|
||||
* Attempt to discover dependencies using _ocamldep_
|
||||
* _ocamldep_ cannot always be trusted: backtrack if necessary
|
||||
* Launch compilations and discover more dependencies
|
||||
end
|
||||
end
|
||||
|
||||
slide "Demo..." do
|
||||
box "Many projects can be compiled with a single command:" do
|
||||
* Menhir: _ocamlbuild -lib unix back.native_
|
||||
* Hevea: _ocamlbuild latexmain.native_
|
||||
* Ergo: _ocamlbuild main.native_
|
||||
* Ocamlgraph: _ocamlbuild -cflags -for-pack,Ocamlgraph demo.native_
|
||||
* ...
|
||||
end
|
||||
box "To be fair..." do
|
||||
> Some of these projects require that a _version.ml_
|
||||
or _stdlib.ml_ file be generated beforehand.
|
||||
end
|
||||
end
|
||||
|
||||
h1 "Dealing with exceptions to standard rules"
|
||||
|
||||
slide "What's an exception?" do
|
||||
box "Some flags can be different for some files" do
|
||||
* Enable/disable some warning flags.
|
||||
* Debugging (-g), profiling (-p), type annotations flags,
|
||||
recursive types, -linkall, -thread, -custom.
|
||||
box "Files that need specific flags" do
|
||||
* Warnings to be enabled or disabled
|
||||
* Debugging (_-g_), profiling (_-p_), type annotation,
|
||||
recursive types, _-linkall_, _-thread_, _-custom_...
|
||||
end
|
||||
* Have to link this binary with that library.
|
||||
* Include or exclude that directory.
|
||||
* Some dependencies.
|
||||
end
|
||||
|
||||
slide "??Make?? and exceptions" do
|
||||
* The ??make?? tool can handle rules but not exceptions.
|
||||
* With ??make?? exceptions are encoded as specific rules.
|
||||
* This generally makes rules and exceptions tightly bound by variables.
|
||||
* This way totally doesn't scale, and is not *modular*.
|
||||
end
|
||||
|
||||
slide "The tags, our way to specify exceptions" do
|
||||
box "Rules produce commands with *tagged holes*" do
|
||||
: let tagged_hole = tags_for(ml)++"ocaml"++"compile"++"byte" in
|
||||
Cmd(S[A"ocamlc"; A"-c"; T(tagged_hole); P ml; A"-o"; Px cmo])
|
||||
end
|
||||
box "These holes can be filled by some command pieces (flags)" do
|
||||
: flag ["ocaml"; "compile"; "byte"; "rectypes"] (A"-rectypes")
|
||||
end
|
||||
box "Files can also be tagged and make things happen" do
|
||||
: "foo/bar.ml": rectypes
|
||||
list do
|
||||
* Units that need external C libraries
|
||||
* Binaries that need external OCaml libraries
|
||||
* Directories that must be included or excluded
|
||||
* Dependencies that cannot be discovered
|
||||
end
|
||||
end
|
||||
|
||||
slide "The tags file (_tags)" do
|
||||
* Each line is a pattern and a set of tags.
|
||||
* The pattern is a boolean tree (*and*, *or*, *not*).
|
||||
* Leafs are either constant strings or glob patterns.
|
||||
* In the set of tags, they can appear positively or negatively.
|
||||
slide "_Make_ and exceptions" do
|
||||
* The _make_ tool can't handle exceptions very well
|
||||
* Needs exceptions to be encoded as specific rules
|
||||
* This generally makes rules and exceptions tightly bound by variables
|
||||
* This creates non-modular makefiles that don't *scale*
|
||||
end
|
||||
|
||||
slide "" do
|
||||
|
||||
slide "The tags, our way to specify exceptions", 'fragile=singleslide' do
|
||||
list do
|
||||
* The _tags file is made of lines
|
||||
* Each line is made of a pattern and a list of signed tags
|
||||
* A line adds or removes tags from matching files
|
||||
* Patterns are boolean combinations of shell-like globbing expressions
|
||||
end
|
||||
code_tags do
|
||||
: "funny.ml": rectypes
|
||||
<**/*.ml*>: warn_A, warn_error_A, debug, dtypes
|
||||
<**/*.cmx>: inline(9)
|
||||
"foo.ml" or "bar.ml": warn_v, warn_error_v
|
||||
"vendor.ml": -warn_A, -warn_error_A
|
||||
<main.{byte,native}>: use_unix
|
||||
"main.byte": use_dynlink, linkall
|
||||
"test": not_hygienic
|
||||
<satsolver.cm[io]>: precious
|
||||
end
|
||||
end
|
||||
|
||||
slide "A big thanks to" do
|
||||
* Alain, Xavier, Michel...
|
||||
end
|
||||
slide "How tags and rules give commands", 'fragile=singleslide' do
|
||||
box "Files are tagged using tagging rules" do
|
||||
code_tags do
|
||||
: "foo/bar.ml": rectypes
|
||||
end
|
||||
end
|
||||
box "Rules then produce commands with *tagged holes*" do
|
||||
code_caml do
|
||||
: let tagged_hole =
|
||||
tags_for(ml)++"ocaml"++"compile"++"byte" in
|
||||
Cmd(S[A"ocamlc";A"-c";T tagged_hole;P ml;A"-o";P cmo])
|
||||
end
|
||||
end
|
||||
box "These holes are filled by command fragments (such as flags)" do
|
||||
code_caml do
|
||||
: flag ["ocaml"; "compile"; "byte"; "rectypes"]
|
||||
(A"-rectypes")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
slide "Tags and dependencies", 'fragile=singleslide' do
|
||||
box "One can define dependencies triggered by combinations of tags" do
|
||||
code_caml do
|
||||
: dep ["ocaml"; "link"; "byte"; "program"; "plugin:foo"]
|
||||
["plugin/pluginlib.cma"; "plugin/plugin_foo.cmo"]
|
||||
end
|
||||
end
|
||||
box "By tagging files we make things happen" do
|
||||
code_tags do
|
||||
: "test.byte": plugin:foo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
h1 "Writing an ocamlbuild plugin"
|
||||
|
||||
slide "Not a specific language, but plain OCaml code" do
|
||||
* Plugins are compiled on the fly
|
||||
* Dynamic configuration is feasible
|
||||
box "With a plugin one can:" do
|
||||
* Extend rules (add new ones, override old ones)
|
||||
* Add flags and dependencies based on tags
|
||||
* Tag files
|
||||
* Change options
|
||||
* Define the directory structure precisely
|
||||
* Help _ocamldep_
|
||||
* Specify external libraries
|
||||
end
|
||||
end
|
||||
|
||||
slide "A plugin example" do
|
||||
> Let's read it in live...
|
||||
end
|
||||
|
||||
# slide "ocamlbuild scales" do
|
||||
# > Indeed ocamlbuild is used as an experimental replacement in OCaml itself.
|
||||
# end
|
||||
|
||||
h1 "General features"
|
||||
|
||||
slide "Parallel execution where applicable" do
|
||||
* You select the maximum number of jobs (_-j N_)
|
||||
* Rules know how to ask for parallel targets
|
||||
* The system keeps things scheduled correctly
|
||||
* Example: Separate compilation of byte code
|
||||
* (Optimal scheduling would require a static graph)
|
||||
end
|
||||
|
||||
slide "A status bar for your visual comfort" do
|
||||
* Compilation tools echo commands and their output
|
||||
* This creates a long and boring output that scrolls too fast
|
||||
* Here you can keep an eye on what is going on!
|
||||
* It succinctly displays time, number of targets, and tags
|
||||
* Command outputs are correctly multiplexed
|
||||
* A trace of the commands executed is kept in a log file
|
||||
* This log file can be used as the basis of a shell script
|
||||
example do
|
||||
invisible_join do
|
||||
count = 0
|
||||
mod = 1
|
||||
File.read("manual/trace.out").each do |line|
|
||||
count += 1
|
||||
next if count % mod != 0
|
||||
line.gsub!("\\", "|")
|
||||
line.latex_encode!
|
||||
line.gsub!(/( +)/) { "\\hspace{#{0.49 * $1.size}em}" }
|
||||
line.chomp!
|
||||
s = "\\only<#{count / mod}>{\\tt #{line}}%\n"
|
||||
verbatim_text s
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
slide "Hygiene and sterilization" do
|
||||
* ocamlbuild has a Hygiene Squad (HS) that checks your source tree for cleanliness
|
||||
box "It has preconceived but useful cleanliness notions", '<1->' do
|
||||
* Files dirty by default: _.cmi_, _.cmo_, _.cma_, _.cmx_...
|
||||
* _ocamllex_/_ocamlyacc_ files: _.ml_ *if* _.mll_, _.ml_&_.mli_ *if* _.mly_...
|
||||
end
|
||||
box "If unsatisfied, the HS produces a sterilization script", '<2->' do
|
||||
* Read it carefully (or work with versioning)
|
||||
* Run at your own risks
|
||||
end
|
||||
box "HS can be told of exceptions", '<3->' do
|
||||
> Files or directories tagged as __not_hygienic__ or _precious_.
|
||||
end
|
||||
end
|
||||
|
||||
slide "Some supported tools" do
|
||||
box "_Menhir_ as an _ocamlyacc_ replacement", '<1->' do
|
||||
* Enabled with the __use_menhir__ global tag or the __-use-menhir__ option
|
||||
* Handles implicit dependencies using _--infer_
|
||||
end
|
||||
box "_Ocamldoc_ to build your doc", '<2->' do
|
||||
* Separated construction using (_-dump_/_-load_)
|
||||
* Handles ??HTML??, ??LaTeX??, ??Man??, ??Dot??, ??TeXi??
|
||||
end
|
||||
# box "_ocamlmklib_, _ocamlmktop_" do
|
||||
# > Basic support using _.mllib_ and _.mltop_ files
|
||||
# end
|
||||
box "_Camlp4_ aware", '<3->' do
|
||||
* Tags allow to setup any installed _Camlp4_ preprocessor
|
||||
* Fine grained dependencies help a lot...
|
||||
end
|
||||
end
|
||||
|
||||
h1 "Conclusion"
|
||||
|
||||
slide "Resume" do
|
||||
box "ocamlbuild can be used in three ways:", '<1->' do
|
||||
* With only command-line options for fully regular projects
|
||||
* With the __tags_ file for intermediate projects
|
||||
* With a plugin for the most complex projects
|
||||
end
|
||||
box "ocamlbuild saves your time by:", '<2->' do
|
||||
* Building your project gently
|
||||
* Compiling only as necessary
|
||||
* Running commands in parallel
|
||||
* Keeping your house clean
|
||||
* Letting you concentrate on your code!
|
||||
end
|
||||
end
|
||||
|
||||
slide "Acknowledgments" do
|
||||
box "For enlightening discussions about OCaml internals:", '<1->' do
|
||||
* Xavier Leroy
|
||||
* Damien Doligez
|
||||
end
|
||||
box "For his insights about OCaml dependencies:", '<2->' do
|
||||
* Alain Frisch
|
||||
end
|
||||
box "For letting this happen:", '<3->' do
|
||||
* Michel Mauny
|
||||
end
|
||||
end
|
||||
|
||||
slide "Conclusion", '<+->' do
|
||||
* ocamlbuild is not perfect but already damn useful
|
||||
* It will be in 3.10, so feel free to use it
|
||||
* Try it now! It's in the CVS!
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue