This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for creating an app bundle for heap shot
- Loading branch information
1 parent
62d4d68
commit 6ac0498
Showing
6 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeIconFile</key> | ||
<string>heapshot.mlpd.icns</string> | ||
<key>CFBundleTypeExtensions</key> | ||
<array> | ||
<string>mlpd</string> | ||
</array> | ||
<key>CFBundleTypeName</key> | ||
<string>HeapShot Log File</string> | ||
<key>CFBundleTypeRole</key> | ||
<string>Viewer</string> | ||
<key>LSIsAppleDefaultForType</key> | ||
<true/> | ||
</dict> | ||
</array> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleExecutable</key> | ||
<string>heapshot</string> | ||
<key>CFBundleIconFile</key> | ||
<string>heapshot.icns</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.xamarin.heapshot</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>HeapShot</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>@BUNDLE_VERSION@</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>@BUNDLE_VERSION@</string> | ||
<key>NSAppleScriptEnabled</key> | ||
<string>NO</string> | ||
<key>QuartzGLEnable</key> | ||
<false/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
BUNDLE_VERSION=$(VERSION) | ||
MAC_APP_DIR=HeapShot.app | ||
MACOS=$(MAC_APP_DIR)/Contents/MacOS | ||
MAC_APP_LIB_DIR=$(MACOS)/lib/heapshot | ||
|
||
EXTRA_DIST = heapshot | ||
|
||
all: HeapShot.app | ||
|
||
HeapShot.app: | ||
@echo "Creating $@" | ||
@mkdir -p $(MAC_APP_DIR)/Contents/{MacOS,Resources} | ||
@mkdir -p $(MAC_APP_DIR)/Contents/MacOS/{lib,share} | ||
@mkdir -p $(MAC_APP_LIB_DIR) | ||
@mkdir -p $(MAC_APP_DIR)/Contents/MacOS/share/heapshot | ||
@cp -pR ../HeapShot.Gui/*.exe* $(MAC_APP_LIB_DIR) | ||
@cp -pR ../HeapShot.Gui.Widgets/*.dll* $(MAC_APP_LIB_DIR) | ||
@cp -pR ../HeapShot.Reader/*.dll* $(MAC_APP_LIB_DIR) | ||
@mkdir -p $(MAC_APP_DIR)/Contents/MacOS/share/heapshot | ||
@cp ../COPYING $(MAC_APP_DIR)/Contents/MacOS/share/heapshot/COPYING | ||
@sed -e "s/@BUNDLE_VERSION@/$(BUNDLE_VERSION)/g" Info.plist.in > $(MAC_APP_DIR)/Contents/Info.plist | ||
# cp ../../theme-icons/Mac/*.icns $(MAC_APP_DIR)/Contents/Resources/ | ||
@cp -p heapshot $(MACOS)/heapshot | ||
@touch HeapShot.app | ||
|
||
clean-local: | ||
rm -rf HeapShot.app | ||
|
||
.PHONY: HeapShot.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/sh | ||
|
||
#get the bundle's MacOS directory full path | ||
DIR=$(cd "$(dirname "$0")"; pwd) | ||
|
||
#change these values to match your app | ||
EXE_PATH="$DIR/lib/heapshot/HeapShot.Gui.exe" | ||
PROCESS_NAME=heapshot | ||
APPNAME="HeapShot" | ||
|
||
#set up environment | ||
MONO_FRAMEWORK_PATH=/Library/Frameworks/Mono.framework/Versions/Current | ||
export DYLD_FALLBACK_LIBRARY_PATH="$DIR:$MONO_FRAMEWORK_PATH/lib:/lib:/usr/lib" | ||
export PATH="$MONO_FRAMEWORK_PATH/bin:$PATH" | ||
|
||
#mono version check | ||
REQUIRED_MAJOR=2 | ||
REQUIRED_MINOR=4 | ||
|
||
VERSION_TITLE="Cannot launch $APPNAME" | ||
VERSION_MSG="$APPNAME requires the Mono Framework version $REQUIRED_MAJOR.$REQUIRED_MINOR or later." | ||
DOWNLOAD_URL="http://www.go-mono.com/mono-downloads/download.html" | ||
|
||
MONO_VERSION="$(mono --version | grep 'Mono JIT compiler version ' | cut -f5 -d\ )" | ||
MONO_VERSION_MAJOR="$(echo $MONO_VERSION | cut -f1 -d.)" | ||
MONO_VERSION_MINOR="$(echo $MONO_VERSION | cut -f2 -d.)" | ||
if [ -z "$MONO_VERSION" ] \ | ||
|| [ $MONO_VERSION_MAJOR -lt $REQUIRED_MAJOR ] \ | ||
|| [ $MONO_VERSION_MAJOR -eq $REQUIRED_MAJOR -a $MONO_VERSION_MINOR -lt $REQUIRED_MINOR ] | ||
then | ||
osascript \ | ||
-e "set question to display dialog \"$VERSION_MSG\" with title \"$VERSION_TITLE\" buttons {\"Cancel\", \"Download...\"} default button 2" \ | ||
-e "if button returned of question is equal to \"Download...\" then open location \"$DOWNLOAD_URL\"" | ||
echo "$VERSION_TITLE" | ||
echo "$VERSION_MSG" | ||
exit 1 | ||
fi | ||
|
||
#get an exec command that will work on the current OS version | ||
OSX_VERSION=$(uname -r | cut -f1 -d.) | ||
if [ $OSX_VERSION -lt 9 ]; then # If OSX version is 10.4 | ||
MONO_EXEC="exec mono" | ||
else | ||
MONO_EXEC="exec -a \"$PROCESS_NAME\" mono" | ||
fi | ||
|
||
#create log file directory if it doesn't exist | ||
LOG_DIR="$HOME/Library/Logs/$APPNAME" | ||
LOG_FILE="$LOG_DIR/$APPNAME.log" | ||
mkdir -p "$LOG_DIR" | ||
|
||
#run app using mono | ||
$MONO_EXEC $MONO_OPTIONS "$EXE_PATH" $* 2>&1 1> "$LOG_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters