--- a/Admin/Release/CHECKLIST Thu Oct 13 23:09:26 2016 +0200
+++ b/Admin/Release/CHECKLIST Thu Oct 13 23:44:40 2016 +0200
@@ -78,7 +78,7 @@
- fully-automated packaging (e.g. on macbroy2):
- hg up -r DISTNAME && Admin/Release/build -M macbroy30 -O -l -r DISTNAME /home/isabelle/dist
+ hg up -r DISTNAME && Admin/build_release -M macbroy30 -O -l -R DISTNAME /home/isabelle/dist
Final release stage
--- a/Admin/Release/build Thu Oct 13 23:09:26 2016 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-#!/usr/bin/env bash
-#
-# Author: Makarius
-#
-# build full Isabelle distribution from repository
-
-THIS="$(cd "$(dirname "$0")"; pwd)"
-PRG="$(basename "$0")"
-
-
-## diagnostics
-
-PRG="$(basename "$0")"
-
-function usage()
-{
- echo
- echo "Usage: isabelle $PRG [OPTIONS] DIR [VERSION]"
- echo
- echo " Options are:"
- echo " -M USER@HOST remote Mac OS X for dmg build"
- echo " -O official release (not release-candidate)"
- echo " -j INT maximum number of parallel jobs (default 1)"
- echo " -l build library"
- echo " -r RELEASE proper release with name"
- echo
- echo " Make Isabelle distribution DIR, using the local repository clone."
- echo
- echo " VERSION identifies the snapshot, using usual Mercurial terminology;"
- echo " the default is RELEASE if given, otherwise \"tip\"."
- echo
- exit 1
-}
-
-function fail()
-{
- echo "$1" >&2
- exit 2
-}
-
-function check_number()
-{
- [ -n "$1" -a -z "$(echo "$1" | tr -d '[0-9]')" ] || fail "Bad number: \"$1\""
-}
-
-
-## process command line
-
-# options
-
-REMOTE_MAC=""
-OFFICIAL_RELEASE=""
-JOBS=""
-LIBRARY=""
-RELEASE=""
-
-while getopts "M:Oj:lr:" OPT
-do
- case "$OPT" in
- M)
- REMOTE_MAC="$OPTARG"
- ;;
- O)
- OFFICIAL_RELEASE="-O"
- ;;
- j)
- check_number "$OPTARG"
- JOBS="-j $OPTARG"
- ;;
- l)
- LIBRARY="true"
- ;;
- r)
- RELEASE="$OPTARG"
- ;;
- \?)
- usage
- ;;
- esac
-done
-
-shift $(($OPTIND - 1))
-
-
-# args
-
-BASE_DIR=""
-[ "$#" -gt 0 ] && { BASE_DIR="$1"; shift; }
-[ -z "$BASE_DIR" ] && usage
-
-VERSION=""
-[ "$#" -gt 0 ] && { VERSION="$1"; shift; }
-[ -z "$VERSION" ] && VERSION="$RELEASE"
-[ -z "$VERSION" ] && VERSION="tip"
-
-[ "$#" -gt 0 ] && usage
-
-
-## Isabelle settings
-
-ISABELLE_TOOL="$THIS/../../bin/isabelle"
-ISABELLE_PLATFORM_FAMILY="$("$ISABELLE_TOOL" getenv -b ISABELLE_PLATFORM_FAMILY)"
-
-
-## main
-
-# make dist
-
-if [ -z "$RELEASE" ]; then
- DISTNAME="Isabelle_$(env LC_ALL=C date "+%d-%b-%Y")"
- "$ISABELLE_TOOL" makedist -d "$BASE_DIR" $JOBS $OFFICIAL_RELEASE
-else
- DISTNAME="$RELEASE"
- "$ISABELLE_TOOL" makedist -d "$BASE_DIR" $JOBS $OFFICIAL_RELEASE -r "$RELEASE"
-fi
-[ "$?" = 0 ] || exit "$?"
-
-DISTBASE="$BASE_DIR/dist-${DISTNAME}"
-
-
-# make bundles
-
-for PLATFORM_FAMILY in linux windows windows64 macos
-do
-
-echo
-echo "*** $PLATFORM_FAMILY ***"
-
-if [ -n "$REMOTE_MAC" ]; then
- "$ISABELLE_TOOL" makedist_bundle "$DISTBASE/${DISTNAME}.tar.gz" "$PLATFORM_FAMILY" "$REMOTE_MAC"
-else
- "$ISABELLE_TOOL" makedist_bundle "$DISTBASE/${DISTNAME}.tar.gz" "$PLATFORM_FAMILY"
-fi
-[ "$?" = 0 ] || exit "$?"
-
-done
-
-
-# minimal index
-
-cat > "$DISTBASE/index.html" <<EOF
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<title>${DISTNAME}</title>
-</head>
-
-<body>
-<h1>${DISTNAME}</h1>
-<ul>
-<li><a href="${DISTNAME}_app.tar.gz">Linux</a></li>
-<li><a href="${DISTNAME}-win32.exe">Windows</a></li>
-<li><a href="${DISTNAME}-win64.exe">Windows (64bit)</a></li>
-<li><a href="${DISTNAME}.dmg">Mac OS X</a></li>
-</ul>
-</body>
-
-</html>
-EOF
-
-
-# HTML library
-
-if [ -n "$LIBRARY" ]; then
- "$THIS/build_library" $JOBS "$DISTBASE/${DISTNAME}_${ISABELLE_PLATFORM_FAMILY}.tar.gz"
-fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/build_release Thu Oct 13 23:44:40 2016 +0200
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+#
+# DESCRIPTION: build full Isabelle distribution from repository
+
+THIS="$(cd "$(dirname "$0")"; pwd)"
+
+"$THIS/build" jars || exit $?
+exec "$THIS/../bin/isabelle_java" isabelle.Build_Release "$@"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/Admin/build_release.scala Thu Oct 13 23:44:40 2016 +0200
@@ -0,0 +1,130 @@
+/* Title: Pure/Admin/build_release.scala
+ Author: Makarius
+
+Build full Isabelle distribution from repository.
+*/
+
+package isabelle
+
+
+object Build_Release
+{
+ def build_release(base_dir: Path,
+ progress: Progress = Ignore_Progress,
+ rev: String = "",
+ official_release: Boolean = false,
+ release_name: String = "",
+ build_library: Boolean = false,
+ parallel_jobs: Int = 1,
+ remote_mac: String = "")
+ {
+ /* release info */
+
+ val release_date = Date.now()
+
+ val distribution_name =
+ if (release_name != "") release_name
+ else "Isabelle_" + Date.Format.date(release_date)
+
+ val distribution_dir = base_dir + Path.explode("dist-" + distribution_name)
+
+
+ /* make distribution */
+
+ progress.bash(
+ "isabelle makedist -d " + File.bash_path(base_dir) + " -j" + parallel_jobs.toString +
+ (if (official_release) " -O" else "") +
+ (if (release_name != "") " -r " + File.bash_string(release_name) else "") +
+ (if (rev != "") " " + File.bash_string(rev) else ""),
+ echo = true).check
+
+
+ /* make application bundles */
+
+ for (platform_family <- List("linux", "windows", "windows64", "macos")) {
+ progress.echo("\n*** " + platform_family + " ***")
+ progress.bash(
+ "isabelle makedist_bundle " +
+ File.bash_path(distribution_dir + Path.explode(distribution_name + ".tar.gz")) +
+ " " + File.bash_string(platform_family) +
+ (if (remote_mac == "") "" else " " + File.bash_string(remote_mac)),
+ echo = true).check
+ }
+
+
+ /* minimal website */
+
+ File.write(distribution_dir + Path.explode("index.html"),
+"""<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<html>
+<head>
+<title>""" + HTML.output(distribution_name) + """</title>
+</head>
+
+<body>
+<h1>""" + HTML.output(distribution_name) + """</h1>
+<ul>
+<li><a href=""" + "\"" + HTML.output(distribution_name) + """_app.tar.gz">Linux</a></li>
+<li><a href=""" + "\"" + HTML.output(distribution_name) + """-win32.exe">Windows</a></li>
+<li><a href=""" + "\"" + HTML.output(distribution_name) + """-win64.exe">Windows (64bit)</a></li>
+<li><a href=""" + "\"" + HTML.output(distribution_name) + """.dmg">Mac OS X</a></li>
+</ul>
+</body>
+
+</html>
+""")
+
+
+ /* HTML library */
+
+ if (build_library)
+ progress.bash("\"$ISABELLE_HOME/Admin/Release/build_library\" -j" + parallel_jobs.toString +
+ File.bash_path(distribution_dir +
+ Path.explode(distribution_name + "_" +
+ Isabelle_System.getenv_strict("ISABELLE_PLATFORM_FAMILY") + ".tar.gz"))).check
+ }
+
+
+
+ /** command line entry point **/
+
+ def main(args: Array[String])
+ {
+ Command_Line.tool0 {
+ var remote_mac = ""
+ var official_release = false
+ var release_name = ""
+ var parallel_jobs = 1
+ var build_library = false
+ var rev = ""
+
+ val getopts = Getopts("""
+Usage: Admin/build_release [OPTIONS] BASE_DIR
+
+ Options are:
+ -M USER@HOST remote Mac OS X for dmg build
+ -O official release (not release-candidate)
+ -R RELEASE proper release with name
+ -j INT maximum number of parallel jobs (default 1)
+ -l build library
+ -r REV Mercurial changeset id (default: RELEASE or tip)
+
+ Build Isabelle release in base directory, using the local repository clone.
+""",
+ "M:" -> (arg => remote_mac = arg),
+ "O" -> (_ => official_release = true),
+ "R:" -> (arg => release_name = arg),
+ "j:" -> (arg => parallel_jobs = Value.Int.parse(arg)),
+ "l" -> (_ => build_library))
+
+ val more_args = getopts(args)
+ val base_dir = more_args match { case List(base_dir) => base_dir case _ => getopts.usage() }
+
+ val progress = new Console_Progress()
+
+ build_release(Path.explode(base_dir), progress = progress, rev = rev,
+ official_release = official_release, release_name = release_name,
+ build_library = build_library, parallel_jobs = parallel_jobs, remote_mac = remote_mac)
+ }
+ }
+}
--- a/src/Pure/build-jars Thu Oct 13 23:09:26 2016 +0200
+++ b/src/Pure/build-jars Thu Oct 13 23:44:40 2016 +0200
@@ -12,6 +12,7 @@
Admin/build_doc.scala
Admin/build_history.scala
Admin/build_log.scala
+ Admin/build_release.scala
Admin/build_stats.scala
Admin/check_sources.scala
Admin/ci_api.scala