Skip to content

Commit 2bc521b

Browse files
ignore emulator script in lint checks
1 parent 34c4f48 commit 2bc521b

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

.trunk/trunk.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ lint:
4141
- linters: [ALL]
4242
paths:
4343
- gradlew
44+
- scripts/install-start-emulator.sh
4445
actions:
4546
enabled:
4647
- trunk-announce

scripts/install-start-emulator.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515

1616
# If there is an emulator already started, just use that one
1717

18-
echo "run: started=$(adb get-state 1 || true)"
19-
started=$(adb get-state 1 || true)
20-
if [[ ${started} == "device" ]]; then
21-
exit 0
18+
echo "run: started=$(adb get-state 1)"
19+
started=$(adb get-state 1)
20+
if [ "$started" = "device" ]; then
21+
exit 0
2222
fi
2323

2424
# Set PATH variable so we can find sdkmanager and avdmanager
2525
echo "Setting Path (emulator before tools hack)"
26-
export ANDROID_SDK="${HOME}/Library/Android/sdk"
27-
export PATH="${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools/:${ANDROID_HOME}/tools/bin:${PATH}"
26+
export ANDROID_SDK=$HOME/Library/Android/sdk
27+
export PATH=$ANDROID_SDK/emulator:$ANDROID_SDK/tools/:$ANDROID_HOME/tools/bin:$PATH
2828
#echo "run: sdkmanager tools"
2929
#sdkmanager tools
3030
#echo "run: kill-server"
@@ -37,34 +37,34 @@ export PATH="${ANDROID_SDK}/emulator:${ANDROID_SDK}/tools/:${ANDROID_HOME}/tools
3737
#echo "run: adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done &"
3838
#adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done &
3939
echo "starting emulator"
40-
echo 'run: echo yes | sdkmanager --install "system-images;android-28;default;x86"'
40+
echo "run: echo yes | sdkmanager --install \"system-images;android-28;default;x86\""
4141
echo yes | sdkmanager --install "system-images;android-29;default;x86"
4242

4343
# create new Emulator
44-
echo 'run: echo no | avdmanager create avd --force -n test -k "system-images;android-29;default;x86" -c 10M'
44+
echo "run: echo no | avdmanager create avd --force -n test -k \"system-images;android-29;default;x86\" -c 10M"
4545
echo no | avdmanager create avd --force -n test -k "system-images;android-29;default;x86" -c 10M
4646

4747
# sanity check, make sure new Emulator was created
4848
echo "run: emulator -list-avds"
4949
emulator -list-avds
5050

5151
# start Emulator (not sure if we actually have to run this as sudo or not
52-
echo "run: sudo -E sudo -u ${USER} -E bash -c \"./emulator -avd test -verbose -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &\""
53-
sudo -E sudo -u "${USER}" -E bash -c "${ANDROID_HOME}/emulator/emulator -avd test -verbose -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &"
52+
echo "run: sudo -E sudo -u $USER -E bash -c \"./emulator -avd test -verbose -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &\""
53+
sudo -E sudo -u "$USER" -E bash -c "${ANDROID_HOME}/emulator/emulator -avd test -verbose -no-snapshot -no-window -camera-back none -camera-front none -selinux permissive -qemu -m 2048 &"
5454

5555
echo "run: adb shell input keyevent 82 &"
5656
adb shell input keyevent 82 &
5757

5858
#block until emulator is ready to run tests
5959
echo "Waiting for Emulator to start"
60-
until [[ ${bootanim} =~ "stopped" ]]; do
61-
echo "run: adb reconnect offline"
62-
adb reconnect offline
63-
adb devices
64-
bootanim="$(adb -e shell getprop init.svc.bootanim 2>&1)"
65-
echo "Waiting for emulator, status is: ${bootanim}"
66-
sleep 1
67-
echo
60+
until [[ "$bootanim" =~ "stopped" ]]; do
61+
echo "run: adb reconnect offline"
62+
adb reconnect offline
63+
adb devices
64+
bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
65+
echo "Waiting for emulator, status is: $bootanim"
66+
sleep 1
67+
echo
6868
done
6969

7070
echo "Emulator has started - dismissing keyboard and sleeping for 1 second."

0 commit comments

Comments
 (0)