-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-google-java-format.bash
More file actions
executable file
·85 lines (74 loc) · 2.59 KB
/
build-google-java-format.bash
File metadata and controls
executable file
·85 lines (74 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
set -eux
check_baseloc () {
if [ -n "$BASELOC" ]; then
echo "BASELOC is given as $BASELOC"
else
echo "BASELOC is not set!"
exit 1
fi
}
check_arch () {
if [ -n "$ARCH" ]; then
echo "ARCH is given as $ARCH"
else
echo "ARCH is not set!"
exit 1
fi
}
check_vars () {
check_baseloc
check_arch
}
main () {
check_vars
#
COSMOCC_BIN="$BASELOC/testing/cosmopolitan/cosmocc/bin"
export PATH="$COSMOCC_BIN:$BASELOC/testing/mx:$PATH"
export JAVA_HOME="$MX_JDK_LABS"
cd "$BASELOC/testing/graal/vm"
ls "$(mx -c 1 --dy /substratevm --native-images=native-image graalvm-home)"
NATIMG_PATH="$(mx -c 1 --dy /substratevm --native-images=native-image graalvm-home)"
echo "natimg is at? $NATIMG_PATH"
export PATH="$NATIMG_PATH/bin:$PATH"
LABS_LIBDIR="$BASELOC/build/labs-$ARCH-cosmo-libs"
GRAAL_HELPERS_DIR="$BASELOC/build/graal-$ARCH-helpers"
if [ x"$ARCH" = x"x86_64" ]; then
SUBARCH="amd64"
PFE_OPT="18,16"
elif [ x"$ARCH" = x"aarch64" ]; then
SUBARCH="aarch64"
PFE_OPT="7,6"
fi
cd "$BASELOC"
NATIMG_COSMO="$NATIMG_PATH/lib/svm/clibraries/linux-$SUBARCH/cosmo"
# mkdir -p "$NATIMG_COSMO"
# cp ./build/graal-$ARCH-helpers/*.a "$NATIMG_COSMO"
cd "$BASELOC/testing/google-java-format"
native-image \
-jar google-java-format.jar \
-Os \
--libc=cosmo \
-march=compatibility \
-H:+UnlockExperimentalVMOptions\
-H:IncludeResourceBundles=com.sun.tools.javac.resources.compiler\
-H:IncludeResourceBundles=com.sun.tools.javac.resources.javac \
--no-fallback --initialize-at-build-time=com.sun.tools.javac.file.Locations \
-H:-UseContainerSupport \
-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--static \
-H:CCompilerPath="$COSMOCC_BIN/$ARCH-unknown-cosmo-cc" \
-H:CLibraryPath="$LABS_LIBDIR,$GRAAL_HELPERS_DIR" \
-H:PatchableFunctionEntry="$PFE_OPT"\
-R:StackSize=1048576 \
-o "google-java-format.$ARCH"
cd "$BASELOC/build"
cp "$BASELOC/testing/google-java-format/google-java-format.$ARCH" .
cd "$BASELOC"
}
main