clarified jEdit java sources;
authorwenzelm
Mon, 02 Aug 2021 14:08:42 +0200
changeset 74104 fa92c5f8af86
parent 74103 3b56d00ac333
child 74105 d3d6e01a6b00
clarified jEdit java sources;
Admin/components/components.sha1
Admin/components/main
src/Pure/Admin/build_jedit.scala
src/Pure/Tools/scala_project.scala
--- a/Admin/components/components.sha1	Mon Aug 02 13:50:45 2021 +0200
+++ b/Admin/components/components.sha1	Mon Aug 02 14:08:42 2021 +0200
@@ -182,6 +182,7 @@
 778fd85c827ec49d2d658a832d20e63916186b0d  jedit-20210715.tar.gz
 beb99f2cb0bd4e595c5c597d3970c46aa21616e4  jedit-20210717.tar.gz
 33dd96cd83f2c6a26c035b7a0ee57624655224c5  jedit-20210724.tar.gz
+0e4fd4d66388ddc760fa5fbd8d4a9a3b77cf59c7  jedit-20210802.tar.gz
 44775a22f42a9d665696bfb49e53c79371c394b0  jedit_build-20111217.tar.gz
 a242a688810f2bccf24587b0062ce8027bf77fa2  jedit_build-20120304.tar.gz
 4c948dee53f74361c097c08f49a1a5ff9b17bd1d  jedit_build-20120307.tar.gz
--- a/Admin/components/main	Mon Aug 02 13:50:45 2021 +0200
+++ b/Admin/components/main	Mon Aug 02 14:08:42 2021 +0200
@@ -10,7 +10,7 @@
 isabelle_fonts-20210322
 isabelle_setup-20210726
 jdk-15.0.2+7
-jedit-20210724
+jedit-20210802
 jfreechart-1.5.1
 jortho-1.0-2
 kodkodi-1.5.6-1
--- a/src/Pure/Admin/build_jedit.scala	Mon Aug 02 13:50:45 2021 +0200
+++ b/src/Pure/Admin/build_jedit.scala	Mon Aug 02 14:08:42 2021 +0200
@@ -102,6 +102,11 @@
       "Navigator" -> "2.7",
       "SideKick" -> "1.8")
 
+  private def exclude_package(name: String): Boolean =
+    name.startsWith("de.masters_of_disaster.ant") ||
+    name == "doclet" ||
+    name == "installer"
+
   def build_jedit(
     component_dir: Path,
     version: String,
@@ -181,14 +186,11 @@
       Isabelle_System.copy_file(tmp_source_dir + Path.explode("build/jedit.jar"), jedit_patched_dir)
 
       val java_sources =
-        File.find_files(source_dir.file, file => file.getName.endsWith(".java")).
-          flatMap(file =>
-            {
-              if (Scala_Project.package_dir(File.path(file)).isDefined) {
-                Some(File.path(component_dir.java_path.relativize(file.toPath).toFile))
-              }
-              else None
-            })
+        for {
+          file <- File.find_files(source_dir.file, file => file.getName.endsWith(".java"))
+          package_name <- Scala_Project.package_name(File.path(file))
+          if !exclude_package(package_name)
+        } yield File.path(component_dir.java_path.relativize(file.toPath).toFile)
 
       File.write(etc_dir + Path.explode("build.props"),
         "module = " + jedit_patched + "/jedit.jar\n" +
--- a/src/Pure/Tools/scala_project.scala	Mon Aug 02 13:50:45 2021 +0200
+++ b/src/Pure/Tools/scala_project.scala	Mon Aug 02 14:08:42 2021 +0200
@@ -94,20 +94,22 @@
 
   val default_project_dir = Path.explode("$ISABELLE_HOME_USER/scala_project")
 
-  def package_dir(source_file: Path): Option[Path] =
+  def package_name(source_file: Path): Option[String] =
   {
     val lines = split_lines(File.read(source_file))
     val Package = """\s*\bpackage\b\s*(?:object\b\s*)?((?:\w|\.)+)\b.*""".r
-    lines.collectFirst(
-      {
-        case Package(name) =>
-          if (source_file.is_java) Path.explode(space_explode('.', name).mkString("/"))
-          else Path.basic(name)
-      })
+    lines.collectFirst({ case Package(name) => name })
   }
 
   def the_package_dir(source_file: Path): Path =
-    package_dir(source_file) getOrElse error("Failed to guess package from " + source_file)
+  {
+    package_name(source_file) match {
+      case Some(name) =>
+        if (source_file.is_java) Path.explode(space_explode('.', name).mkString("/"))
+        else Path.basic(name)
+      case None => error("Failed to guess package from " + source_file)
+    }
+  }
 
   def scala_project(
     project_dir: Path = default_project_dir,