-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·94 lines (73 loc) · 3.02 KB
/
build.sh
File metadata and controls
executable file
·94 lines (73 loc) · 3.02 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
86
87
88
89
90
91
92
93
94
#!/bin/bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$script_dir"
flutter_command="$(command -v flutter || true)"
if [ -z "$flutter_command" ]; then
echo "flutter is required but was not found on PATH" >&2
exit 1
fi
dotnet_command="$(command -v dotnet || true)"
if [ -z "$dotnet_command" ] && [ -x "/usr/local/share/dotnet/dotnet" ]; then
dotnet_command="/usr/local/share/dotnet/dotnet"
fi
if [ -z "$dotnet_command" ]; then
echo "dotnet is required but was not found on PATH" >&2
exit 1
fi
flutter_bin="${flutter_command%/flutter}"
engine_version="$flutter_bin/internal/engine.version"
version="$(cat "$engine_version")"
echo "Using Flutter $version"
flutter_embedding_debug="https://storage.googleapis.com/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-$version/flutter_embedding_debug-1.0.0-$version.jar"
if [ ! -d "$repo_root/flutter_module" ]; then
echo "Expected flutter_module to exist before building iOS frameworks" >&2
exit 1
fi
if [ ! -d "$repo_root/flutter_sharp/example" ]; then
echo "Expected flutter_sharp/example to exist before building iOS frameworks" >&2
exit 1
fi
echo "Restoring flutter_module dependencies"
pushd "$repo_root/flutter_module" >/dev/null
flutter pub get
echo "Building flutter_module iOS frameworks"
flutter build ios-framework --output=../flutter_sharp/build/iOS --no-profile < /dev/null
popd >/dev/null
wrapper_output_dir="$repo_root/flutter_sharp/build/wrapper_iOS"
rm -rf "$wrapper_output_dir"
echo "Restoring Flutter example dependencies"
pushd "$repo_root/flutter_sharp/example" >/dev/null
flutter pub get
echo "Building flutter_sharp wrapper frameworks"
flutter build ios-framework --output="$wrapper_output_dir" --no-debug < /dev/null
popd >/dev/null
copy_wrapper_frameworks() {
local source_configuration="$1"
local destination_configuration="$2"
local destination_dir="$repo_root/flutter_sharp/build/iOS/$destination_configuration"
local source_dir="$wrapper_output_dir/$source_configuration"
for framework in flutter_sharp; do
rm -rf "$destination_dir/$framework.xcframework"
cp -R "$source_dir/$framework.xcframework" "$destination_dir/$framework.xcframework"
done
}
validate_frameworks() {
local configuration="$1"
local framework_dir="$repo_root/flutter_sharp/build/iOS/$configuration"
for framework in flutter_sharp Flutter App; do
if [ ! -d "$framework_dir/$framework.xcframework" ]; then
echo "Missing iOS framework: $framework_dir/$framework.xcframework" >&2
exit 1
fi
done
}
copy_wrapper_frameworks Profile Debug
copy_wrapper_frameworks Release Release
validate_frameworks Debug
validate_frameworks Release
echo "Skipping Android AAR build from flutter_sharp/ (build flutter_module separately if needed)"
echo "Downloading Flutter embedding debug"
mkdir -p "$repo_root/flutter_sharp/build"
curl --fail --location --output "$repo_root/flutter_sharp/build/flutter_embedding_debug.jar" "$flutter_embedding_debug"
"$dotnet_command" build "$repo_root/src/Flutter.Bindings/Flutter.Bindings.csproj"