clarified command-line, following other build_XYZ tools;
authorwenzelm
Wed, 28 Apr 2021 13:03:09 +0200
changeset 73863 fc13738e1933
parent 73862 460e7535df46
child 73864 6081885b9d06
clarified command-line, following other build_XYZ tools;
Admin/Release/CHECKLIST
src/Pure/Admin/build_release.scala
src/Pure/Admin/isabelle_devel.scala
--- a/Admin/Release/CHECKLIST	Wed Apr 28 12:24:39 2021 +0200
+++ b/Admin/Release/CHECKLIST	Wed Apr 28 13:03:09 2021 +0200
@@ -74,7 +74,7 @@
 
 - fully-automated packaging (e.g. on lxcisa0):
 
-  hg up -r DISTNAME && Admin/build_release -b HOL -l -R DISTNAME /home/isabelle/dist
+  hg up -r DISTNAME && Admin/build_release -D /home/isabelle/dist -b HOL -l -R DISTNAME
 
 - Docker image:
 
--- a/src/Pure/Admin/build_release.scala	Wed Apr 28 12:24:39 2021 +0200
+++ b/src/Pure/Admin/build_release.scala	Wed Apr 28 13:03:09 2021 +0200
@@ -340,8 +340,8 @@
   private val default_platform_families: List[Platform.Family.Value] =
     List(Platform.Family.linux, Platform.Family.windows, Platform.Family.macos)
 
-  def build_release(base_dir: Path,
-    options: Options,
+  def build_release(options: Options,
+    target_dir: Path = Path.current,
     components_base: Path = Components.default_components_base,
     progress: Progress = new Progress,
     rev: String = "",
@@ -360,7 +360,7 @@
     {
       val date = Date.now()
       val dist_name = proper_release_name getOrElse ("Isabelle_" + Date.Format.date(date))
-      val dist_dir = (base_dir + Path.explode("dist-" + dist_name)).absolute
+      val dist_dir = (target_dir + Path.explode("dist-" + dist_name)).absolute
 
       val version = proper_string(rev) orElse proper_release_name getOrElse "tip"
       val ident =
@@ -824,6 +824,7 @@
     Command_Line.tool {
       var afp_rev = ""
       var components_base: Path = Components.default_components_base
+      var target_dir = Path.current
       var proper_release_name: Option[String] = None
       var website: Option[Path] = None
       var build_sessions: List[String] = Nil
@@ -841,6 +842,7 @@
     -A REV       corresponding AFP changeset id
     -C DIR       base directory for Isabelle components (default: """ +
         Components.default_components_base + """)
+    -D DIR       target directory (default ".")
     -R RELEASE   proper release with name
     -W WEBSITE   produce minimal website in given directory
     -b SESSIONS  build platform-specific session images (separated by commas)
@@ -855,6 +857,7 @@
 """,
         "A:" -> (arg => afp_rev = arg),
         "C:" -> (arg => components_base = Path.explode(arg)),
+        "D:" -> (arg => target_dir = Path.explode(arg)),
         "R:" -> (arg => proper_release_name = Some(arg)),
         "W:" -> (arg => website = Some(Path.explode(arg))),
         "b:" -> (arg => build_sessions = space_explode(',', arg)),
@@ -871,14 +874,14 @@
         "r:" -> (arg => rev = arg))
 
       val more_args = getopts(args)
-      val base_dir = more_args match { case List(base_dir) => base_dir case _ => getopts.usage() }
+      if (more_args.nonEmpty) getopts.usage()
 
       val progress = new Console_Progress()
 
       if (platform_families.contains(Platform.Family.windows) && !Isabelle_System.bash("7z i").ok)
         error("Building for windows requires 7z")
 
-      build_release(Path.explode(base_dir), options, components_base = components_base,
+      build_release(options, target_dir = target_dir, components_base = components_base,
         progress = progress, rev = rev, afp_rev = afp_rev,
         proper_release_name = proper_release_name, website = website,
         platform_families =
--- a/src/Pure/Admin/isabelle_devel.scala	Wed Apr 28 12:24:39 2021 +0200
+++ b/src/Pure/Admin/isabelle_devel.scala	Wed Apr 28 13:03:09 2021 +0200
@@ -40,11 +40,13 @@
     afp_rev: String = "",
     parallel_jobs: Int = 1): Unit =
   {
-    Isabelle_System.with_tmp_dir("isadist")(base_dir =>
+    Isabelle_System.with_tmp_dir("isadist")(target_dir =>
       {
         Isabelle_System.update_directory(root + Path.explode(RELEASE_SNAPSHOT),
           website_dir =>
-            Build_Release.build_release(base_dir, options, rev = rev, afp_rev = afp_rev,
+            Build_Release.build_release(options, target_dir = target_dir,
+              rev = rev,
+              afp_rev = afp_rev,
               parallel_jobs = parallel_jobs,
               build_sessions = List(Isabelle_System.getenv("ISABELLE_LOGIC")),
               website = Some(website_dir)))