-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·52 lines (39 loc) · 1.35 KB
/
build.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
#!/usr/bin/env bash
# Exit on error
set -e
# Customize the name as required
PROJECT_NAME="TaskMaster.xojo_project"
APP_NAME="TaskMaster.app"
XOJO_FULL_PATH="/Applications/Xojo_2016_Release_2_1/Xojo.app"
# The script will need the full path of this folder, so we'll store it
SCRIPT_PATH=`cd \`dirname $0\`; pwd`
IDE_SOCKET="/tmp/XojoIDE"
# Clean up the build results in case they exist
rm -rf "$APP_NAME" || true
# Launch Xojo / bring it to the front
osascript -e "launch application \"$XOJO_FULL_PATH\""
# Wait for the IDE socket to appear, which will
# indicate that the IDE is ready to receive commands
while : ; do
[[ -e "$IDE_SOCKET" ]] && break
echo "Waiting for the IDE to launch..."
sleep 1
done
# Create the build script that we'll send to the IDE
# We can use variable subsitution here to customize the script
BUILD_SCRIPT=$(cat <<EOF
OpenFile("/$SCRIPT_PATH/$PROJECT_NAME")\n
DoCommand "BuildApp"\n
QuitIDE(false)
EOF
)
# Send the script to the IDE's socket
# echo -e will echo the linefeeds ('\n') from the script above
# nc -U will 'netconnect' to a Unix Domain socket
echo -e $BUILD_SCRIPT | nc -U "$IDE_SOCKET"
echo "Building $APP_NAME from project $PROJECT_NAME"
# Since the script tells the IDE to Quit,
# wait until the process disappears
while pgrep Xojo > /dev/null; do sleep 1; done
echo "Completed build of $SCRIPT_PATH/$APP_NAME"
exit 0