1 #!/bin/bash
2
3 # Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # This code is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License version 2 only, as
8 # published by the Free Software Foundation. Oracle designates this
9 # particular file as subject to the "Classpath" exception as provided
10 # by Oracle in the LICENSE file that accompanied this code.
11 #
12 # This code is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # version 2 for more details (a copy is included in the LICENSE file that
16 # accompanied this code).
17 #
18 # You should have received a copy of the GNU General Public License version
19 # 2 along with this work; if not, write to the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 #
22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
23 # or visit www.oracle.com if you need additional information or have any
24 # questions.
25
26 if [ "$#" -lt 3 ]; then
27 echo "Usage: test.sh <fork> <branch> <path>" >&2
28 exit 1
29 fi
30
31 GREEN="\033[0;32m"
32 NC="\033[0m" # No Color (reset)
33
34 fork=$1
35 branch=$2
36 remote_path=$3
37
38 echo $fork
39 echo $branch
40 echo $remote_path
41
42 if [ ! -d $remote_path ];
43 then
44 mkdir -p $remote_path
45 cd $$remote_path
46 git clone $fork $$remote_path
47 fi
48
49 #Assuming the remote path ends with babylon
50 cd $remote_path
51 git fetch --all
52 git checkout $branch
53 git pull
54
55 echo "bash configure --with-boot-jdk=$HOME/.sdkman/candidates/java/current"
56 bash configure --with-boot-jdk="$HOME/.sdkman/candidates/java/current" > jvmconfig.log
57 make clean
58 make images
59
60 ## Build HAT
61 cd hat
62 if [ ! -d jextract-25 ];
63 then
64 echo "ARCHITECTIRE $(uname -m)"
65 if [[ "$(uname -m)" == "x86_64" ]]; then
66 wget https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_linux-x64_bin.tar.gz
67 tar xvzf openjdk-25-jextract+2-4_linux-x64_bin.tar.gz
68 elif [[ "$(uname -m)" == "arm64" ]]; then
69 wget https://download.java.net/java/early_access/jextract/25/2/openjdk-25-jextract+2-4_macos-aarch64_bin.tar.gz
70 tar xvzf openjdk-25-jextract+2-4_macos-aarch64_bin.tar.gz
71 fi
72 echo "export PATH=$PWD/jextract-25/bin:$PATH" >> setup.sh
73 echo "source env.bash" >> setup.sh
74 fi
75
76 source setup.sh > /dev/null 2> /dev/null
77 mvn clean package