Last active
January 24, 2019 14:48
-
-
Save isao/d871a5b90e3505cc4151 to your computer and use it in GitHub Desktop.
From a Mac, tell VMWare to run MSBuild in the Mac's current working directory. Any arguments will be passed through to MSBuild. Usage: `cd path/to/web.sln && msbuild-here.sh [args]`
This file contains hidden or 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 -eu | |
# | |
# This script runs MSBuild in a VMWare image from a Mac. It translates the Mac's | |
# current working directory to the corresponding Windows VM path to a shared | |
# directory. Any arguments to this script will be passed through to MSBuild. | |
# | |
# Usage: cd path/to/web.sln && msbuild-here.sh [args] | |
# | |
# https://gist.github.com/isao/d871a5b90e3505cc4151 | |
# | |
# configs - customize these | |
# | |
# mac path to vm's .vmx | |
BLDVMX=~/Documents/VMs/ReachWin8.vmwarevm/ReachWin8.vmx | |
# VMWare login credentials | |
VMUSER=northamerica\\b-isaoy | |
VMPASS=$(security find-internet-password -ws tfsmr) | |
# osx path to vmware shared directory | |
MACBASE=$HOME/work | |
# windows path to vmware shared directory | |
WINBASE=Z:/work | |
# calcs # | |
# get windows path to cwd's web.sln file by | |
# - replacing the mac's path prefix with the windows' path prefix | |
# - adding "web.sln" | |
macdir=$(pwd -P) | |
windir="${macdir/$MACBASE/$WINBASE}" | |
# windows build command path and args | |
# /ds = /detailedsummary | |
# /m = /maxcpucount | |
# /noconlog = /noconsoleloggger | |
# /p = /property | |
# /v = /verbosity quiet, minimal, normal, detailed, diagnostic | |
# /flp = /fileLoggerParams | |
LOGFILE='msbuild.log' | |
BLDEXE='C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\MSBuild.exe' | |
BLDARGS="/p:Configuration=Debug-Reach /flp:LogFile=$WINBASE/$LOGFILE;Encoding=UTF-8 /m /ds /noconlog /v:normal" | |
BLDPROJ='web.csproj' | |
# | |
# main | |
# | |
[[ -e "$macdir/$BLDPROJ" ]] || { | |
echo "Error: can't find '$macdir/$BLDPROJ'" | |
echo "Rerun this script from the directory containing the '$BLDPROJ'." | |
exit 1 | |
} | |
which vmrun > /dev/null || { | |
echo 'Error: "vmrun" not found.' | |
exit 3 | |
} | |
echo "* building..." | |
echo " logging to: $MACBASE/$LOGFILE" | |
time vmrun \ | |
-T fusion \ | |
-gu $VMUSER \ | |
-gp $VMPASS \ | |
runProgramInGuest "$BLDVMX" -activeWindow -interactive \ | |
"$BLDEXE" $BLDARGS $@ "$windir/$BLDPROJ" | |
echo "* cleaning" | |
#git clean -dfX scripts/ bin/ obj/ > /dev/null | |
echo "* done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment