generated from gitpod-samples/template-x11-vnc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInitializeFlutter.bash
executable file
·84 lines (67 loc) · 2.2 KB
/
InitializeFlutter.bash
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
#!/bin/bash
source ./ensure_homebrew.bash
source ./update_zprofile.bash
source ./setup_sdkmanager.bash
user_version=${1:-master}
fvm spawn "$user_version" create my_app
cd my_app
# Check if the OS is Ubuntu
os=$(uname -s | tr '[:upper:]' '[:lower:]')
if [[ "$os" == "linux" && -f /etc/lsb-release ]]; then
. /etc/lsb-release
if [[ "$DISTRIB_ID" == "Ubuntu" ]]; then
sudo apt update
sudo apt install -y \
clang cmake git \
ninja-build pkg-config \
libgtk-3-dev liblzma-dev \
libstdc++-12-dev
fvm spawn "$user_version" build linux
fi
fi
# Check if the OS is macOS
if [[ "$os" == "darwin" ]]; then
processor=$(uname -m)
# Install Rosetta if the processor is Apple M1 and Rosetta is not already installed
if [[ "$processor" == "arm64" ]]; then
if /usr/sbin/softwareupdate --install-rosetta --agree-to-license > /dev/null 2>&1; then
echo "Rosetta is already installed."
else
echo "Installing Rosetta..."
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi
fi
ensure_homebrew
# Install Xcode from Apple's official source if it's not installed
if ! xcode-select -p &>/dev/null; then
echo "Xcode is not installed. Installing Xcode from Apple's official source..."
open -a "App Store" || open -a "Software Update"
sudo xcodebuild -license accept
fi
# Install CocoaPods if it's not installed
if ! command -v pod &>/dev/null; then
echo "CocoaPods is not installed. Installing CocoaPods..."
brew install cocoapods
fi
fvm spawn "$user_version" build macos
# Setup sdkmanager
setup_sdkmanager
# Source the .zprofile to apply changes
if [ -f ~/.zprofile ]; then
source ~/.zprofile
elif [ -f ~/.zshrc ]; then
source ~/.zshrc
fi
fi
# Run the build commands
fvm spawn "$user_version" build bundle
fvm spawn "$user_version" build apk
fvm spawn "$user_version" build appbundle
fvm spawn "$user_version" build web
cd ..
rm -rf my_app
fvm spawn "$user_version" create my_module --template=module
cd my_module
fvm spawn "$user_version" build aar
cd ..
rm -rf my_module