src/Pure/System/setup_tool.scala
changeset 80022 77e605c66797
parent 80021 ba06861e91f9
child 80024 27f2a6bd5616
equal deleted inserted replaced
80021:ba06861e91f9 80022:77e605c66797
    13 
    13 
    14   def init(other_isabelle: Other_Isabelle, verbose: Boolean = false): Unit =
    14   def init(other_isabelle: Other_Isabelle, verbose: Boolean = false): Unit =
    15     services.foreach(_.init(other_isabelle, verbose = verbose))
    15     services.foreach(_.init(other_isabelle, verbose = verbose))
    16 }
    16 }
    17 
    17 
    18 abstract class Setup_Tool(tool: String)
    18 abstract class Setup_Tool(tool: String, val variable: String)
    19 extends Isabelle_System.Service {
    19 extends Isabelle_System.Service {
    20   override def toString: String = tool
    20   override def toString: String = tool
    21 
    21 
    22   val variable: String = "ISABELLE_" + Word.uppercase(tool)
       
    23   val files: List[Path] = List(Path.explode("lib/Tools") + Path.basic(tool))
    22   val files: List[Path] = List(Path.explode("lib/Tools") + Path.basic(tool))
    24 
    23 
    25   def test(other_isabelle: Other_Isabelle): Boolean =
    24   def test(other_isabelle: Other_Isabelle): Boolean =
    26     other_isabelle.getenv(variable) == "true" &&
    25     other_isabelle.getenv(variable) == "true" &&
    27     files.exists(p => (other_isabelle.isabelle_home + p).is_file)
    26     files.exists(p => (other_isabelle.isabelle_home + p).is_file)
    31 
    30 
    32   def init(other_isabelle: Other_Isabelle, verbose: Boolean = false): Unit =
    31   def init(other_isabelle: Other_Isabelle, verbose: Boolean = false): Unit =
    33     if (test(other_isabelle)) run(other_isabelle, verbose = verbose)
    32     if (test(other_isabelle)) run(other_isabelle, verbose = verbose)
    34 }
    33 }
    35 
    34 
    36 class GHC_Setup extends Setup_Tool("ghc_setup")
    35 class GHC_Setup extends Setup_Tool("ghc_setup", "ISABELLE_GHC_SETUP")
    37 class OCaml_Setup extends Setup_Tool("ocaml_setup")
    36 class OCaml_Setup extends Setup_Tool("ocaml_setup", "ISABELLE_OCAML_SETUP")