Skip to content

Commit 4bbe087

Browse files
author
Ben Whitley
committed
setup script renamed; new setup script for all versions of xcode but 11
1 parent 6b75f5d commit 4bbe087

File tree

2 files changed

+76
-21
lines changed

2 files changed

+76
-21
lines changed

setup-xcode11.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
set -o xtrace
4+
5+
###################
6+
# DEFINITIONS
7+
###################
8+
9+
service='Xcode'
10+
plugins_dir=~/Library/Developer/Xcode/Plug-ins/
11+
12+
###################
13+
# SHUT DOWN XCODE IF IT'S RUNNING
14+
###################
15+
16+
if pgrep -xq -- "${service}"; then
17+
echo "Xcode is running. Attempt to shut down? y/n"
18+
read answer
19+
if [ "$answer" = "y" ]; then
20+
echo "Shutting down Xcode"
21+
pkill -x $service
22+
else
23+
echo "Xcode needs to be closed"
24+
exit 1
25+
fi
26+
fi
27+
28+
###################
29+
# DELETE EXISTING PLUG-IN
30+
###################
31+
32+
if [ -d "${plugins_dir}Kotlin.ideplugin/" ]; then
33+
echo "Plugins directory and Kotlin plugin found..."
34+
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-$(xcodebuild -version | grep Xcode | cut -d ' ' -f 2)
35+
fi
36+
37+
###################
38+
# CREATE PLUG-IN
39+
###################
40+
41+
echo "Creating plugins directory"
42+
mkdir -p $plugins_dir
43+
cp -r Kotlin.ideplugin $plugins_dir
44+
45+
###################
46+
# LLDB DEFINITIONS
47+
###################
48+
49+
lldb_config="command script import ~/Library/Developer/Xcode/Plug-ins/Kotlin.ideplugin/Contents/Resources/konan_lldb_config.py"
50+
lldb_format="command script import ~/Library/Developer/Xcode/Plug-ins/Kotlin.ideplugin/Contents/Resources/konan_lldb.py"
51+
52+
if grep --quiet -s konan_lldb ~/.lldbinit-Xcode
53+
then
54+
# code if found
55+
echo "konan_lldb.py found in ~/.lldbinit-Xcode"
56+
else
57+
# code if not found
58+
echo $lldb_config >> ~/.lldbinit-Xcode
59+
echo $lldb_format >> ~/.lldbinit-Xcode
60+
fi

setup.sh

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
#!/usr/bin/env bash
22

3-
###################
4-
# DEFINITIONS
5-
###################
3+
# Use this script for versions of Xcode other than Xcode 11.
64

7-
service='Xcode'
8-
plugins_dir=~/Library/Developer/Xcode/Plug-ins/
5+
set -o xtrace
96

107
###################
11-
# SHUT DOWN XCODE IF IT'S RUNNING
8+
# DEFINITIONS
129
###################
1310

14-
if pgrep -xq -- "${service}"; then
15-
echo "Xcode is running. Attempt to shut down? y/n"
16-
read answer
17-
if [ "$answer" = "y" ]; then
18-
echo "Shutting down Xcode"
19-
pkill -x $service
20-
else
21-
echo "Xcode needs to be closed"
22-
exit 1
23-
fi
24-
fi
11+
plugins_dir=~/Library/Developer/Xcode/Plug-ins
12+
spec_dir=~/Library/Developer/Xcode/Specifications
2513

2614
###################
27-
# DELETE EXISTING PLUG-IN
15+
# FORGET EXISTING PLUG-IN
2816
###################
2917

30-
if [ -d "${plugins_dir}Kotlin.ideplugin/" ]; then
18+
if [ ! -d "$plugins_dir/Kotlin.ideplugin/" ]; then
3119
echo "Plugins directory and Kotlin plugin found..."
3220
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-$(xcodebuild -version | grep Xcode | cut -d ' ' -f 2)
3321
fi
@@ -40,6 +28,14 @@ echo "Creating plugins directory"
4028
mkdir -p $plugins_dir
4129
cp -r Kotlin.ideplugin $plugins_dir
4230

31+
###################
32+
# CREATE SPECS DIR
33+
###################
34+
35+
if [ ! -d "$spec_dir" ]; then
36+
mkdir $spec_dir
37+
fi
38+
4339
###################
4440
# LLDB DEFINITIONS
4541
###################
@@ -55,5 +51,4 @@ else
5551
# code if not found
5652
echo $lldb_config >> ~/.lldbinit-Xcode
5753
echo $lldb_format >> ~/.lldbinit-Xcode
58-
fi
59-
54+
fi

0 commit comments

Comments
 (0)