equal
deleted
inserted
replaced
5 */ |
5 */ |
6 |
6 |
7 package isabelle |
7 package isabelle |
8 |
8 |
9 |
9 |
10 object Build_Scala |
10 object Build_Scala { |
11 { |
|
12 /* downloads */ |
11 /* downloads */ |
13 |
12 |
14 sealed case class Download( |
13 sealed case class Download( |
15 name: String, |
14 name: String, |
16 version: String, |
15 version: String, |
17 url: String, |
16 url: String, |
18 physical_url: String = "", |
17 physical_url: String = "", |
19 base_version: String = "3") |
18 base_version: String = "3" |
20 { |
19 ) { |
21 def make_url(template: String): String = |
20 def make_url(template: String): String = |
22 template.replace("{V}", version).replace("{B}", base_version) |
21 template.replace("{V}", version).replace("{B}", base_version) |
23 |
22 |
24 def proper_url: String = make_url(proper_string(physical_url).getOrElse(url)) |
23 def proper_url: String = make_url(proper_string(physical_url).getOrElse(url)) |
25 |
24 |
28 |
27 |
29 def get(path: Path, progress: Progress = new Progress): Unit = |
28 def get(path: Path, progress: Progress = new Progress): Unit = |
30 Isabelle_System.download_file(proper_url, path, progress = progress) |
29 Isabelle_System.download_file(proper_url, path, progress = progress) |
31 |
30 |
32 def get_unpacked(dir: Path, strip: Int = 0, progress: Progress = new Progress): Unit = |
31 def get_unpacked(dir: Path, strip: Int = 0, progress: Progress = new Progress): Unit = |
33 Isabelle_System.with_tmp_file("archive")(archive_path => |
32 Isabelle_System.with_tmp_file("archive")(archive_path => { |
34 { |
|
35 get(archive_path, progress = progress) |
33 get(archive_path, progress = progress) |
36 progress.echo("Unpacking " + artifact) |
34 progress.echo("Unpacking " + artifact) |
37 Isabelle_System.gnutar("-xzf " + File.bash_path(archive_path), |
35 Isabelle_System.gnutar("-xzf " + File.bash_path(archive_path), |
38 dir = dir, strip = strip).check |
36 dir = dir, strip = strip).check |
39 }) |
37 }) |
66 |
64 |
67 /* build Scala component */ |
65 /* build Scala component */ |
68 |
66 |
69 def build_scala( |
67 def build_scala( |
70 target_dir: Path = Path.current, |
68 target_dir: Path = Path.current, |
71 progress: Progress = new Progress): Unit = |
69 progress: Progress = new Progress |
72 { |
70 ): Unit = { |
73 /* component */ |
71 /* component */ |
74 |
72 |
75 val component_name = main_download.name + "-" + main_download.version |
73 val component_name = main_download.name + "-" + main_download.version |
76 val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name)) |
74 val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component_name)) |
77 progress.echo("Component " + component_dir) |
75 progress.echo("Component " + component_dir) |
89 Url.read(Url("https://www.apache.org/licenses/LICENSE-2.0.txt"))) |
87 Url.read(Url("https://www.apache.org/licenses/LICENSE-2.0.txt"))) |
90 |
88 |
91 |
89 |
92 /* classpath */ |
90 /* classpath */ |
93 |
91 |
94 val classpath: List[String] = |
92 val classpath: List[String] = { |
95 { |
|
96 def no_function(name: String): String = "function " + name + "() {\n:\n}" |
93 def no_function(name: String): String = "function " + name + "() {\n:\n}" |
97 val script = |
94 val script = |
98 cat_lines(List( |
95 cat_lines(List( |
99 no_function("stty"), |
96 no_function("stty"), |
100 no_function("tput"), |
97 no_function("tput"), |
140 |
137 |
141 /* Isabelle tool wrapper */ |
138 /* Isabelle tool wrapper */ |
142 |
139 |
143 val isabelle_tool = |
140 val isabelle_tool = |
144 Isabelle_Tool("build_scala", "build Isabelle Scala component from official downloads", |
141 Isabelle_Tool("build_scala", "build Isabelle Scala component from official downloads", |
145 Scala_Project.here, args => |
142 Scala_Project.here, args => { |
146 { |
|
147 var target_dir = Path.current |
143 var target_dir = Path.current |
148 |
144 |
149 val getopts = Getopts(""" |
145 val getopts = Getopts(""" |
150 Usage: isabelle build_scala [OPTIONS] |
146 Usage: isabelle build_scala [OPTIONS] |
151 |
147 |