forked from Catrobat/Paintroid-Flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_sdk.sh
executable file
·72 lines (56 loc) · 2.17 KB
/
setup_sdk.sh
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
#!/bin/bash
MELOS_CONFIG="melos.yaml"
MAKEFILE="Makefile"
# Try running 'fvm flutter pub get' to check if FVM is properly configured
if fvm flutter pub get; then
echo "FVM Flutter SDK is properly configured."
# Use sed to set the sdkPath to '.fvm/flutter_sdk' in melos.yaml
sed -i.bak 's|sdkPath: .*|sdkPath: .fvm/flutter_sdk|' "$MELOS_CONFIG" && rm "${MELOS_CONFIG}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully set sdkPath to .fvm/flutter_sdk in melos.yaml."
else
echo " -> Failed to set sdkPath in melos.yaml."
exit 1
fi
# Use sed to set the FLUTTER variable to 'fvm flutter' in Makefile
sed -i.bak 's|FLUTTER := .*|FLUTTER := fvm flutter|' "$MAKEFILE" && rm "${MAKEFILE}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully set FLUTTER to 'fvm flutter' in Makefile."
else
echo " -> Failed to set FLUTTER in Makefile."
exit 1
fi
sed -i.bak 's|DART := .*|DART := fvm dart|' "$MAKEFILE" && rm "${MAKEFILE}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully set DART to 'fvm dart' in Makefile."
else
echo " -> Failed to set DART in Makefile."
exit 1
fi
else
echo "FVM Flutter SDK not properly configured."
# Use sed to replace the sdkPath with 'auto' in melos.yaml
sed -i.bak 's|sdkPath: .*|sdkPath: auto|' "$MELOS_CONFIG" && rm "${MELOS_CONFIG}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully updated sdkPath to auto in melos.yaml."
else
echo " -> Failed to update sdkPath in melos.yaml."
exit 1
fi
# Use sed to replace the FLUTTER with 'flutter' in Makefile
sed -i.bak 's|FLUTTER := .*|FLUTTER := flutter|' "$MAKEFILE" && rm "${MAKEFILE}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully updated FLUTTER to 'flutter' in Makefile."
else
echo " -> Failed to update FLUTTER in Makefile."
exit 1
fi
sed -i.bak 's|DART := .*|DART := dart|' "$MAKEFILE" && rm "${MAKEFILE}.bak"
if [ $? -eq 0 ]; then
echo " -> Successfully updated DART to 'dart' in Makefile."
else
echo " -> Failed to update DART in Makefile."
exit 1
fi
flutter pub get
fi