src/Doc/System/Sessions.thy
author wenzelm
Wed Mar 13 15:12:14 2013 +0100 (2013-03-13)
changeset 51417 d266f9329368
parent 51055 5c4be88f8747
child 52056 fc458f304f93
permissions -rw-r--r--
sessions may be organized via 'chapter' in ROOT;
wenzelm@48578
     1
theory Sessions
wenzelm@48578
     2
imports Base
wenzelm@48578
     3
begin
wenzelm@48578
     4
wenzelm@48584
     5
chapter {* Isabelle sessions and build management \label{ch:session} *}
wenzelm@48584
     6
wenzelm@48584
     7
text {* An Isabelle \emph{session} consists of a collection of related
wenzelm@51055
     8
  theories that may be associated with formal documents
wenzelm@51055
     9
  (\chref{ch:present}).  There is also a notion of \emph{persistent
wenzelm@48604
    10
  heap} image to capture the state of a session, similar to
wenzelm@48604
    11
  object-code in compiled programming languages.  Thus the concept of
wenzelm@48604
    12
  session resembles that of a ``project'' in common IDE environments,
wenzelm@48604
    13
  but the specific name emphasizes the connection to interactive
wenzelm@48604
    14
  theorem proving: the session wraps-up the results of
wenzelm@48604
    15
  user-interaction with the prover in a persistent form.
wenzelm@48584
    16
wenzelm@48604
    17
  Application sessions are built on a given parent session, which may
wenzelm@48604
    18
  be built recursively on other parents.  Following this path in the
wenzelm@48604
    19
  hierarchy eventually leads to some major object-logic session like
wenzelm@48604
    20
  @{text "HOL"}, which itself is based on @{text "Pure"} as the common
wenzelm@48604
    21
  root of all sessions.
wenzelm@48584
    22
wenzelm@48604
    23
  Processing sessions may take considerable time.  Isabelle build
wenzelm@48604
    24
  management helps to organize this efficiently.  This includes
wenzelm@48604
    25
  support for parallel build jobs, in addition to the multithreaded
wenzelm@48604
    26
  theory and proof checking that is already provided by the prover
wenzelm@48604
    27
  process itself.  *}
wenzelm@48604
    28
wenzelm@48578
    29
wenzelm@48578
    30
section {* Session ROOT specifications \label{sec:session-root} *}
wenzelm@48578
    31
wenzelm@48579
    32
