Prefer constants in Scala, to make this independent from component context
This commit is contained in:
parent
44819bff02
commit
94ce3fdec2
|
@ -4,6 +4,7 @@ no_build = false
|
|||
requirements = \
|
||||
env:ISABELLE_SCALA_JAR
|
||||
sources = \
|
||||
src/scala/dof.scala \
|
||||
src/scala/dof_document_build.scala \
|
||||
src/scala/dof_mkroot.scala \
|
||||
src/scala/dof_tools.scala
|
||||
|
|
21
etc/options
21
etc/options
|
@ -8,23 +8,6 @@ public option dof_template : string = "scrreprt-modern"
|
|||
public option dof_ontologies : string = "Isabelle_DOF.technical_report Isabelle_DOF.scholarly_paper"
|
||||
-- "Isabelle/DOF ontologies (separated by blanks)"
|
||||
|
||||
option dof_version : string = "Unreleased"
|
||||
-- "Isabelle/DOF version"
|
||||
(* "Unreleased" for development, semantic version for releases *)
|
||||
|
||||
option dof_isabelle : string = "2022"
|
||||
(*for install-afp only*)
|
||||
option dof_isabelle : string = "2022"
|
||||
option dof_afp : string = "afp-2022-10-27"
|
||||
|
||||
option dof_latest_version : string = "1.3.0"
|
||||
option dof_latest_isabelle : string = "Isabelle2021-1"
|
||||
option dof_latest_doi : string = "10.5281/zenodo.6810799"
|
||||
option dof_generic_doi : string = "10.5281/zenodo.3370482"
|
||||
|
||||
option dof_url : string = "https://git.logicalhacking.com/Isabelle_DOF/Isabelle_DOF"
|
||||
-- "Isabelle/DOF source repository"
|
||||
|
||||
option dof_artifact_dir : string = "releases/Isabelle_DOF/Isabelle_DOF"
|
||||
-- "Isabelle/DOF release artifacts"
|
||||
|
||||
option dof_artifact_host : string = "artifacts.logicalhacking.com"
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c)
|
||||
* 2021-2022 The University of Exeter.
|
||||
* 2021-2022 The University of Paris-Saclay.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
package isabelle.dof
|
||||
|
||||
|
||||
object DOF {
|
||||
val isabelle_version = "2022"
|
||||
|
||||
val version = "Unreleased"
|
||||
// Isabelle/DOF version: "Unreleased" for development, semantic version for releases
|
||||
|
||||
val session = "Isabelle_DOF"
|
||||
|
||||
val latest_version = "1.3.0"
|
||||
val latest_isabelle = "Isabelle2021-1"
|
||||
val latest_doi = "10.5281/zenodo.6810799"
|
||||
val generic_doi = "10.5281/zenodo.3370482"
|
||||
|
||||
val url = "https://git.logicalhacking.com/Isabelle_DOF/Isabelle_DOF"
|
||||
// Isabelle/DOF source repository
|
||||
|
||||
val artifact_dir = "releases/Isabelle_DOF/Isabelle_DOF"
|
||||
// Isabelle/DOF release artifacts
|
||||
|
||||
val artifact_host = "artifacts.logicalhacking.com"
|
||||
}
|
|
@ -58,8 +58,7 @@ object DOF_Document_Build
|
|||
File.content(path, xml).output(latex_output(_, file_pos = path.implode_symbolic))
|
||||
.write(directory.doc_dir)
|
||||
}
|
||||
val isabelle_dof_dir = context.session_context.sessions_structure("Isabelle_DOF").dir
|
||||
// print(context.options.string("dof_url"));
|
||||
val isabelle_dof_dir = context.session_context.sessions_structure(DOF.session).dir
|
||||
|
||||
// copy Isabelle/DOF LaTeX templates
|
||||
val template_dir = isabelle_dof_dir + Path.explode("document-templates")
|
||||
|
@ -82,16 +81,16 @@ object DOF_Document_Build
|
|||
|
||||
// create dof-config.sty
|
||||
File.write(directory.doc_dir+Path.explode("dof-config.sty"), """
|
||||
\newcommand{\isabelleurl}{https://isabelle.in.tum.de/website-Isabelle2022/""" + context.options.string("dof_isabelle") + """}
|
||||
\newcommand{\dofurl}{""" + context.options.string("dof_url") + """}
|
||||
\newcommand{\dof@isabelleversion}{""" + context.options.string("dof_isabelle") + """}
|
||||
\newcommand{\isabellefullversion}{""" + context.options.string("dof_isabelle") + """\xspace}
|
||||
\newcommand{\dof@version}{""" + context.options.string("dof_version") + """}
|
||||
\newcommand{\dof@artifacturl}{""" + context.options.string("dof_artifact_dir") + """}
|
||||
\newcommand{\doflatestversion}{""" + context.options.string("dof_latest_version") + """}
|
||||
\newcommand{\isadoflatestdoi}{""" + context.options.string("dof_latest_doi") + """}
|
||||
\newcommand{\isadofgenericdoi}{""" + context.options.string("dof_generic_doi") + """}
|
||||
\newcommand{\isabellelatestversion}{""" + context.options.string("dof_latest_isabelle") + """}
|
||||
\newcommand{\isabelleurl}{https://isabelle.in.tum.de/website-Isabelle2022/""" + DOF.isabelle_version + """}
|
||||
\newcommand{\dofurl}{""" + DOF.url + """}
|
||||
\newcommand{\dof@isabelleversion}{""" + DOF.isabelle_version + """}
|
||||
\newcommand{\isabellefullversion}{""" + DOF.isabelle_version + """\xspace}
|
||||
\newcommand{\dof@version}{""" + DOF.version + """}
|
||||
\newcommand{\dof@artifacturl}{""" + DOF.artifact_dir + """}
|
||||
\newcommand{\doflatestversion}{""" + DOF.latest_version + """}
|
||||
\newcommand{\isadoflatestdoi}{""" + DOF.latest_doi + """}
|
||||
\newcommand{\isadofgenericdoi}{""" + DOF.generic_doi + """}
|
||||
\newcommand{\isabellelatestversion}{""" + DOF.latest_isabelle + """}
|
||||
""")
|
||||
directory
|
||||
}
|
||||
|
|
|
@ -147,10 +147,10 @@ Now use the following command line to build the session:
|
|||
var init_repos = false
|
||||
var help = false
|
||||
var session_name = ""
|
||||
var session_parent = "Isabelle_DOF"
|
||||
var session_parent = DOF.session
|
||||
var ontologies:List[String] = List()
|
||||
var template = session_parent + ".scrartcl"
|
||||
val default_ontologies = List(session_parent+".scholarly_paper")
|
||||
var template = DOF.session + ".scrartcl"
|
||||
val default_ontologies = List(DOF.session + ".scholarly_paper")
|
||||
|
||||
val getopts = Getopts("""
|
||||
Usage: isabelle dof_mkroot [OPTIONS] [DIRECTORY]
|
||||
|
@ -182,7 +182,7 @@ Usage: isabelle dof_mkroot [OPTIONS] [DIRECTORY]
|
|||
case _ => getopts.usage()
|
||||
}
|
||||
|
||||
mkroot(session_parent=session_parent, session_name = session_name, session_dir = session_dir, init_repos = init_repos,
|
||||
ontologies = ontologies, template = template, progress = new Console_Progress)
|
||||
mkroot(session_parent = session_parent, session_name = session_name, session_dir = session_dir,
|
||||
init_repos = init_repos, ontologies = ontologies, template = template, progress = new Console_Progress)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -55,22 +55,22 @@ text \<open>
|
|||
\<^item> access to options in Isabelle/ML:
|
||||
|
||||
\<^item> implicit (for the running ML session)
|
||||
\<^ML>\<open>Options.default_string \<^system_option>\<open>dof_url\<close>\<close>
|
||||
\<^ML>\<open>Options.default_string \<^system_option>\<open>dof_isabelle\<close>\<close>
|
||||
|
||||
\<^item> explicit (e.g. for each theories section in
|
||||
\<^file>\<open>$ISABELLE_HOME/src/Pure/Tools/build.ML\<close>):
|
||||
\<^ML>\<open>fn options => Options.string options \<^system_option>\<open>dof_url\<close>\<close>
|
||||
\<^ML>\<open>fn options => Options.string options \<^system_option>\<open>dof_isabelle\<close>\<close>
|
||||
|
||||
\<^item> access in Isabelle/Scala is always explicit; the initial options
|
||||
should be created only once and passed around as explicit argument:
|
||||
|
||||
\<^scala>\<open>{
|
||||
val options = isabelle.Options.init();
|
||||
options.string("dof_url");
|
||||
options.string("dof_isabelle");
|
||||
}\<close>
|
||||
|
||||
Note: there are no antiquotations in Isabelle/Scala, so the literal
|
||||
string \<^scala>\<open>"dof_url"\<close> is unchecked.
|
||||
string \<^scala>\<open>"dof_isabelle"\<close> is unchecked.
|
||||
\<close>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue