Skip to content

Instantly share code, notes, and snippets.

@chkn
Created April 15, 2012 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chkn/2390344 to your computer and use it in GitHub Desktop.
Save chkn/2390344 to your computer and use it in GitHub Desktop.
Enable IL instrumentation in MonoTouch
#!/bin/bash -e
# This mtouch wrapper adds an argument for a "postcompile" command to be run
# after the managed code is compiled to IL but before it is compiled to native code.
#
# It may be passed as "Additional mtouch arguments" in MD like so:
#
# -postcompile "mono ${SolutionDir}/postcompiler.exe ${TargetPath}"
#
# To use, rename mtouch to mtouch_real and put this script in its place.
# Cheers!
declare -a ARGS
LAST=""
POSTCOMPILE=""
j=0
for i in "$@"; do
if [ "x$LAST" = "x-postcompile" ]; then
POSTCOMPILE="$i"
elif [ "x$i" != "x-postcompile" ]; then
ARGS[$j]="$i"
let j+=1
fi
LAST="$i"
done
echo $POSTCOMPILE
$POSTCOMPILE
exec $(dirname $0)/mtouch_real "${ARGS[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment