149 Before running a Scala or Java process, the Isabelle system implicitly |
149 Before running a Scala or Java process, the Isabelle system implicitly |
150 ensures that all provided modules are compiled and packaged (as jars). It is |
150 ensures that all provided modules are compiled and packaged (as jars). It is |
151 also possible to invoke @{tool scala_build} explicitly, with extra options. |
151 also possible to invoke @{tool scala_build} explicitly, with extra options. |
152 |
152 |
153 \<^medskip> |
153 \<^medskip> |
154 The syntax of in \<^path>\<open>etc/build.props\<close> follows a regular Java properties |
154 The syntax of \<^path>\<open>etc/build.props\<close> follows a regular Java properties |
155 file\<^footnote>\<open>\<^url>\<open>https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Properties.html#load(java.io.Reader)\<close>\<close>, |
155 file\<^footnote>\<open>\<^url>\<open>https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/Properties.html#load(java.io.Reader)\<close>\<close>, |
156 but the encoding is \<^verbatim>\<open>UTF-8\<close>, instead of historic \<^verbatim>\<open>ISO 8859-1\<close> from the API |
156 but the encoding is \<^verbatim>\<open>UTF-8\<close>, instead of historic \<^verbatim>\<open>ISO 8859-1\<close> from the API |
157 documentation. |
157 documentation. |
158 |
158 |
159 The subsequent properties are relevant for the Scala/Java build process. |
159 The subsequent properties are relevant for the Scala/Java build process. |
191 A \<^emph>\<open>normal entry\<close> refers to a single \<^verbatim>\<open>jar\<close> file name, possibly with |
191 A \<^emph>\<open>normal entry\<close> refers to a single \<^verbatim>\<open>jar\<close> file name, possibly with |
192 settings variables as usual. E.g. \<^file>\<open>$ISABELLE_SCALA_JAR\<close> for the main |
192 settings variables as usual. E.g. \<^file>\<open>$ISABELLE_SCALA_JAR\<close> for the main |
193 \<^file>\<open>$ISABELLE_HOME/lib/classes/isabelle.jar\<close> (especially relevant for |
193 \<^file>\<open>$ISABELLE_HOME/lib/classes/isabelle.jar\<close> (especially relevant for |
194 add-on modules). |
194 add-on modules). |
195 |
195 |
196 A \<^emph>\<open>special entry\<close> is of of the form \<^verbatim>\<open>env:\<close>\<open>variable\<close> and refers to a |
196 A \<^emph>\<open>special entry\<close> is of the form \<^verbatim>\<open>env:\<close>\<open>variable\<close> and refers to a |
197 settings variable from the Isabelle environment: its value may consist of |
197 settings variable from the Isabelle environment: its value may consist of |
198 multiple \<^verbatim>\<open>jar\<close> entries (separated by colons). Environment variables are |
198 multiple \<^verbatim>\<open>jar\<close> entries (separated by colons). Environment variables are |
199 not expanded recursively. |
199 not expanded recursively. |
200 |
200 |
201 \<^item> \<^verbatim>\<open>resources\<close> is a list of files that should be included in the resulting |
201 \<^item> \<^verbatim>\<open>resources\<close> is a list of files that should be included in the resulting |
332 |
332 |
333 text \<open> |
333 text \<open> |
334 The service class \<^scala_type>\<open>isabelle.Scala.Functions\<close> collects Scala |
334 The service class \<^scala_type>\<open>isabelle.Scala.Functions\<close> collects Scala |
335 functions of type \<^scala_type>\<open>isabelle.Scala.Fun\<close>: by registering |
335 functions of type \<^scala_type>\<open>isabelle.Scala.Fun\<close>: by registering |
336 instances via \<^verbatim>\<open>services\<close> in \<^path>\<open>etc/build.props\<close> |
336 instances via \<^verbatim>\<open>services\<close> in \<^path>\<open>etc/build.props\<close> |
337 (\secref{sec:scala-build}), it is becomes possible to invoke Isabelle/Scala |
337 (\secref{sec:scala-build}), it becomes possible to invoke Isabelle/Scala |
338 from Isabelle/ML (see below). |
338 from Isabelle/ML (see below). |
339 |
339 |
340 An example is the predefined collection of |
340 An example is the predefined collection of |
341 \<^scala_type>\<open>isabelle.Scala.Functions\<close> in |
341 \<^scala_type>\<open>isabelle.Scala.Functions\<close> in |
342 \<^file>\<open>$ISABELLE_HOME/etc/build.props\<close>. The overall list of registered functions |
342 \<^file>\<open>$ISABELLE_HOME/etc/build.props\<close>. The overall list of registered functions |
380 \<^ML_type>\<open>string list -> string list\<close> or \<^ML_type>\<open>string -> string\<close>, |
380 \<^ML_type>\<open>string list -> string list\<close> or \<^ML_type>\<open>string -> string\<close>, |
381 depending on the definition in Isabelle/Scala. Evaluation is subject to |
381 depending on the definition in Isabelle/Scala. Evaluation is subject to |
382 interrupts within the ML runtime environment as usual. A \<^scala>\<open>null\<close> |
382 interrupts within the ML runtime environment as usual. A \<^scala>\<open>null\<close> |
383 result in Scala raises an exception \<^ML>\<open>Scala.Null\<close> in ML. The execution |
383 result in Scala raises an exception \<^ML>\<open>Scala.Null\<close> in ML. The execution |
384 of \<open>@{scala}\<close> works via a Scala future on a bounded thread farm, while |
384 of \<open>@{scala}\<close> works via a Scala future on a bounded thread farm, while |
385 \<open>@{scala_thread}\<close> always forks a separate Java thread. |
385 \<open>@{scala_thread}\<close> always forks a separate Java/VM thread. |
386 |
386 |
387 The standard approach of representing datatypes via strings works via XML in |
387 The standard approach of representing datatypes via strings works via XML in |
388 YXML transfer syntax. See Isabelle/ML operations and modules @{ML |
388 YXML transfer syntax. See Isabelle/ML operations and modules @{ML |
389 YXML.string_of_body}, @{ML YXML.parse_body}, @{ML_structure XML.Encode}, |
389 YXML.string_of_body}, @{ML YXML.parse_body}, @{ML_structure XML.Encode}, |
390 @{ML_structure XML.Decode}; similarly for Isabelle/Scala. Isabelle symbols |
390 @{ML_structure XML.Decode}; similarly for Isabelle/Scala. Isabelle symbols |