git pullした後にrebuildすることが多いんだけど、そのためにわざわざVSを起動するのが面倒。ということでコマンドでrebuildできたら楽なのでshell scriptを書いた。
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
#!/bin/sh | |
SLN_NAME="" | |
while getopts vVn OPT | |
do | |
case $OPT in | |
"v" | "V" ) VERBOSE="TRUE" | |
shift | |
;; | |
"n" ) NO_COLOR="TRUE" | |
shift | |
;; | |
esac | |
done | |
if [ "$#" -eq 0 ] ; then | |
DIR_PATH=`realpath .` | |
DIR_NAME=`basename $DIR_PATH` | |
SLN_NAME="$DIR_NAME"".sln" | |
else | |
SLN_NAME="$1" | |
fi | |
DEVENV="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/devenv.com" | |
console_printer () | |
{ | |
if [ "$VERBOSE" = "TRUE" ] ; then | |
nkf | |
else | |
nkf | grep '===' | sed \ | |
-e 's/=//g' \ | |
-e 's/^.*: /【/' \ | |
-e 's/、/】 【/g' \ | |
-e 's/ $/】/' ; | |
fi | |
} | |
coloring () | |
{ | |
if [ "$NO_COLOR" = "TRUE" ] ; then | |
cat - | |
else | |
sed \ | |
-e 's/正常終了/\x1b\[32;01;1m正常終了\x1b\[m/' \ | |
-e 's/失敗/\x1b\[31;01;1m失敗\x1b\[m/' \ | |
-e 's/スキップ/\x1b\[33;01;1mスキップ\x1b\[m/' \ | |
-e 's/更新不要/\x1b\[36;01;1m更新不要\x1b\[m/' ; | |
fi | |
} | |
echo -ne 'clean\t\t' | |
"$DEVENV" /clean release $SLN_NAME | console_printer | coloring | |
echo -ne 'rebuild\t\t' | |
"$DEVENV" /rebuild release $SLN_NAME | console_printer | coloring | |
echo -ne 'build\t\t' | |
"$DEVENV" /build release $SLN_NAME | console_printer | coloring | |
exit | |
if [ "$VERBOSE" = "TRUE" ] ; then | |
"$DEVENV" /clean release $SLN_NAME | nkf | |
"$DEVENV" /rebuild release $SLN_NAME | nkf | |
"$DEVENV" /build release $SLN_NAME | nkf | |
else | |
"$DEVENV" /clean release $SLN_NAME | nkf | egrep '(===|---)' | sed -e 's/========== //g' -e 's/: /\t【/g' -e 's/、/】 【/g' -e 's/$/】/g' -e 's/開始.*$/開始/g' | |
"$DEVENV" /rebuild release $SLN_NAME | nkf | egrep '(===|---)' | sed -e 's/========== //g' -e 's/: /\t【/g' -e 's/、/】 【/g' -e 's/$/】/g' -e 's/開始.*$/開始/g' | |
"$DEVENV" /build release $SLN_NAME | nkf | egrep '(===|---)' | sed -e 's/========== //g' -e 's/: /\t\t【/g' -e 's/、/】 【/g' -e 's/$/】/g' -e 's/開始.*$/開始/g' | |
fi |
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
#!/bin/sh | |
DEVENV_PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.com" | |
# get last argument | |
SLN_PATH=`eval echo '$'{$#}` | |
SLN_PATH_DOS=`cygpath -d "$SLN_PATH"` | |
"$DEVENV_PATH" ${@:1:`expr $# - 1`} "$SLN_PATH_DOS" | nkf |
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
% devenv /rebuild release ~/hoge.sln |
0 件のコメント:
コメントを投稿