more complete scala_project, including Isabelle/jEdit plugins;
authorwenzelm
Sat, 17 Jul 2021 21:52:14 +0200
changeset 74032 c9ec6f03ab91
parent 74031 09821ca262d3
child 74033 a5e2654cfe28
more complete scala_project, including Isabelle/jEdit plugins;
src/Pure/Tools/scala_project.scala
src/Tools/jEdit/src/main.scala
--- a/src/Pure/Tools/scala_project.scala	Sat Jul 17 21:40:57 2021 +0200
+++ b/src/Pure/Tools/scala_project.scala	Sat Jul 17 21:52:14 2021 +0200
@@ -25,22 +25,30 @@
 
   /* file and directories */
 
+  def plugin_contexts(): List[isabelle.setup.Build.Context] =
+    for (plugin <- List("jedit_base", "jedit_main"))
+    yield {
+      val dir = Path.explode("$ISABELLE_HOME/src/Tools/jEdit") + Path.basic(plugin)
+      isabelle.setup.Build.directory_context(dir.java_path)
+    }
+
   lazy val isabelle_files: (List[Path], List[Path]) =
   {
-    val component_contexts =
-      isabelle.setup.Build.component_contexts().asScala.toList
+    val contexts =
+      isabelle.setup.Build.component_contexts().asScala.toList :::
+        plugin_contexts()
 
     val jars1 = Path.split(Isabelle_System.getenv("ISABELLE_CLASSPATH"))
     val jars2 =
       (for {
-        context <- component_contexts.iterator
+        context <- contexts.iterator
         s <- context.requirements().asScala.iterator
         path <- context.requirement_paths(s).asScala.iterator
       } yield File.path(path.toFile)).toList
 
     val jar_files =
-      (jars1 ::: jars2).filterNot(path =>
-        component_contexts.exists(context =>
+      Library.distinct(jars1 ::: jars2).filterNot(path =>
+        contexts.exists(context =>
         {
           val name: String = context.module_name()
           name.nonEmpty && File.eq(context.path(name).toFile, path.file)
@@ -48,7 +56,7 @@
 
     val source_files =
       (for {
-        context <- component_contexts.iterator
+        context <- contexts.iterator
         file <- context.sources.asScala.iterator
         if file.endsWith(".scala") || file.endsWith(".java")
       } yield File.path(context.path(file).toFile)).toList
--- a/src/Tools/jEdit/src/main.scala	Sat Jul 17 21:40:57 2021 +0200
+++ b/src/Tools/jEdit/src/main.scala	Sat Jul 17 21:52:14 2021 +0200
@@ -82,11 +82,7 @@
 </PERSPECTIVE>""")
           }
 
-          for (plugin <- List("jedit_base", "jedit_main")) {
-            val dir = Path.explode("$ISABELLE_HOME/src/Tools/jEdit") + Path.basic(plugin)
-            val context = isabelle.setup.Build.directory_context(dir.java_path)
-            isabelle.setup.Build.build(context, false)
-          }
+          Scala_Project.plugin_contexts().foreach(isabelle.setup.Build.build(_, false))
 
 
           /* args */