38 isabelle.setup.Build.build(java_context, fresh) |
38 isabelle.setup.Build.build(java_context, fresh) |
39 } |
39 } |
40 |
40 |
41 def context(dir: Path, |
41 def context(dir: Path, |
42 component: Boolean = false, |
42 component: Boolean = false, |
|
43 no_title: Boolean = false, |
43 do_build: Boolean = false, |
44 do_build: Boolean = false, |
44 module: Option[Path] = None): Context = |
45 module: Option[Path] = None): Context = |
45 { |
46 { |
46 val props_name = |
47 val props_name = |
47 if (component) isabelle.setup.Build.COMPONENT_BUILD_PROPS |
48 if (component) isabelle.setup.Build.COMPONENT_BUILD_PROPS |
48 else isabelle.setup.Build.BUILD_PROPS |
49 else isabelle.setup.Build.BUILD_PROPS |
49 val props_path = dir + Path.explode(props_name) |
50 val props_path = dir + Path.explode(props_name) |
50 |
51 |
51 val props = new JProperties |
52 val props = new JProperties |
52 props.load(Files.newBufferedReader(props_path.java_path)) |
53 props.load(Files.newBufferedReader(props_path.java_path)) |
|
54 if (no_title) props.remove(isabelle.setup.Build.TITLE) |
53 if (do_build) props.remove(isabelle.setup.Build.NO_BUILD) |
55 if (do_build) props.remove(isabelle.setup.Build.NO_BUILD) |
54 if (module.isDefined) props.put(isabelle.setup.Build.MODULE, File.standard_path(module.get)) |
56 if (module.isDefined) props.put(isabelle.setup.Build.MODULE, File.standard_path(module.get)) |
55 |
57 |
56 new Context(new isabelle.setup.Build.Context(dir.java_path, props, props_path.implode)) |
58 new Context(new isabelle.setup.Build.Context(dir.java_path, props, props_path.implode)) |
57 } |
59 } |
58 |
60 |
59 def build(dir: Path, |
61 def build(dir: Path, |
60 fresh: Boolean = false, |
62 fresh: Boolean = false, |
61 component: Boolean = false, |
63 component: Boolean = false, |
|
64 no_title: Boolean = false, |
62 do_build: Boolean = false, |
65 do_build: Boolean = false, |
63 module: Option[Path] = None): Unit = |
66 module: Option[Path] = None): Unit = |
64 { |
67 { |
65 context(dir, component = component, do_build = do_build, module = module).build(fresh = fresh) |
68 context(dir, component = component, no_title = no_title, do_build = do_build, module = module) |
|
69 .build(fresh = fresh) |
|
70 } |
|
71 |
|
72 def build_result(dir: Path, component: Boolean = false): Bytes = |
|
73 { |
|
74 Isabelle_System.with_tmp_file("result", "jar")(tmp_file => |
|
75 { |
|
76 build(dir, component = component, no_title = true, do_build = true, module = Some(tmp_file)) |
|
77 Bytes.read(tmp_file) |
|
78 }) |
66 } |
79 } |
67 |
80 |
68 def component_contexts(): List[Context] = |
81 def component_contexts(): List[Context] = |
69 isabelle.setup.Build.component_contexts().asScala.toList.map(new Context(_)) |
82 isabelle.setup.Build.component_contexts().asScala.toList.map(new Context(_)) |
70 } |
83 } |