clarified modules;
authorwenzelm
Sat, 07 Sep 2013 17:32:55 +0200
changeset 53461 26c609ada983
parent 53460 6015a663b889
child 53462 c531db093680
clarified modules;
src/Pure/System/cygwin_init.scala
src/Pure/Tools/main.scala
src/Pure/build-jars
--- a/src/Pure/System/cygwin_init.scala	Sat Sep 07 17:23:05 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*  Title:      Pure/System/cygwin_init.scala
-    Author:     Makarius
-
-Initialize raw Isabelle distribution (e.g. after extraction via 7zip).
-*/
-
-package isabelle
-
-
-import java.io.{File => JFile, BufferedReader, InputStreamReader}
-import java.nio.file.Files
-
-import scala.annotation.tailrec
-
-
-object Cygwin_Init
-{
-  def filesystem(system_dialog: System_Dialog, isabelle_home: String)
-  {
-    system_dialog.title("Isabelle system initialization")
-    system_dialog.echo("Initializing Cygwin:")
-
-    def execute(args: String*): Int =
-    {
-      val cwd = new JFile(isabelle_home)
-      val env = Map("CYGWIN" -> "nodosfilewarning")
-      system_dialog.execute(cwd, env, args: _*)
-    }
-
-    val cygwin_root = isabelle_home + "\\contrib\\cygwin"
-
-    system_dialog.echo("symlinks ...")
-    val symlinks =
-    {
-      val path = (new JFile(cygwin_root + "\\isabelle\\symlinks")).toPath
-      Files.readAllLines(path, UTF8.charset).toArray.toList.asInstanceOf[List[String]]
-    }
-    @tailrec def recover_symlinks(list: List[String]): Unit =
-    {
-      list match {
-        case Nil | List("") =>
-        case link :: content :: rest =>
-          val path = (new JFile(isabelle_home, link)).toPath
-
-          val writer = Files.newBufferedWriter(path, UTF8.charset)
-          try { writer.write("!<symlink>" + content + "\0") }
-          finally { writer.close }
-
-          Files.setAttribute(path, "dos:system", true)
-
-          recover_symlinks(rest)
-        case _ => error("Unbalanced symlinks list")
-      }
-    }
-    recover_symlinks(symlinks)
-
-    system_dialog.echo("rebaseall ...")
-    execute(cygwin_root + "\\bin\\dash.exe", "/isabelle/rebaseall")
-
-    system_dialog.echo("postinstall ...")
-    execute(cygwin_root + "\\bin\\bash.exe", "/isabelle/postinstall")
-
-    system_dialog.echo("init ...")
-    Isabelle_System.init()
-    system_dialog.echo("OK")
-  }
-}
-
--- a/src/Pure/Tools/main.scala	Sat Sep 07 17:23:05 2013 +0200
+++ b/src/Pure/Tools/main.scala	Sat Sep 07 17:32:55 2013 +0200
@@ -9,11 +9,16 @@
 
 import javax.swing.SwingUtilities
 import java.lang.{System, ClassLoader}
-import java.io.{File => JFile}
+import java.io.{File => JFile, BufferedReader, InputStreamReader}
+import java.nio.file.Files
+
+import scala.annotation.tailrec
 
 
 object Main
 {
+  /** main entry point **/
+
   def main(args: Array[String])
   {
     val system_dialog = new System_Dialog
@@ -123,8 +128,7 @@
           val uninitialized_file = new JFile(cygwin_root, "isabelle\\uninitialized")
           val uninitialized = uninitialized_file.isFile && uninitialized_file.delete
 
-          if (uninitialized)
-            Cygwin_Init.filesystem(system_dialog, isabelle_home)
+          if (uninitialized) cygwin_init(system_dialog, isabelle_home, cygwin_root)
         }
       }
       catch { case exn: Throwable => exit_error(exn) }
@@ -134,5 +138,57 @@
     val rc = system_dialog.join
     if (rc == 0) start else sys.exit(rc)
   }
+
+
+
+  /** Cygwin init (e.g. after extraction via 7zip) **/
+
+  private def cygwin_init(system_dialog: System_Dialog, isabelle_home: String, cygwin_root: String)
+  {
+    system_dialog.title("Isabelle system initialization")
+    system_dialog.echo("Initializing Cygwin:")
+
+    def execute(args: String*): Int =
+    {
+      val cwd = new JFile(isabelle_home)
+      val env = Map("CYGWIN" -> "nodosfilewarning")
+      system_dialog.execute(cwd, env, args: _*)
+    }
+
+    system_dialog.echo("symlinks ...")
+    val symlinks =
+    {
+      val path = (new JFile(cygwin_root + "\\isabelle\\symlinks")).toPath
+      Files.readAllLines(path, UTF8.charset).toArray.toList.asInstanceOf[List[String]]
+    }
+    @tailrec def recover_symlinks(list: List[String]): Unit =
+    {
+      list match {
+        case Nil | List("") =>
+        case link :: content :: rest =>
+          val path = (new JFile(isabelle_home, link)).toPath
+
+          val writer = Files.newBufferedWriter(path, UTF8.charset)
+          try { writer.write("!<symlink>" + content + "\0") }
+          finally { writer.close }
+
+          Files.setAttribute(path, "dos:system", true)
+
+          recover_symlinks(rest)
+        case _ => error("Unbalanced symlinks list")
+      }
+    }
+    recover_symlinks(symlinks)
+
+    system_dialog.echo("rebaseall ...")
+    execute(cygwin_root + "\\bin\\dash.exe", "/isabelle/rebaseall")
+
+    system_dialog.echo("postinstall ...")
+    execute(cygwin_root + "\\bin\\bash.exe", "/isabelle/postinstall")
+
+    system_dialog.echo("init ...")
+    Isabelle_System.init()
+    system_dialog.echo("OK")
+  }
 }
 
--- a/src/Pure/build-jars	Sat Sep 07 17:23:05 2013 +0200
+++ b/src/Pure/build-jars	Sat Sep 07 17:32:55 2013 +0200
@@ -47,7 +47,6 @@
   PIDE/yxml.scala
   System/color_value.scala
   System/command_line.scala
-  System/cygwin_init.scala
   System/event_bus.scala
   System/gui.scala
   System/gui_setup.scala