src/Pure/Admin/build_release.scala
changeset 72387 04be6716cac6
parent 72378 075f3cbc7546
child 73060 4b620e1cb1e9
equal deleted inserted replaced
72386:6846b6df9a5f 72387:04be6716cac6
    59     val dir = release.isabelle_dir
    59     val dir = release.isabelle_dir
    60 
    60 
    61     for (name <- List("src/Pure/System/distribution.ML", "src/Pure/System/distribution.scala"))
    61     for (name <- List("src/Pure/System/distribution.ML", "src/Pure/System/distribution.scala"))
    62     {
    62     {
    63       File.change(dir + Path.explode(name),
    63       File.change(dir + Path.explode(name),
    64         s =>
    64         _.replace("val is_identified = false", "val is_identified = true")
    65           s.replaceAllLiterally("val is_identified = false", "val is_identified = true")
    65          .replace("val is_official = false", "val is_official = " + is_official))
    66            .replaceAllLiterally("val is_official = false", "val is_official = " + is_official))
       
    67     }
    66     }
    68 
    67 
    69     File.change(dir + getsettings_path,
    68     File.change(dir + getsettings_path,
    70       _.replaceAllLiterally("ISABELLE_ID=\"\"", "ISABELLE_ID=" + quote(release.ident))
    69       _.replace("ISABELLE_ID=\"\"", "ISABELLE_ID=" + quote(release.ident))
    71        .replaceAllLiterally("ISABELLE_IDENTIFIER=\"\"",
    70        .replace("ISABELLE_IDENTIFIER=\"\"", "ISABELLE_IDENTIFIER=" + quote(release.dist_name)))
    72           "ISABELLE_IDENTIFIER=" + quote(release.dist_name)))
       
    73 
    71 
    74     File.change(dir + Path.explode("lib/html/library_index_header.template"),
    72     File.change(dir + Path.explode("lib/html/library_index_header.template"),
    75       _.replaceAllLiterally("{ISABELLE}", release.dist_name))
    73       _.replace("{ISABELLE}", release.dist_name))
    76 
    74 
    77     for {
    75     for {
    78       name <-
    76       name <-
    79         List(
    77         List(
    80           "src/Pure/System/distribution.ML",
    78           "src/Pure/System/distribution.ML",
    81           "src/Pure/System/distribution.scala",
    79           "src/Pure/System/distribution.scala",
    82           "lib/Tools/version") }
    80           "lib/Tools/version") }
    83     {
    81     {
    84       File.change(dir + Path.explode(name),
    82       File.change(dir + Path.explode(name), _.replace("repository version", release.dist_version))
    85         s => s.replaceAllLiterally("repository version", release.dist_version))
       
    86     }
    83     }
    87 
    84 
    88     File.change(dir + Path.explode("README"),
    85     File.change(dir + Path.explode("README"),
    89       s => s.replaceAllLiterally("some repository version of Isabelle", release.dist_version))
    86       _.replace("some repository version of Isabelle", release.dist_version))
    90   }
    87   }
    91 
    88 
    92 
    89 
    93   /* ANNOUNCE */
    90   /* ANNOUNCE */
    94 
    91 
   513               terminate_lines(java_options_title :: java_options))
   510               terminate_lines(java_options_title :: java_options))
   514 
   511 
   515             val isabelle_app = isabelle_target + Path.explode("lib/scripts/Isabelle_app")
   512             val isabelle_app = isabelle_target + Path.explode("lib/scripts/Isabelle_app")
   516             File.write(isabelle_app,
   513             File.write(isabelle_app,
   517               File.read(Path.explode("~~/Admin/Linux/Isabelle_app"))
   514               File.read(Path.explode("~~/Admin/Linux/Isabelle_app"))
   518                 .replaceAllLiterally("{CLASSPATH}",
   515                 .replace("{CLASSPATH}", classpath.map("$ISABELLE_HOME/" + _).mkString(":"))
   519                   classpath.map("$ISABELLE_HOME/" + _).mkString(":"))
   516                 .replace("/jdk/", "/" + jdk_component + "/"))
   520                 .replaceAllLiterally("/jdk/", "/" + jdk_component + "/"))
       
   521             File.set_executable(isabelle_app, true)
   517             File.set_executable(isabelle_app, true)
   522 
   518 
   523             val linux_app = isabelle_target + Path.explode("contrib/linux_app")
   519             val linux_app = isabelle_target + Path.explode("contrib/linux_app")
   524             File.move(linux_app + Path.explode("Isabelle"),
   520             File.move(linux_app + Path.explode("Isabelle"),
   525               isabelle_target + Path.explode(isabelle_name))
   521               isabelle_target + Path.explode(isabelle_name))
   551             val app_resources = app_contents + Path.explode("Resources")
   547             val app_resources = app_contents + Path.explode("Resources")
   552             File.move(tmp_dir + Path.explode(isabelle_name), app_resources)
   548             File.move(tmp_dir + Path.explode(isabelle_name), app_resources)
   553 
   549 
   554             File.write(app_contents + Path.explode("Info.plist"),
   550             File.write(app_contents + Path.explode("Info.plist"),
   555               File.read(Path.explode("~~/Admin/MacOS/Info.plist"))
   551               File.read(Path.explode("~~/Admin/MacOS/Info.plist"))
   556                 .replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
   552                 .replace("{ISABELLE_NAME}", isabelle_name)
   557                 .replaceAllLiterally("{JAVA_OPTIONS}",
   553                 .replace("{JAVA_OPTIONS}",
   558                   terminate_lines(java_options.map(opt => "<string>" + opt + "</string>"))))
   554                   terminate_lines(java_options.map(opt => "<string>" + opt + "</string>"))))
   559 
   555 
   560             for (cp <- classpath) {
   556             for (cp <- classpath) {
   561               File.link(
   557               File.link(
   562                 Path.explode("../Resources/" + isabelle_name + "/") + cp,
   558                 Path.explode("../Resources/" + isabelle_name + "/") + cp,
   609             val isabelle_xml = Path.explode("isabelle.xml")
   605             val isabelle_xml = Path.explode("isabelle.xml")
   610             val isabelle_exe = Path.explode(isabelle_name + ".exe")
   606             val isabelle_exe = Path.explode(isabelle_name + ".exe")
   611 
   607 
   612             File.write(tmp_dir + isabelle_xml,
   608             File.write(tmp_dir + isabelle_xml,
   613               File.read(app_template + isabelle_xml)
   609               File.read(app_template + isabelle_xml)
   614                 .replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
   610                 .replace("{ISABELLE_NAME}", isabelle_name)
   615                 .replaceAllLiterally("{OUTFILE}",
   611                 .replace("{OUTFILE}", File.platform_path(isabelle_target + isabelle_exe))
   616                   File.platform_path(isabelle_target + isabelle_exe))
   612                 .replace("{ICON}",
   617                 .replaceAllLiterally("{ICON}",
       
   618                   File.platform_path(app_template + Path.explode("isabelle_transparent.ico")))
   613                   File.platform_path(app_template + Path.explode("isabelle_transparent.ico")))
   619                 .replaceAllLiterally("{SPLASH}",
   614                 .replace("{SPLASH}",
   620                   File.platform_path(app_template + Path.explode("isabelle.bmp")))
   615                   File.platform_path(app_template + Path.explode("isabelle.bmp")))
   621                 .replaceAllLiterally("{CLASSPATH}",
   616                 .replace("{CLASSPATH}",
   622                   cat_lines(classpath.map(cp =>
   617                   cat_lines(classpath.map(cp =>
   623                     "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
   618                     "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
   624                 .replaceAllLiterally("\\jdk\\", "\\" + jdk_component + "\\"))
   619                 .replace("\\jdk\\", "\\" + jdk_component + "\\"))
   625 
   620 
   626             execute(tmp_dir,
   621             execute(tmp_dir,
   627               "\"windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j\" isabelle.xml")
   622               "\"windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j\" isabelle.xml")
   628 
   623 
   629             File.copy(app_template + Path.explode("manifest.xml"),
   624             File.copy(app_template + Path.explode("manifest.xml"),
   639             val cygwin_mirror =
   634             val cygwin_mirror =
   640               File.read(isabelle_target + Path.explode("contrib/cygwin/isabelle/cygwin_mirror"))
   635               File.read(isabelle_target + Path.explode("contrib/cygwin/isabelle/cygwin_mirror"))
   641 
   636 
   642             val cygwin_bat = Path.explode("Cygwin-Setup.bat")
   637             val cygwin_bat = Path.explode("Cygwin-Setup.bat")
   643             File.write(isabelle_target + cygwin_bat,
   638             File.write(isabelle_target + cygwin_bat,
   644               File.read(cygwin_template + cygwin_bat)
   639               File.read(cygwin_template + cygwin_bat).replace("{MIRROR}", cygwin_mirror))
   645                 .replaceAllLiterally("{MIRROR}", cygwin_mirror))
       
   646             File.set_executable(isabelle_target + cygwin_bat, true)
   640             File.set_executable(isabelle_target + cygwin_bat, true)
   647 
   641 
   648             for (name <- List("isabelle/postinstall", "isabelle/rebaseall")) {
   642             for (name <- List("isabelle/postinstall", "isabelle/rebaseall")) {
   649               val path = Path.explode(name)
   643               val path = Path.explode(name)
   650               File.copy(cygwin_template + path,
   644               File.copy(cygwin_template + path,
   676               "7z -y -bd a " + File.bash_path(exe_archive) + " " + Bash.string(isabelle_name))
   670               "7z -y -bd a " + File.bash_path(exe_archive) + " " + Bash.string(isabelle_name))
   677             if (!exe_archive.is_file) error("Failed to create archive: " + exe_archive)
   671             if (!exe_archive.is_file) error("Failed to create archive: " + exe_archive)
   678 
   672 
   679             val sfx_exe = tmp_dir + Path.explode("windows_app/7zsd_All_x64.sfx")
   673             val sfx_exe = tmp_dir + Path.explode("windows_app/7zsd_All_x64.sfx")
   680             val sfx_txt =
   674             val sfx_txt =
   681               File.read(Path.explode("~~/Admin/Windows/Installer/sfx.txt")).
   675               File.read(Path.explode("~~/Admin/Windows/Installer/sfx.txt"))
   682                 replaceAllLiterally("{ISABELLE_NAME}", isabelle_name)
   676                 .replace("{ISABELLE_NAME}", isabelle_name)
   683 
   677 
   684             Bytes.write(release.dist_dir + isabelle_exe,
   678             Bytes.write(release.dist_dir + isabelle_exe,
   685               Bytes.read(sfx_exe) + Bytes(sfx_txt) + Bytes.read(exe_archive))
   679               Bytes.read(sfx_exe) + Bytes(sfx_txt) + Bytes.read(exe_archive))
   686             File.set_executable(release.dist_dir + isabelle_exe, true)
   680             File.set_executable(release.dist_dir + isabelle_exe, true)
   687         }
   681         }