Skip to content

Commit 84fadf8

Browse files
authored
Add svace_builder.sh (#119)
1 parent bae37a9 commit 84fadf8

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/svace_builder.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "===== Start svace_builder.sh ====="
5+
6+
EMBEDDER_DIR=$PWD
7+
EMBEDDER_DIR_NAME=$(basename $EMBEDDER_DIR)
8+
PARENT_DIR=$(dirname "$EMBEDDER_DIR")
9+
10+
echo "Changing directory to parent directory: $PARENT_DIR"
11+
cd $PARENT_DIR
12+
13+
# Install depot_tools
14+
if [[ ! -d depot_tools ]]; then
15+
git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
16+
fi
17+
18+
# Add depot_tools to PATH
19+
if [[ ! $PATH == *"depot_tools"* ]]; then
20+
export PATH="$PARENT_DIR/depot_tools:$PATH"
21+
fi
22+
23+
# Rename the embedder directory to src to minimize code modifications.
24+
if [[ -d "embedder" ]] && [[ $EMBEDDER_DIR_NAME = "embedder" ]]; then
25+
mv $EMBEDDER_DIR_NAME src
26+
fi
27+
28+
# Run gclient config to set up the .gclient file.
29+
if [[ ! -f .gclient ]]; then
30+
gclient config --name=src --unmanaged [email protected]:flutter-tizen/embedder.git
31+
fi
32+
33+
# Retry gclient sync up to 5 times
34+
MAX_RETRIES=5
35+
RETRY_COUNT=0
36+
SYNC_SUCCESS=false
37+
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
38+
echo "Attempting gclient sync (attempt $((RETRY_COUNT + 1)) of $MAX_RETRIES)..."
39+
if gclient sync; then
40+
echo "gclient sync succeeded!"
41+
SYNC_SUCCESS=true
42+
break
43+
else
44+
RETRY_COUNT=$((RETRY_COUNT + 1))
45+
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
46+
echo "gclient sync failed. Retrying in 10 seconds..."
47+
sleep 10
48+
else
49+
echo "gclient sync failed after $MAX_RETRIES attempts."
50+
fi
51+
fi
52+
done
53+
54+
# Print the results of gclient sync.
55+
if [[ "$SYNC_SUCCESS" = false ]]; then
56+
echo "Error: gclient sync failed after $MAX_RETRIES attempts. Exiting."
57+
exit 1
58+
else
59+
echo "Success: gclient sync completed successfully."
60+
fi
61+
62+
# Generate sysroot for ARM architecture.
63+
src/tools/generate_sysroot.py --api-version 6.0 --out src/sysroot-6.0
64+
65+
# Run the ninja build.
66+
src/tools/gn \
67+
--target-cpu arm \
68+
--target-toolchain /usr/lib/llvm-17 \
69+
--target-sysroot src/sysroot-6.0/arm \
70+
--target-dir build
71+
ninja -C src/out/build
72+

0 commit comments

Comments
 (0)