|
74055
|
1 |
/* Title: Pure/Tools/scala_build.scala
|
|
|
2 |
Author: Makarius
|
|
|
3 |
|
|
|
4 |
Manage and build Isabelle/Scala/Java components.
|
|
|
5 |
*/
|
|
|
6 |
|
|
|
7 |
package isabelle
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
import java.util.{Properties => JProperties}
|
|
|
11 |
import java.nio.file.Files
|
|
|
12 |
|
|
|
13 |
import scala.jdk.CollectionConverters._
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
object Scala_Build
|
|
|
17 |
{
|
|
|
18 |
type Context = isabelle.setup.Build.Context
|
|
|
19 |
|
|
|
20 |
def context(dir: Path,
|
|
|
21 |
component: Boolean = false,
|
|
|
22 |
more_props: Properties.T = Nil): Context =
|
|
|
23 |
{
|
|
|
24 |
val props_name =
|
|
|
25 |
if (component) isabelle.setup.Build.COMPONENT_BUILD_PROPS
|
|
|
26 |
else isabelle.setup.Build.BUILD_PROPS
|
|
|
27 |
val props_path = dir + Path.explode(props_name)
|
|
|
28 |
|
|
|
29 |
val props = new JProperties
|
|
|
30 |
props.load(Files.newBufferedReader(props_path.java_path))
|
|
|
31 |
for ((a, b) <- more_props) props.put(a, b)
|
|
|
32 |
|
|
|
33 |
new isabelle.setup.Build.Context(dir.java_path, props, props_path.implode)
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
def build(dir: Path,
|
|
|
37 |
fresh: Boolean = false,
|
|
|
38 |
component: Boolean = false,
|
|
|
39 |
more_props: Properties.T = Nil): Unit =
|
|
|
40 |
{
|
|
|
41 |
isabelle.setup.Build.build(
|
|
|
42 |
context(dir, component = component, more_props = more_props), fresh)
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
def component_contexts(): List[Context] =
|
|
|
46 |
isabelle.setup.Build.component_contexts().asScala.toList
|
|
|
47 |
}
|