-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
47 lines (36 loc) · 1.18 KB
/
build
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
#!/bin/sh
set -e # Exit on failure
# Check if docker is installed
if [ ! -x "$(command -v docker)" ]; then
echo "docker is not installed"
echo "installation instructions might be here: https://docs.docker.com/engine/install/"
exit 0
fi
# Define target architectures
TARGETS="android"
# Build using Docker for each target
for target in $TARGETS; do
echo "Starting $target build..."
docker build -t build-$target -f Dockerfile.$target .
echo "Build completed!"
echo "Running build-$target docker"
container_id=$(docker run -d build-$target) || fail "Failed to run container"
current_dir=$(pwd)
folder_name="lib/$target"
if [ -d "$folder_name" ]; then
rm -rf "$folder_name"
fi
mkdir "$folder_name"
if [ "$target" == "linux" ]; then
architecture="x86_64-unknown-linux-gnu"
fi
if [ "$target" == "android" ]; then
architecture="aarch64-linux-android"
fi
full_path="/$current_dir/$folder_name"
docker cp -a $container_id:"/app/target/$architecture/release/libbdk_flutter.a" $full_path
echo "File copied"
docker kill $container_id
echo "build-$target container stoppped"
done
echo "Build completed! Libraries are in lib/android * folders."