1 
 2 # Building Babylon
 3 
 4 ----
 5 
 6 * [Contents](hat-00.md)
 7 * House Keeping
 8   * [Project Layout](hat-01-01-project-layout.md)
 9   * [Building Babylon](hat-01-02-building-babylon.md)
10   * [Maven and CMake](hat-01-03-maven-cmake.md)
11 * Programming Model
12   * [Programming Model](hat-03-programming-model.md)
13 * Interface Mapping
14   * [Interface Mapping Overview](hat-04-01-interface-mapping.md)
15   * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md)
16 * Implementation Detail
17   * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
18 
19 ---
20 
21 # Building Babylon
22 
23 Openjdk Babylon can be found here [https://github.com/openjdk/babylon](https://github.com/openjdk/babylon)
24 
25 ## Some useful vars
26 
27 You will need an existing version of JDK to build babylon and jtreg.
28 
29 The following build process assumes you have `BOOT_JDK` set to an existing JDK
30 
31 ```bash
32 export BOOT_JDK=${HOME}/java/jdk-22.0.1.jdk/Contents/Home/
33 ```
34 ### Clone Babylon from github
35 
36 [https://github.com/opendjk/babylon.git](https://github.com/opendjk/babylon.git)
37 
38 ```bash
39 export GITHUB=${HOME}/github
40 mkdir -p ${GITHUB}
41 cd ${GITHUB}
42 git clone https://github.com/opendjk/babylon.git
43 ```
44 ### Get and build jtreg
45 
46 In order to run openjdk tests we will need to build `jtreg`
47 
48 [https://github.com/openjdk/jtreg](https://github.com/openjdk/jtreg)
49 
50 ```bash
51 cd ${GITHUB}
52 git clone https://github.com/openjdk/jtreg
53 export JTREG=${GITHUB}/jtreg
54 cd ${JTREG}
55 bash make/build.sh --jdk ${BOOT_JDK}
56 ```
57 ### Configure
58 
59 ```bash
60 cd ${GITHUB}/babylon
61 bash configure  --with-boot-jdk=${BOOT_JDK} --with-jtreg=${JTREG}/build/images/jtreg
62 ```
63 On your first build configure might exit and suggest installing other
64 dependencies.  Generally I suggest just taking its recommendations and
65 restarting configure
66 
67 Eventually we should complete and are ready to build
68 
69 ### Build
70 
71 ```bash
72 make clean
73 make images
74 #Coffee time (about 10 mins?)
75 ```
76 
77 ### Run JTREG Tests
78 If we included jtreg above we can run the `babylon` tests using
79 
80 ```bash
81 cd ${GITHUB}/babylon
82 make test TEST=jdk_lang_reflect_code
83 ```
84 
85 This works because we added
86 ```
87 8<-
88 jdk_lang_reflect_code = \
89    java/lang/reflect/code
90 ->8
91 ```
92 To the file `${GITHUB}/babylon/test/jdk/TEST.groups`
93 
94 The tests themselves can be found in this directory
95 
96 ```
97 tree {GITHUB}/babylon}/test/jdk/java/lang/reflect/code
98 ```