File tree Expand file tree Collapse file tree 2 files changed +76
-21
lines changed Expand file tree Collapse file tree 2 files changed +76
-21
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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)
3321fi
@@ -40,6 +28,14 @@ echo "Creating plugins directory"
4028mkdir -p $plugins_dir
4129cp -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# ##################
5551 # code if not found
5652 echo $lldb_config >> ~ /.lldbinit-Xcode
5753 echo $lldb_format >> ~ /.lldbinit-Xcode
58- fi
59-
54+ fi
You can’t perform that action at this time.
0 commit comments