src/Pure/Admin/build_release.scala
changeset 74872 9e9a308562da
parent 74850 c5ce1e2f26ab
child 74876 e8935405f082
equal deleted inserted replaced
74871:0597884e6e91 74872:9e9a308562da
    14   private def execute(dir: Path, script: String): Unit =
    14   private def execute(dir: Path, script: String): Unit =
    15     Isabelle_System.bash(script, cwd = dir.file).check
    15     Isabelle_System.bash(script, cwd = dir.file).check
    16 
    16 
    17   private def execute_tar(dir: Path, args: String, strip: Int = 0): Unit =
    17   private def execute_tar(dir: Path, args: String, strip: Int = 0): Unit =
    18     Isabelle_System.gnutar(args, dir = dir, strip = strip).check
    18     Isabelle_System.gnutar(args, dir = dir, strip = strip).check
       
    19 
       
    20   private def bash_java_opens(args: String*): String =
       
    21     Bash.strings(args.toList.flatMap(arg => List("--add-opens", arg + "=ALL-UNNAMED")))
    19 
    22 
    20   object Release_Context
    23   object Release_Context
    21   {
    24   {
    22     def apply(
    25     def apply(
    23       target_dir: Path,
    26       target_dir: Path,
   488   def build_release(
   491   def build_release(
   489     options: Options,
   492     options: Options,
   490     context: Release_Context,
   493     context: Release_Context,
   491     afp_rev: String = "",
   494     afp_rev: String = "",
   492     platform_families: List[Platform.Family.Value] = default_platform_families,
   495     platform_families: List[Platform.Family.Value] = default_platform_families,
   493     java_home: Path = default_java_home,
       
   494     more_components: List[Path] = Nil,
   496     more_components: List[Path] = Nil,
   495     website: Option[Path] = None,
   497     website: Option[Path] = None,
   496     build_sessions: List[String] = Nil,
   498     build_sessions: List[String] = Nil,
   497     build_library: Boolean = false,
   499     build_library: Boolean = false,
   498     parallel_jobs: Int = 1): Unit =
   500     parallel_jobs: Int = 1): Unit =
   701                 .replace("{CLASSPATH}",
   703                 .replace("{CLASSPATH}",
   702                   cat_lines(classpath.map(cp =>
   704                   cat_lines(classpath.map(cp =>
   703                     "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
   705                     "    <cp>%EXEDIR%\\" + File.platform_path(cp).replace('/', '\\') + "</cp>")))
   704                 .replace("\\jdk\\", "\\" + jdk_component + "\\"))
   706                 .replace("\\jdk\\", "\\" + jdk_component + "\\"))
   705 
   707 
       
   708             val java_opts =
       
   709               bash_java_opens(
       
   710                 "java.base/java.io",
       
   711                 "java.base/java.lang",
       
   712                 "java.base/java.lang.reflect",
       
   713                 "java.base/java.text",
       
   714                 "java.base/java.util",
       
   715                 "java.desktop/java.awt.font")
       
   716             val launch4j_jar =
       
   717               Path.explode("windows_app/launch4j-" + Platform.family + "/launch4j.jar")
       
   718 
   706             execute(tmp_dir,
   719             execute(tmp_dir,
   707               "env JAVA_HOME=" + File.bash_platform_path(java_home) +
   720               cat_lines(List(
   708               " \"windows_app/launch4j-${ISABELLE_PLATFORM_FAMILY}/launch4j\" isabelle.xml")
   721                 "export LAUNCH4J=" + File.bash_platform_path(launch4j_jar),
       
   722                 "isabelle java " + java_opts + " -jar \"$LAUNCH4J\" isabelle.xml")))
   709 
   723 
   710             Isabelle_System.copy_file(app_template + Path.explode("manifest.xml"),
   724             Isabelle_System.copy_file(app_template + Path.explode("manifest.xml"),
   711               isabelle_target + isabelle_exe.ext("manifest"))
   725               isabelle_target + isabelle_exe.ext("manifest"))
   712 
   726 
   713 
   727 
   839 
   853 
   840 
   854 
   841 
   855 
   842   /** command line entry point **/
   856   /** command line entry point **/
   843 
   857 
   844   def default_java_home: Path = Path.explode("$JAVA_HOME").expand
       
   845 
       
   846   def main(args: Array[String]): Unit =
   858   def main(args: Array[String]): Unit =
   847   {
   859   {
   848     Command_Line.tool {
   860     Command_Line.tool {
   849       var afp_rev = ""
   861       var afp_rev = ""
   850       var components_base: Path = Components.default_components_base
   862       var components_base: Path = Components.default_components_base
   851       var target_dir = Path.current
   863       var target_dir = Path.current
   852       var java_home = default_java_home
       
   853       var release_name = ""
   864       var release_name = ""
   854       var source_archive = ""
   865       var source_archive = ""
   855       var website: Option[Path] = None
   866       var website: Option[Path] = None
   856       var build_sessions: List[String] = Nil
   867       var build_sessions: List[String] = Nil
   857       var more_components: List[Path] = Nil
   868       var more_components: List[Path] = Nil
   867   Options are:
   878   Options are:
   868     -A REV       corresponding AFP changeset id
   879     -A REV       corresponding AFP changeset id
   869     -C DIR       base directory for Isabelle components (default: """ +
   880     -C DIR       base directory for Isabelle components (default: """ +
   870         Components.default_components_base + """)
   881         Components.default_components_base + """)
   871     -D DIR       target directory (default ".")
   882     -D DIR       target directory (default ".")
   872     -J JAVA_HOME Java version for running launch4j (e.g. version 11)
       
   873     -R RELEASE   explicit release name
   883     -R RELEASE   explicit release name
   874     -S ARCHIVE   use existing source archive (file or URL)
   884     -S ARCHIVE   use existing source archive (file or URL)
   875     -W WEBSITE   produce minimal website in given directory
   885     -W WEBSITE   produce minimal website in given directory
   876     -b SESSIONS  build platform-specific session images (separated by commas)
   886     -b SESSIONS  build platform-specific session images (separated by commas)
   877     -c ARCHIVE   clean bundling with additional component .tar.gz archive
   887     -c ARCHIVE   clean bundling with additional component .tar.gz archive
   884   Build Isabelle release in base directory, using the local repository clone.
   894   Build Isabelle release in base directory, using the local repository clone.
   885 """,
   895 """,
   886         "A:" -> (arg => afp_rev = arg),
   896         "A:" -> (arg => afp_rev = arg),
   887         "C:" -> (arg => components_base = Path.explode(arg)),
   897         "C:" -> (arg => components_base = Path.explode(arg)),
   888         "D:" -> (arg => target_dir = Path.explode(arg)),
   898         "D:" -> (arg => target_dir = Path.explode(arg)),
   889         "J:" -> (arg => java_home = Path.explode(arg)),
       
   890         "R:" -> (arg => release_name = arg),
   899         "R:" -> (arg => release_name = arg),
   891         "S:" -> (arg => source_archive = arg),
   900         "S:" -> (arg => source_archive = arg),
   892         "W:" -> (arg => website = Some(Path.explode(arg))),
   901         "W:" -> (arg => website = Some(Path.explode(arg))),
   893         "b:" -> (arg => build_sessions = space_explode(',', arg)),
   902         "b:" -> (arg => build_sessions = space_explode(',', arg)),
   894         "c:" -> (arg =>
   903         "c:" -> (arg =>
   931           use_release_archive(context, archive, id = rev)
   940           use_release_archive(context, archive, id = rev)
   932           context
   941           context
   933         }
   942         }
   934 
   943 
   935       build_release(options, context, afp_rev = afp_rev, platform_families = platform_families,
   944       build_release(options, context, afp_rev = afp_rev, platform_families = platform_families,
   936         java_home = java_home, more_components = more_components, build_sessions = build_sessions,
   945         more_components = more_components, build_sessions = build_sessions,
   937         build_library = build_library, parallel_jobs = parallel_jobs, website = website)
   946         build_library = build_library, parallel_jobs = parallel_jobs, website = website)
   938     }
   947     }
   939   }
   948   }
   940 }
   949 }