src/Pure/Admin/build_release.scala
changeset 73068 a95f5ae5a12a
parent 73067 d045d900a929
child 73069 8d9fb810462b
equal deleted inserted replaced
73067:d045d900a929 73068:a95f5ae5a12a
   246   }
   246   }
   247 
   247 
   248 
   248 
   249   /* Isabelle application */
   249   /* Isabelle application */
   250 
   250 
       
   251   def make_isabelle_options(path: Path, options: List[String], line_ending: String = "\n")
       
   252   {
       
   253     val title = "# Java runtime options"
       
   254     File.write(path, (title :: options).map(_ + line_ending).mkString)
       
   255   }
       
   256 
   251   def make_isabelle_app(
   257   def make_isabelle_app(
   252     path: Path,
   258     path: Path,
   253     isabelle_home_prefix: String,
   259     isabelle_home_prefix: String,
   254     jdk_component: String,
   260     jdk_component: String,
   255     classpath: List[Path])
   261     classpath: List[Path])
   289     File.write(path, script)
   295     File.write(path, script)
   290     File.set_executable(path, true)
   296     File.set_executable(path, true)
   291   }
   297   }
   292 
   298 
   293 
   299 
   294   def make_isabelle_plist(path: Path, isabelle_name: String, java_options: List[String])
   300   def make_isabelle_plist(path: Path, isabelle_name: String)
   295   {
   301   {
   296     File.write(path, """<?xml version="1.0" ?>
   302     File.write(path, """<?xml version="1.0" ?>
   297 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   303 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   298 <plist version="1.0">
   304 <plist version="1.0">
   299 <dict>
   305 <dict>
   300 <key>CFBundleDevelopmentRegion</key>
   306 <key>CFBundleDevelopmentRegion</key>
   301 <string>English</string>
   307 <string>English</string>
   302 <key>CFBundleExecutable</key>
       
   303 <string>JavaAppLauncher</string>
       
   304 <key>CFBundleIconFile</key>
   308 <key>CFBundleIconFile</key>
   305 <string>isabelle.icns</string>
   309 <string>isabelle.icns</string>
   306 <key>CFBundleIdentifier</key>
   310 <key>CFBundleIdentifier</key>
   307 <string>de.tum.in.isabelle.""" + isabelle_name + """</string>
   311 <string>de.tum.in.isabelle.""" + isabelle_name + """</string>
   308 <key>CFBundleDisplayName</key>
   312 <key>CFBundleDisplayName</key>
   327 <string>public.app-category.developer-tools</string>
   331 <string>public.app-category.developer-tools</string>
   328 <key>NSHighResolutionCapable</key>
   332 <key>NSHighResolutionCapable</key>
   329 <string>true</string>
   333 <string>true</string>
   330 <key>NSSupportsAutomaticGraphicsSwitching</key>
   334 <key>NSSupportsAutomaticGraphicsSwitching</key>
   331 <string>true</string>
   335 <string>true</string>
   332 <key>JVMRuntime</key>
       
   333 <string>bundled.jdk</string>
       
   334 <key>JVMMainClassName</key>
       
   335 <string>isabelle.Main</string>
       
   336 <key>CFBundleDocumentTypes</key>
   336 <key>CFBundleDocumentTypes</key>
   337 <array>
   337 <array>
   338 <dict>
   338 <dict>
   339 <key>CFBundleTypeExtensions</key>
   339 <key>CFBundleTypeExtensions</key>
   340 <array>
   340 <array>
   348 <string>Editor</string>
   348 <string>Editor</string>
   349 <key>LSTypeIsPackage</key>
   349 <key>LSTypeIsPackage</key>
   350 <false/>
   350 <false/>
   351 </dict>
   351 </dict>
   352 </array>
   352 </array>
   353 <key>JVMOptions</key>
       
   354 <array>
       
   355 """ + cat_lines(java_options.map(opt => "<string>" + opt + "</string>")) + """
       
   356 <string>-splash:$APP_ROOT/Contents/Resources/""" + isabelle_name + """/lib/logo/isabelle.gif</string>
       
   357 <string>-Dapple.awt.application.name=""" + isabelle_name + """</string>
       
   358 <string>-Disabelle.root=$APP_ROOT/Contents/Resources/""" + isabelle_name + """</string>
       
   359 <string>-Disabelle.app=true</string>
       
   360 </array>
       
   361 <key>JVMArguments</key>
       
   362 <array>
       
   363 </array>
       
   364 </dict>
   353 </dict>
   365 </plist>
   354 </plist>
   366 """)
   355 """)
   367   }
   356   }
   368 
   357 
   574         activate_components(isabelle_target, platform, more_components_names)
   563         activate_components(isabelle_target, platform, more_components_names)
   575 
   564 
   576 
   565 
   577         // Java parameters
   566         // Java parameters
   578 
   567 
   579         val java_options_title = "# Java runtime options"
       
   580         val java_options: List[String] =
   568         val java_options: List[String] =
   581           (for {
   569           (for {
   582             variable <-
   570             variable <-
   583               List(
   571               List(
   584                 "ISABELLE_JAVA_SYSTEM_OPTIONS",
   572                 "ISABELLE_JAVA_SYSTEM_OPTIONS",
   585                 "JEDIT_JAVA_SYSTEM_OPTIONS",
   573                 "JEDIT_JAVA_SYSTEM_OPTIONS",
   586                 "JEDIT_JAVA_OPTIONS")
   574                 "JEDIT_JAVA_OPTIONS")
   587             opt <- Word.explode(other_isabelle.getenv(variable))
   575             opt <- Word.explode(other_isabelle.getenv(variable))
   588           } yield opt) ::: List("-Disabelle.jedit_server=" + isabelle_name)
   576           }
       
   577           yield {
       
   578             val s = "-Dapple.awt.application.name="
       
   579             if (opt.startsWith(s)) s + isabelle_name else opt
       
   580           }) ::: List("-Disabelle.jedit_server=" + isabelle_name)
   589 
   581 
   590         val classpath: List[Path] =
   582         val classpath: List[Path] =
   591         {
   583         {
   592           val base = isabelle_target.absolute
   584           val base = isabelle_target.absolute
   593           Path.split(other_isabelle.getenv("ISABELLE_CLASSPATH")).map(path =>
   585           Path.split(other_isabelle.getenv("ISABELLE_CLASSPATH")).map(path =>
   625                .replaceAll("metal.primary.fontsize=.*", "metal.primary.fontsize=18")
   617                .replaceAll("metal.primary.fontsize=.*", "metal.primary.fontsize=18")
   626                .replaceAll("metal.secondary.fontsize=.*", "metal.secondary.fontsize=18")
   618                .replaceAll("metal.secondary.fontsize=.*", "metal.secondary.fontsize=18")
   627                .replaceAll("view.fontsize=.*", "view.fontsize=24")
   619                .replaceAll("view.fontsize=.*", "view.fontsize=24")
   628                .replaceAll("view.gutter.fontsize=.*", "view.gutter.fontsize=16"))
   620                .replaceAll("view.gutter.fontsize=.*", "view.gutter.fontsize=16"))
   629 
   621 
   630             File.write(isabelle_target + Path.explode("Isabelle.options"),
   622             make_isabelle_options(
   631               terminate_lines(java_options_title :: java_options))
   623               isabelle_target + Path.explode("Isabelle.options"), java_options)
   632 
   624 
   633             make_isabelle_app(
   625             make_isabelle_app(
   634               isabelle_target + Path.explode("lib/scripts/Isabelle_app"),
   626               isabelle_target + Path.explode("lib/scripts/Isabelle_app"),
   635               "/../..", jdk_component, classpath)
   627               "/../..", jdk_component, classpath)
   636 
   628 
   663 
   655 
   664             val app_contents = app_dir + Path.explode("Contents")
   656             val app_contents = app_dir + Path.explode("Contents")
   665             val app_resources = app_contents + Path.explode("Resources")
   657             val app_resources = app_contents + Path.explode("Resources")
   666             File.move(tmp_dir + Path.explode(isabelle_name), app_resources)
   658             File.move(tmp_dir + Path.explode(isabelle_name), app_resources)
   667 
   659 
   668             make_isabelle_plist(
   660             val isabelle_home_prefix = "Contents/Resources/" + isabelle_name
   669               app_contents + Path.explode("Info.plist"), isabelle_name, java_options)
       
   670 
       
   671             for (cp <- classpath) {
       
   672               File.link(
       
   673                 Path.explode("../Resources/" + isabelle_name + "/") + cp,
       
   674                 app_contents + Path.explode("Java"),
       
   675                 force = true)
       
   676             }
       
   677 
   661 
   678             File.link(
   662             File.link(
   679               Path.explode("../Resources/" + isabelle_name + "/contrib/" +
   663               Path.explode(isabelle_home_prefix),
   680                 jdk_component + "/x86_64-darwin"),
       
   681               app_contents + Path.explode("PlugIns/bundled.jdk"),
       
   682               force = true)
       
   683 
       
   684             File.link(
       
   685               Path.explode("../../Info.plist"),
       
   686               app_resources + Path.explode(isabelle_name + "/" + isabelle_name + ".plist"),
       
   687               force = true)
       
   688 
       
   689             File.link(
       
   690               Path.explode("Contents/Resources/" + isabelle_name),
       
   691               app_dir + Path.explode("Isabelle"),
   664               app_dir + Path.explode("Isabelle"),
   692               force = true)
   665               force = true)
       
   666 
       
   667             make_isabelle_app(
       
   668               app_dir + Path.explode(isabelle_name),
       
   669               isabelle_home_prefix, jdk_component, classpath)
       
   670 
       
   671             make_isabelle_options(
       
   672               app_dir + Path.explode("Isabelle.options"),
       
   673               java_options ::: List("-Disabelle.app=true"))
       
   674 
       
   675             make_isabelle_plist(app_contents + Path.explode("Info.plist"), isabelle_name)
   693 
   676 
   694 
   677 
   695             // application archive
   678             // application archive
   696 
   679 
   697             val archive_name = isabelle_name + "_macos.tar.gz"
   680             val archive_name = isabelle_name + "_macos.tar.gz"
   712 
   695 
   713             File.move(isabelle_target + Path.explode("contrib/windows_app"), tmp_dir)
   696             File.move(isabelle_target + Path.explode("contrib/windows_app"), tmp_dir)
   714 
   697 
   715             val app_template = Path.explode("~~/Admin/Windows/launch4j")
   698             val app_template = Path.explode("~~/Admin/Windows/launch4j")
   716 
   699 
   717             File.write(isabelle_target + Path.explode(isabelle_name + ".l4j.ini"),
   700             make_isabelle_options(
   718               (java_options_title :: java_options).map(_ + "\r\n").mkString)
   701               isabelle_target + Path.explode(isabelle_name + ".l4j.ini"),
       
   702               java_options, line_ending = "\r\n")
   719 
   703 
   720             val isabelle_xml = Path.explode("isabelle.xml")
   704             val isabelle_xml = Path.explode("isabelle.xml")
   721             val isabelle_exe = Path.explode(isabelle_name + ".exe")
   705             val isabelle_exe = Path.explode(isabelle_name + ".exe")
   722 
   706 
   723             File.write(tmp_dir + isabelle_xml,
   707             File.write(tmp_dir + isabelle_xml,