text {* Session specifications reside in files called @{verbatim ROOT}
wenzelm@48579
    33
  within certain directories, such as the home locations of registered
wenzelm@48579
    34
  Isabelle components or additional project directories given by the
wenzelm@48579
    35
  user.
wenzelm@48579
    36
wenzelm@48579
    37
  The ROOT file format follows the lexical conventions of the
wenzelm@48579
    38
  \emph{outer syntax} of Isabelle/Isar, see also
wenzelm@48579
    39
  \cite{isabelle-isar-ref}.  This defines common forms like
wenzelm@48579
    40
  identifiers, names, quoted strings, verbatim text, nested comments
wenzelm@51417
    41
  etc.  The grammar for @{syntax session_chapter} and @{syntax
wenzelm@51417
    42
  session_entry} is given as syntax diagram below; each ROOT file may
wenzelm@51417
    43
  contain multiple specifications like this.  Chapters help to
wenzelm@51417
    44
  organize browser info (\secref{sec:info}), but have no formal
wenzelm@51417
    45
  meaning.  The default chapter is ``@{text "Unsorted"}''.
wenzelm@48579
    46
wenzelm@48582
    47
  Isabelle/jEdit (\secref{sec:tool-jedit}) includes a simple editing
wenzelm@51055
    48
  mode @{verbatim "isabelle-root"} for session ROOT files, which is
wenzelm@51055
    49
  enabled by default for any file of that name.
wenzelm@48579
    50
wenzelm@48579
    51
  @{rail "
wenzelm@51417
    52
    @{syntax_def session_chapter}: @'chapter' @{syntax name}
wenzelm@51417
    53
    ;
wenzelm@51417
    54
wenzelm@48579
    55
    @{syntax_def session_entry}: @'session' spec '=' (@{syntax name} '+')? body
wenzelm@48579
    56
    ;
wenzelm@48916
    57
    body: description? options? ( theories + ) files?
wenzelm@48579
    58
    ;
wenzelm@48738
    59
    spec: @{syntax name} groups? dir?
wenzelm@48579
    60
    ;
wenzelm@48579
    61
    groups: '(' (@{syntax name} +) ')'
wenzelm@48579
    62
    ;
wenzelm@48579
    63
    dir: @'in' @{syntax name}
wenzelm@48579
    64
    ;
wenzelm@48579
    65
    description: @'description' @{syntax text}
wenzelm@48579
    66
    ;
wenzelm@48579
    67
    options: @'options' opts
wenzelm@48579
    68
    ;
wenzelm@48605
    69
    opts: '[' ( (@{syntax name} '=' value | @{syntax name}) + ',' ) ']'
wenzelm@48605
    70
    ;
wenzelm@48605
    71
    value: @{syntax name} | @{syntax real}
wenzelm@48579
    72
    ;
wenzelm@48739
    73
    theories: @'theories' opts? ( @{syntax name} * )
wenzelm@48579
    74
    ;
wenzelm@48579
    75
    files: @'files' ( @{syntax name} + )
wenzelm@48579
    76
    "}
wenzelm@48579
    77
wenzelm@48579
    78
  \begin{description}
wenzelm@48579
    79
wenzelm@48579
    80
  \item \isakeyword{session}~@{text "A = B + body"} defines a new
wenzelm@48579
    81
  session @{text "A"} based on parent session @{text "B"}, with its
wenzelm@48579
    82
  content given in @{text body} (theories and auxiliary source files).
wenzelm@48579
    83
  Note that a parent (like @{text "HOL"}) is mandatory in practical
wenzelm@48579
    84
  applications: only Isabelle/Pure can bootstrap itself from nothing.
wenzelm@48579
    85
wenzelm@48579
    86
  All such session specifications together describe a hierarchy (tree)
wenzelm@48738
    87
  of sessions, with globally unique names.  The new session name
wenzelm@51055
    88
  @{text "A"} should be sufficiently long and descriptive to stand on
wenzelm@51055
    89
  its own in a potentially large library.
wenzelm@48579
    90
wenzelm@48579
    91
  \item \isakeyword{session}~@{text "A (groups)"} indicates a
wenzelm@48579
    92
  collection of groups where the new session is a member.  Group names
wenzelm@48579
    93
  are uninterpreted and merely follow certain conventions.  For
wenzelm@48579
    94
  example, the Isabelle distribution tags some important sessions by
wenzelm@48604
    95
  the group name called ``@{text "main"}''.  Other projects may invent
wenzelm@48604
    96
  their own conventions, but this requires some care to avoid clashes
wenzelm@48604
    97
  within this unchecked name space.
wenzelm@48579
    98
wenzelm@48579
    99
  \item \isakeyword{session}~@{text "A"}~\isakeyword{in}~@{text "dir"}
wenzelm@48738
   100
  specifies an explicit directory for this session; by default this is
wenzelm@48738
   101
  the current directory of the @{verbatim ROOT} file.
wenzelm@48579
   102
wenzelm@48579
   103
  All theories and auxiliary source files are located relatively to
wenzelm@48579
   104
  the session directory.  The prover process is run within the same as
wenzelm@48579
   105
  its current working directory.
wenzelm@48579
   106
wenzelm@48579
   107
  \item \isakeyword{description}~@{text "text"} is a free-form
wenzelm@48579
   108
  annotation for this session.
wenzelm@48579
   109
wenzelm@48579
   110
  \item \isakeyword{options}~@{text "[x = a, y = b, z]"} defines
wenzelm@48604
   111
  separate options (\secref{sec:system-options}) that are used when
wenzelm@48604
   112
  processing this session, but \emph{without} propagation to child
wenzelm@48604
   113
  sessions.  Note that @{text "z"} abbreviates @{text "z = true"} for
wenzelm@48604
   114
  Boolean options.
wenzelm@48579
   115
wenzelm@48579
   116
  \item \isakeyword{theories}~@{text "options names"} specifies a
wenzelm@48579
   117
  block of theories that are processed within an environment that is
wenzelm@48604
   118
  augmented by the given options, in addition to the global session
wenzelm@48604
   119
  options given before.  Any number of blocks of \isakeyword{theories}
wenzelm@48604
   120
  may be given.  Options are only active for each
wenzelm@48604
   121
  \isakeyword{theories} block separately.
wenzelm@48579
   122
wenzelm@48579
   123
  \item \isakeyword{files}~@{text "files"} lists additional source
wenzelm@48604
   124
  files that are involved in the processing of this session.  This
wenzelm@48604
   125
  should cover anything outside the formal content of the theory
wenzelm@48579
   126
  sources, say some auxiliary {\TeX} files that are required for
wenzelm@51055
   127
  document processing.  In contrast, files that are loaded formally
wenzelm@51055
   128
  within a theory, e.g.\ via @{keyword "ML_file"}, need not be
wenzelm@51055
   129
  declared again.
wenzelm@48579
   130
wenzelm@48579
   131
  \end{description}
wenzelm@48580
   132
*}
wenzelm@48579
   133
wenzelm@51055
   134
wenzelm@48580
   135
subsubsection {* Examples *}
wenzelm@48580
   136
wenzelm@48580
   137
text {* See @{file "~~/src/HOL/ROOT"} for a diversity of practically
wenzelm@51055
   138
  relevant situations, although it uses relatively complex
wenzelm@51055
   139
  quasi-hierarchic naming conventions like @{text "HOL\<dash>SPARK"},
wenzelm@51055
   140
  @{text "HOL\<dash>SPARK\<dash>Examples"}.  An alternative is to use
wenzelm@48738
   141
  unqualified names that are relatively long and descriptive, as in
wenzelm@48738
   142
  the Archive of Formal Proofs (\url{http://afp.sf.net}), for
wenzelm@48738
   143
  example. *}
wenzelm@48578
   144
wenzelm@48578
   145
wenzelm@48578
   146
section {* System build options \label{sec:system-options} *}
wenzelm@48578
   147
wenzelm@48580
   148
text {* See @{file "~~/etc/options"} for the main defaults provided by
wenzelm@48582
   149
  the Isabelle distribution.  Isabelle/jEdit (\secref{sec:tool-jedit})
wenzelm@48582
   150
  includes a simple editing mode @{verbatim "isabelle-options"} for
wenzelm@48582
   151
  this file-format.
wenzelm@48693
   152
wenzelm@51055
   153
  The following options are particulary relevant to build Isabelle
wenzelm@51055
   154
  sessions, in particular with document preparation
wenzelm@51055
   155
  (\chref{ch:present}).
wenzelm@51055
   156
wenzelm@51055
   157
  \begin{itemize}
wenzelm@51055
   158
wenzelm@51055
   159
  \item @{system_option_def "browser_info"} controls output of HTML
wenzelm@51055
   160
  browser info, see also \secref{sec:info}.
wenzelm@51055
   161
wenzelm@51055
   162
  \item @{system_option_def "document"} specifies the document output
wenzelm@51055
   163
  format, see @{tool document} option @{verbatim "-o"} in
wenzelm@51055
   164
  \secref{sec:tool-document}.  In practice, the most relevant values
wenzelm@51055
   165
  are @{verbatim "document=false"} or @{verbatim "document=pdf"}.
wenzelm@51055
   166
wenzelm@51055
   167
  \item @{system_option_def "document_output"} specifies an
wenzelm@51055
   168
  alternative directory for generated output of the document
wenzelm@51055
   169
  preparation system; the default is within the @{setting
wenzelm@51055
   170
  "ISABELLE_BROWSER_INFO"} hierarchy as explained in
wenzelm@51055
   171
  \secref{sec:info}.  See also @{tool mkroot}, which generates a
wenzelm@51055
   172
  default configuration with output readily available to the author of
wenzelm@51055
   173
  the document.
wenzelm@51055
   174
wenzelm@51055
   175
  \item @{system_option_def "document_variants"} specifies document
wenzelm@51055
   176
  variants as a colon-separated list of @{text "name=tags"} entries,
wenzelm@51055
   177
  corresponding to @{tool document} options @{verbatim "-n"} and
wenzelm@51055
   178
  @{verbatim "-t"}.
wenzelm@51055
   179
wenzelm@51055
   180
  For example, @{verbatim
wenzelm@51055
   181
  "document_variants=document:outline=/proof,/ML"} indicates two
wenzelm@51055
   182
  documents: the one called @{verbatim document} with default tags,
wenzelm@51055
   183
  and the other called @{verbatim outline} where proofs and ML
wenzelm@51055
   184
  sections are folded.
wenzelm@51055
   185
wenzelm@51055
   186
  Document variant names are just a matter of conventions.  It is also
wenzelm@51055
   187
  possible to use different document variant names (without tags) for
wenzelm@51055
   188
  different document root entries, see also
wenzelm@51055
   189
  \secref{sec:tool-document}.
wenzelm@51055
   190
wenzelm@51055
   191
  \item @{system_option_def "document_graph"} tells whether the
wenzelm@51055
   192
  generated document files should include a theory graph (cf.\
wenzelm@51055
   193
  \secref{sec:browse} and \secref{sec:info}).  The resulting EPS or
wenzelm@51055
   194
  PDF file can be included as graphics in {\LaTeX}.
wenzelm@51055
   195
wenzelm@51055
   196
  Note that this option is usually determined as static parameter of
wenzelm@51055
   197
  some session (e.g.\ within its @{verbatim ROOT} file) and \emph{not}
wenzelm@51055
   198
  given globally or on the command line of @{tool build}.
wenzelm@51055
   199
wenzelm@51055
   200
  \item @{system_option_def "threads"} determines the number of worker
wenzelm@51055
   201
  threads for parallel checking of theories and proofs.  The default
wenzelm@51055
   202
  @{text "0"} means that a sensible maximum value is determined by the
wenzelm@51055
   203
  underlying hardware.  For machines with many cores or with
wenzelm@51055
   204
  hyperthreading, this is often requires manual adjustment (on the
wenzelm@51055
   205
  command-line or within personal settings or preferences, not within
wenzelm@51055
   206
  a session @{verbatim ROOT}).
wenzelm@51055
   207
wenzelm@51055
   208
  \item @{system_option_def "condition"} specifies a comma-separated
wenzelm@51055
   209
  list of process environment variables (or Isabelle settings) that
wenzelm@51055
   210
  are required for the subsequent theories to be processed.
wenzelm@51055
   211
  Conditions are considered ``true'' if the corresponding environment
wenzelm@51055
   212
  value is defined and non-empty.
wenzelm@51055
   213
wenzelm@51055
   214
  For example, the @{verbatim "condition=ISABELLE_FULL_TEST"} may be
wenzelm@51055
   215
  used to guard extraordinary theories, which are meant to be enabled
wenzelm@51055
   216
  explicitly via some shell prefix @{verbatim "env ISABELLE_FULL_TEST=true"}
wenzelm@51055
   217
  before invoking @{tool build}.
wenzelm@51055
   218
wenzelm@51055
   219
  \item @{system_option_def "timeout"} specifies a real wall-clock
wenzelm@51055
   220
  timeout (in seconds) for the session as a whole.  The timer is
wenzelm@51055
   221
  controlled outside the ML process by the JVM that runs
wenzelm@51055
   222
  Isabelle/Scala.  Thus it is relatively reliable in canceling
wenzelm@51055
   223
  processes that get out of control, even if there is a deadlock
wenzelm@51055
   224
  without CPU time usage.
wenzelm@51055
   225
wenzelm@51055
   226
  \end{itemize}
wenzelm@51055
   227
wenzelm@48693
   228
  The @{tool_def options} tool prints Isabelle system options.  Its
wenzelm@48693
   229
  command-line usage is:
wenzelm@48693
   230
\begin{ttbox}
wenzelm@48693
   231
Usage: isabelle options [OPTIONS] [MORE_OPTIONS ...]
wenzelm@48693
   232
wenzelm@48693
   233
  Options are:
wenzelm@48693
   234
    -b           include $ISABELLE_BUILD_OPTIONS
wenzelm@50531
   235
    -l           list options
wenzelm@48693
   236
    -x FILE      export to FILE in YXML format
wenzelm@48693
   237
wenzelm@50531
   238
  Report Isabelle system options, augmented by MORE_OPTIONS given as
wenzelm@48693
   239
  arguments NAME=VAL or NAME.
wenzelm@48693
   240
\end{ttbox}
wenzelm@48693
   241
wenzelm@48693
   242
  The command line arguments provide additional system options of the
wenzelm@48693
   243
  form @{text "name"}@{verbatim "="}@{text "value"} or @{text name}
wenzelm@48693
   244
  for Boolean options.
wenzelm@48693
   245
wenzelm@48693
   246
  Option @{verbatim "-b"} augments the implicit environment of system
wenzelm@48693
   247
  options by the ones of @{setting ISABELLE_BUILD_OPTIONS}, cf.\
wenzelm@48693
   248
  \secref{sec:tool-build}.
wenzelm@48693
   249
wenzelm@48693
   250
  Option @{verbatim "-x"} specifies a file to export the result in
wenzelm@48693
   251
  YXML format, instead of printing it in human-readable form.
wenzelm@48580
   252
*}
wenzelm@48578
   253
wenzelm@48578
   254
wenzelm@48578
   255
section {* Invoking the build process \label{sec:tool-build} *}
wenzelm@48578
   256
wenzelm@48602
   257
text {* The @{tool_def build} tool invokes the build process for
wenzelm@48578
   258
  Isabelle sessions.  It manages dependencies between sessions,
wenzelm@48578
   259
  related sources of theories and auxiliary files, and target heap
wenzelm@48578
   260
  images.  Accordingly, it runs instances of the prover process with
wenzelm@48578
   261
  optional document preparation.  Its command-line usage
wenzelm@48578
   262
  is:\footnote{Isabelle/Scala provides the same functionality via
wenzelm@48578
   263
  \texttt{isabelle.Build.build}.}
wenzelm@48602
   264
\begin{ttbox}
wenzelm@48602
   265
Usage: isabelle build [OPTIONS] [SESSIONS ...]
wenzelm@48578
   266
wenzelm@48578
   267
  Options are:
wenzelm@48737
   268
    -D DIR       include session directory and select its sessions
wenzelm@49131
   269
    -R           operate on requirements of selected sessions
wenzelm@48578
   270
    -a           select all sessions
wenzelm@48578
   271
    -b           build heap images
wenzelm@48595
   272
    -c           clean build
wenzelm@48737
   273
    -d DIR       include session directory
wenzelm@48578
   274
    -g NAME      select session group NAME
wenzelm@48578
   275
    -j INT       maximum number of parallel jobs (default 1)
wenzelm@48903
   276
    -l           list session source files
wenzelm@48578
   277
    -n           no build -- test dependencies only
wenzelm@48578
   278
    -o OPTION    override session configuration OPTION
wenzelm@48578
   279
                 (via NAME=VAL or NAME)
wenzelm@48578
   280
    -s           system build mode: produce output in ISABELLE_HOME
wenzelm@48578
   281
    -v           verbose
wenzelm@48578
   282
wenzelm@48578
   283
  Build and manage Isabelle sessions, depending on implicit
wenzelm@48578
   284
  ISABELLE_BUILD_OPTIONS="..."
wenzelm@48578
   285
wenzelm@48578
   286
  ML_PLATFORM="..."
wenzelm@48578
   287
  ML_HOME="..."
wenzelm@48578
   288
  ML_SYSTEM="..."
wenzelm@48578
   289
  ML_OPTIONS="..."
wenzelm@48578
   290
\end{ttbox}
wenzelm@48578
   291
wenzelm@48578
   292
  \medskip Isabelle sessions are defined via session ROOT files as
wenzelm@48578
   293
  described in (\secref{sec:session-root}).  The totality of sessions
wenzelm@48578
   294
  is determined by collecting such specifications from all Isabelle
wenzelm@48578
   295
  component directories (\secref{sec:components}), augmented by more
wenzelm@48578
   296
  directories given via options @{verbatim "-d"}~@{text "DIR"} on the
wenzelm@48578
   297
  command line.  Each such directory may contain a session
wenzelm@48650
   298
  \texttt{ROOT} file with several session specifications.
wenzelm@48578
   299
wenzelm@48684
   300
  Any session root directory may refer recursively to further
wenzelm@48684
   301
  directories of the same kind, by listing them in a catalog file
wenzelm@48684
   302
  @{verbatim "ROOTS"} line-by-line.  This helps to organize large
wenzelm@48684
   303
  collections of session specifications, or to make @{verbatim "-d"}
wenzelm@48684
   304
  command line options persistent (say within @{verbatim
wenzelm@48684
   305
  "$ISABELLE_HOME_USER/ROOTS"}).
wenzelm@48684
   306
wenzelm@48604
   307
  \medskip The subset of sessions to be managed is determined via
wenzelm@48578
   308
  individual @{text "SESSIONS"} given as command-line arguments, or
wenzelm@48604
   309
  session groups that are given via one or more options @{verbatim
wenzelm@48578
   310
  "-g"}~@{text "NAME"}.  Option @{verbatim "-a"} selects all sessions.
wenzelm@48604
   311
  The build tool takes session dependencies into account: the set of
wenzelm@48604
   312
  selected sessions is completed by including all ancestors.
wenzelm@48578
   313
wenzelm@49131
   314
  \medskip Option @{verbatim "-R"} reverses the selection in the sense
wenzelm@49131
   315
  that it refers to its requirements: all ancestor sessions excluding
wenzelm@49131
   316
  the original selection.  This allows to prepare the stage for some
wenzelm@49131
   317
  build process with different options, before running the main build
wenzelm@49131
   318
  itself (without option @{verbatim "-R"}).
wenzelm@49131
   319
wenzelm@48737
   320
  \medskip Option @{verbatim "-D"} is similar to @{verbatim "-d"}, but
wenzelm@48737
   321
  selects all sessions that are defined in the given directories.
wenzelm@48737
   322
wenzelm@48604
   323
  \medskip The build process depends on additional options
wenzelm@48604
   324
  (\secref{sec:system-options}) that are passed to the prover
wenzelm@48604
   325
  eventually.  The settings variable @{setting_ref
wenzelm@48604
   326
  ISABELLE_BUILD_OPTIONS} allows to provide additional defaults, e.g.\
wenzelm@48604
   327
  \texttt{ISABELLE_BUILD_OPTIONS="document=pdf threads=4"}. Moreover,
wenzelm@48604
   328
  the environment of system build options may be augmented on the
wenzelm@48604
   329
  command line via @{verbatim "-o"}~@{text "name"}@{verbatim
wenzelm@48604
   330
  "="}@{text "value"} or @{verbatim "-o"}~@{text "name"}, which
wenzelm@48604
   331
  abbreviates @{verbatim "-o"}~@{text "name"}@{verbatim"=true"} for
wenzelm@48604
   332
  Boolean options.  Multiple occurrences of @{verbatim "-o"} on the
wenzelm@48604
   333
  command-line are applied in the given order.
wenzelm@48578
   334
wenzelm@48578
   335
  \medskip Option @{verbatim "-b"} ensures that heap images are
wenzelm@48578
   336
  produced for all selected sessions.  By default, images are only
wenzelm@48578
   337
  saved for inner nodes of the hierarchy of sessions, as required for
wenzelm@48578
   338
  other sessions to continue later on.
wenzelm@48578
   339
wenzelm@48595
   340
  \medskip Option @{verbatim "-c"} cleans all descendants of the
wenzelm@48595
   341
  selected sessions before performing the specified build operation.
wenzelm@48595
   342
wenzelm@48595
   343
  \medskip Option @{verbatim "-n"} omits the actual build process
wenzelm@48595
   344
  after the preparatory stage (including optional cleanup).  Note that
wenzelm@48595
   345
  the return code always indicates the status of the set of selected
wenzelm@48595
   346
  sessions.
wenzelm@48595
   347
wenzelm@48578
   348
  \medskip Option @{verbatim "-j"} specifies the maximum number of
wenzelm@48604
   349
  parallel build jobs (prover processes).  Each prover process is
wenzelm@48604
   350
  subject to a separate limit of parallel worker threads, cf.\ system
wenzelm@48604
   351
  option @{system_option_ref threads}.
wenzelm@48578
   352
wenzelm@48578
   353
  \medskip Option @{verbatim "-s"} enables \emph{system mode}, which
wenzelm@48578
   354
  means that resulting heap images and log files are stored in
wenzelm@48578
   355
  @{verbatim "$ISABELLE_HOME/heaps"} instead of the default location
wenzelm@48578
   356
  @{setting ISABELLE_OUTPUT} (which is normally in @{setting
wenzelm@48578
   357
  ISABELLE_HOME_USER}, i.e.\ the user's home directory).
wenzelm@48578
   358
wenzelm@48903
   359
  \medskip Option @{verbatim "-v"} increases the general level of
wenzelm@48903
   360
  verbosity.  Option @{verbatim "-l"} lists the source files that
wenzelm@48903
   361
  contribute to a session.
wenzelm@48578
   362
*}
wenzelm@48578
   363
wenzelm@48578
   364
subsubsection {* Examples *}
wenzelm@48578
   365
wenzelm@48578
   366
text {*
wenzelm@48578
   367
  Build a specific logic image:
wenzelm@48578
   368
\begin{ttbox}
wenzelm@48578
   369
isabelle build -b HOLCF
wenzelm@48578
   370
\end{ttbox}
wenzelm@48578
   371
wenzelm@48604
   372
  \smallskip Build the main group of logic images:
wenzelm@48578
   373
\begin{ttbox}
wenzelm@48578
   374
isabelle build -b -g main
wenzelm@48578
   375
\end{ttbox}
wenzelm@48578
   376
wenzelm@48595
   377
  \smallskip Provide a general overview of the status of all Isabelle
wenzelm@48595
   378
  sessions, without building anything:
wenzelm@48578
   379
\begin{ttbox}
wenzelm@48578
   380
isabelle build -a -n -v
wenzelm@48578
   381
\end{ttbox}
wenzelm@48578
   382
wenzelm@48595
   383
  \smallskip Build all sessions with HTML browser info and PDF
wenzelm@48595
   384
  document preparation:
wenzelm@48578
   385
\begin{ttbox}
wenzelm@48578
   386
isabelle build -a -o browser_info -o document=pdf
wenzelm@48578
   387
\end{ttbox}
wenzelm@48578
   388
wenzelm@48604
   389
  \smallskip Build all sessions with a maximum of 8 parallel prover
wenzelm@48604
   390
  processes and 4 worker threads each (on a machine with many cores):
wenzelm@48578
   391
\begin{ttbox}
wenzelm@48578
   392
isabelle build -a -j8 -o threads=4
wenzelm@48578
   393
\end{ttbox}
wenzelm@48595
   394
wenzelm@48595
   395
  \smallskip Build some session images with cleanup of their
wenzelm@48595
   396
  descendants, while retaining their ancestry:
wenzelm@48595
   397
\begin{ttbox}
wenzelm@48595
   398
isabelle build -b -c HOL-Boogie HOL-SPARK
wenzelm@48595
   399
\end{ttbox}
wenzelm@48595
   400
wenzelm@48595
   401
  \smallskip Clean all sessions without building anything:
wenzelm@48595
   402
\begin{ttbox}
wenzelm@48595
   403
isabelle build -a -n -c
wenzelm@48595
   404
\end{ttbox}
wenzelm@48737
   405
wenzelm@48737
   406
  \smallskip Build all sessions from some other directory hierarchy,
wenzelm@48737
   407
  according to the settings variable @{verbatim "AFP"} that happens to
wenzelm@48737
   408
  be defined inside the Isabelle environment:
wenzelm@48737
   409
\begin{ttbox}
wenzelm@48737
   410
isabelle build -D '$AFP'
wenzelm@48737
   411
\end{ttbox}
wenzelm@49131
   412
wenzelm@49131
   413
  \smallskip Inform about the status of all sessions required for AFP,
wenzelm@49131
   414
  without building anything yet:
wenzelm@49131
   415
\begin{ttbox}
wenzelm@49131
   416
isabelle build -D '$AFP' -R -v -n
wenzelm@49131
   417
\end{ttbox}
wenzelm@48578
   418
*}
wenzelm@48578
   419
wenzelm@50406
   420
wenzelm@50406
   421
section {* Build dialog *}
wenzelm@50406
   422
wenzelm@50406
   423
text {* The @{tool_def build_dialog} provides a simple GUI wrapper to
wenzelm@50406
   424
  the tool Isabelle @{tool build} tool.  This enables user interfaces
wenzelm@50406
   425
  like Isabelle/jEdit \secref{sec:tool-jedit} to provide read-made
wenzelm@50406
   426
  logic image on startup.  Its command-line usage is:
wenzelm@50406
   427
\begin{ttbox}
wenzelm@50406
   428
Usage: isabelle build_dialog [OPTIONS] LOGIC
wenzelm@50406
   429
wenzelm@50406
   430
  Options are:
wenzelm@50406
   431
    -L OPTION    default logic via system option
wenzelm@50406
   432
    -d DIR       include session directory
wenzelm@50546
   433
    -l NAME      logic session name
wenzelm@50406
   434
    -s           system build mode: produce output in ISABELLE_HOME
wenzelm@50406
   435
wenzelm@50546
   436
  Build Isabelle logic session image via GUI dialog (default: \$ISABELLE_LOGIC).
wenzelm@50406
   437
\end{ttbox}
wenzelm@50406
   438
wenzelm@50546
   439
  \medskip Option @{verbatim "-l"} specifies an explicit logic session
wenzelm@50546
   440
  name.  Option @{verbatim "-L"} specifies a system option name as
wenzelm@50546
   441
  fall-back to determine the logic session name.  If both are omitted
wenzelm@50546
   442
  or have empty value, @{setting ISABELLE_LOGIC} is used as default.
wenzelm@50406
   443
wenzelm@50406
   444
  \medskip Options @{verbatim "-d"} and @{verbatim "-s"} have the same
wenzelm@50546
   445
  meaning as for the command-line @{tool build} tool itself.  *}
wenzelm@50406
   446
wenzelm@48578
   447
end