src/Pure/System/scala.scala
changeset 75702 97e8f4c938bf
parent 75699 0a71b6c903e9
child 75705 95879204cb21
equal deleted inserted replaced
75701:84990c95712d 75702:97e8f4c938bf
    98 
    98 
    99 
    99 
   100 
   100 
   101   /** compiler **/
   101   /** compiler **/
   102 
   102 
   103   def get_classpath(): List[Path] =
       
   104     for {
       
   105       s <- space_explode(JFile.pathSeparatorChar, System.getProperty("java.class.path", ""))
       
   106       if s.nonEmpty
       
   107     } yield Path.explode(File.standard_path(s))
       
   108 
       
   109   object Compiler {
   103   object Compiler {
   110     object Message {
   104     object Message {
   111       object Kind extends Enumeration {
   105       object Kind extends Enumeration {
   112         val error, warning, info, other = Value
   106         val error, warning, info, other = Value
   113       }
   107       }
   162       override def toString: String = if (ok) "Result(ok)" else "Result(error)"
   156       override def toString: String = if (ok) "Result(ok)" else "Result(error)"
   163     }
   157     }
   164 
   158 
   165     def context(
   159     def context(
   166       settings: List[String] = Nil,
   160       settings: List[String] = Nil,
   167       jar_dirs: List[JFile] = Nil,
   161       jar_files: List[JFile] = Nil,
   168       class_loader: Option[ClassLoader] = None
   162       class_loader: Option[ClassLoader] = None
   169     ): Context = {
   163     ): Context = {
   170       val isabelle_settings =
   164       val isabelle_settings =
   171         Word.explode(Isabelle_System.getenv_strict("ISABELLE_SCALAC_OPTIONS"))
   165         Word.explode(Isabelle_System.getenv_strict("ISABELLE_SCALAC_OPTIONS"))
   172 
   166 
   173       def find_jars(dir: JFile): List[String] =
   167       val classpath = Classpath(jar_files = jar_files).platform_path
   174         File.find_files(dir, file => file.getName.endsWith(".jar")).
       
   175           map(File.absolute_name)
       
   176 
       
   177       val classpath =
       
   178         (get_classpath().map(File.platform_path) :::
       
   179           jar_dirs.flatMap(find_jars)).mkString(JFile.pathSeparator)
       
   180       val settings1 = isabelle_settings ::: settings ::: List("-classpath", classpath)
   168       val settings1 = isabelle_settings ::: settings ::: List("-classpath", classpath)
   181       new Context(settings1, class_loader)
   169       new Context(settings1, class_loader)
   182     }
   170     }
   183 
   171 
   184     class Context private [Compiler](
   172     class Context private [Compiler](