This repository has been archived by the owner on Apr 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathhammer-build
executable file
·75 lines (63 loc) · 3.11 KB
/
hammer-build
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
73
74
#! /bin/bash
# This is the script I use to build interim release builds of Hammerspoon
#
# You'll probably want to adjust the paths somewhat as these are for my layout.
#
# invoke this script with no arguments to just build Hammerspoon
# invoke this script with a single argument that starts with "doc" (e.g. documentation, docs, doc, etc.) to just build the latest versions of the documentation.
# invoke it with any other single argument to build both Hammerspoon and the documentation.
#
# This script uses a self-signed certificate so that debug builds do not require you to have to set Accessibility each time you rebuild the app. You can find more information about this at:
# https://github.com/Hammerspoon/hammerspoon/blob/a62c879bdbfc6646aebba1f943fe32fee817fbfd/CONTRIBUTING.md and http://bd808.com/blog/2013/10/21/creating-a-self-signed-code-certificate-for-xcode/
cd /opt/amagill/src/hammerspoon/hammerspoon
GITBRANCH=$(git symbolic-ref --short -q HEAD)-$(git log -1 --format="%h")
if [[ $1 != doc* ]]; then
make clean
make || exit
echo $GITBRANCH > build/Hammerspoon.app/Contents/Resources/gitbranch
xattr -cr "build/Hammerspoon.app" # codesign has become more anal in 10.12
# signing with self-signed cert so I no longer have to reset accessibility all the time
codesign --verbose --sign "Datalore Code Signing" "build/Hammerspoon.app/Contents/Frameworks/LuaSkin.framework/Versions/A"
codesign --verbose --sign "Datalore Code Signing" "build/Hammerspoon.app"
rm -fr `xcodebuild -workspace Hammerspoon.xcworkspace -scheme Hammerspoon -configuration DEBUG -showBuildSettings | sort | uniq | grep " BUILT_PRODUCTS_DIR =" | awk '{ print $3 }'`/Hammerspoon.app
fi
if [ $1 ]; then
make docs
# make build/html/LuaSkin
# hack because headerdoc2html doesn't seem to recognise @code/@endcode and @remark anymore
# classDir=build/html/LuaSkin
# sed -e 's/@code/<pre>@textblock/' \
# -e 's/@endcode/@\/textblock<\/pre>/' \
# -e 's/@remark/@attributeblock Notes/' LuaSkin/LuaSkin/Skin.h > Skin.h
# headerdoc2html -u -o ${classDir} Skin.h
# resolveLinks ${classDir}
# mv ${classDir}/Skin_h/* ${classDir}
# rmdir ${classDir}/Skin_h
# rm Skin.h
rm -fr ~/Documents/Hammerspoon
mkdir ~/Documents/Hammerspoon
mv build/Hammerspoon.docset ~/Documents/Hammerspoon/
# mv build/html/LuaSkin ~/Documents/Hammerspoon/
/usr/local/bin/appledoc \
--project-name "LuaSkin" \
--project-company "Hammerspoon" \
--company-id "org.hammerspoon" \
--output "build/LSDocs" \
--clean-output \
--no-install-docset \
--no-publish-docset \
--logformat xcode \
--keep-undocumented-objects \
--keep-undocumented-members \
--keep-intermediate-files \
--ignore "*.m" \
LuaSkin/LuaSkin
mv build/LSDocs/html ~/Documents/Hammerspoon/LuaSkin
fi
if [[ $1 != doc* ]]; then
osascript -e 'tell Application "Hammerspoon" to quit'
sleep 1
rm -fr /Applications/_ASM_/Developer/Hammerspoon.app
mv build/Hammerspoon.app /Applications/_ASM_/Developer/
open -a /Applications/_ASM_/Developer/Hammerspoon.app
fi