64202
|
1 |
/* Title: Pure/Admin/build_release.scala
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Build full Isabelle distribution from repository.
|
|
5 |
*/
|
|
6 |
|
|
7 |
package isabelle
|
|
8 |
|
|
9 |
|
|
10 |
object Build_Release
|
|
11 |
{
|
|
12 |
def build_release(base_dir: Path,
|
|
13 |
progress: Progress = Ignore_Progress,
|
|
14 |
rev: String = "",
|
|
15 |
official_release: Boolean = false,
|
|
16 |
release_name: String = "",
|
|
17 |
build_library: Boolean = false,
|
|
18 |
parallel_jobs: Int = 1,
|
|
19 |
remote_mac: String = "")
|
|
20 |
{
|
|
21 |
/* release info */
|
|
22 |
|
|
23 |
val release_date = Date.now()
|
|
24 |
|
|
25 |
val distribution_name =
|
|
26 |
if (release_name != "") release_name
|
|
27 |
else "Isabelle_" + Date.Format.date(release_date)
|
|
28 |
|
|
29 |
val distribution_dir = base_dir + Path.explode("dist-" + distribution_name)
|
|
30 |
|
|
31 |
|
|
32 |
/* make distribution */
|
|
33 |
|
|
34 |
progress.bash(
|
|
35 |
"isabelle makedist -d " + File.bash_path(base_dir) + " -j" + parallel_jobs.toString +
|
|
36 |
(if (official_release) " -O" else "") +
|
|
37 |
(if (release_name != "") " -r " + File.bash_string(release_name) else "") +
|
|
38 |
(if (rev != "") " " + File.bash_string(rev) else ""),
|
|
39 |
echo = true).check
|
|
40 |
|
|
41 |
|
|
42 |
/* make application bundles */
|
|
43 |
|
|
44 |
for (platform_family <- List("linux", "windows", "windows64", "macos")) {
|
|
45 |
progress.echo("\n*** " + platform_family + " ***")
|
|
46 |
progress.bash(
|
|
47 |
"isabelle makedist_bundle " +
|
|
48 |
File.bash_path(distribution_dir + Path.explode(distribution_name + ".tar.gz")) +
|
|
49 |
" " + File.bash_string(platform_family) +
|
|
50 |
(if (remote_mac == "") "" else " " + File.bash_string(remote_mac)),
|
|
51 |
echo = true).check
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
/* minimal website */
|
|
56 |
|
|
57 |
File.write(distribution_dir + Path.explode("index.html"),
|
|
58 |
"""<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
59 |
<html>
|
|
60 |
<head>
|
|
61 |
<title>""" + HTML.output(distribution_name) + """</title>
|
|
62 |
</head>
|
|
63 |
|
|
64 |
<body>
|
|
65 |
<h1>""" + HTML.output(distribution_name) + """</h1>
|
|
66 |
<ul>
|
|
67 |
<li><a href=""" + "\"" + HTML.output(distribution_name) + """_app.tar.gz">Linux</a></li>
|
|
68 |
<li><a href=""" + "\"" + HTML.output(distribution_name) + """-win32.exe">Windows</a></li>
|
|
69 |
<li><a href=""" + "\"" + HTML.output(distribution_name) + """-win64.exe">Windows (64bit)</a></li>
|
|
70 |
<li><a href=""" + "\"" + HTML.output(distribution_name) + """.dmg">Mac OS X</a></li>
|
|
71 |
</ul>
|
|
72 |
</body>
|
|
73 |
|
|
74 |
</html>
|
|
75 |
""")
|
|
76 |
|
|
77 |
|
|
78 |
/* HTML library */
|
|
79 |
|
|
80 |
if (build_library)
|
|
81 |
progress.bash("\"$ISABELLE_HOME/Admin/Release/build_library\" -j" + parallel_jobs.toString +
|
|
82 |
File.bash_path(distribution_dir +
|
|
83 |
Path.explode(distribution_name + "_" +
|
|
84 |
Isabelle_System.getenv_strict("ISABELLE_PLATFORM_FAMILY") + ".tar.gz"))).check
|
|
85 |
}
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
/** command line entry point **/
|
|
90 |
|
|
91 |
def main(args: Array[String])
|
|
92 |
{
|
|
93 |
Command_Line.tool0 {
|
|
94 |
var remote_mac = ""
|
|
95 |
var official_release = false
|
|
96 |
var release_name = ""
|
|
97 |
var parallel_jobs = 1
|
|
98 |
var build_library = false
|
|
99 |
var rev = ""
|
|
100 |
|
|
101 |
val getopts = Getopts("""
|
|
102 |
Usage: Admin/build_release [OPTIONS] BASE_DIR
|
|
103 |
|
|
104 |
Options are:
|
|
105 |
-M USER@HOST remote Mac OS X for dmg build
|
|
106 |
-O official release (not release-candidate)
|
|
107 |
-R RELEASE proper release with name
|
|
108 |
-j INT maximum number of parallel jobs (default 1)
|
|
109 |
-l build library
|
|
110 |
-r REV Mercurial changeset id (default: RELEASE or tip)
|
|
111 |
|
|
112 |
Build Isabelle release in base directory, using the local repository clone.
|
|
113 |
""",
|
|
114 |
"M:" -> (arg => remote_mac = arg),
|
|
115 |
"O" -> (_ => official_release = true),
|
|
116 |
"R:" -> (arg => release_name = arg),
|
|
117 |
"j:" -> (arg => parallel_jobs = Value.Int.parse(arg)),
|
|
118 |
"l" -> (_ => build_library))
|
|
119 |
|
|
120 |
val more_args = getopts(args)
|
|
121 |
val base_dir = more_args match { case List(base_dir) => base_dir case _ => getopts.usage() }
|
|
122 |
|
|
123 |
val progress = new Console_Progress()
|
|
124 |
|
|
125 |
build_release(Path.explode(base_dir), progress = progress, rev = rev,
|
|
126 |
official_release = official_release, release_name = release_name,
|
|
127 |
build_library = build_library, parallel_jobs = parallel_jobs, remote_mac = remote_mac)
|
|
128 |
}
|
|
129 |
}
|
|
130 |
}
|