Skip to content

Instantly share code, notes, and snippets.

@mhutch
Created June 22, 2016 18:02
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 mhutch/e9d3a277749e3c36224f8f43136f81b7 to your computer and use it in GitHub Desktop.
Save mhutch/e9d3a277749e3c36224f8f43136f81b7 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ "x$1" = 'x-clean' ]; then
rm -rf dlls packages ref report* nuget.exe
fi
#MONO_ASM_DIR=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5
MONO_ASM_DIR=../mono/mcs/class/lib/net_4_x
# need at least NuGet 3, Mono 4.1 ships 2.8.4
if [ ! -e nuget.exe ]; then
wget https://dist.nuget.org/win-x86-commandline/latest/nuget.exe || exit 1
fi
# for some reason Mono doesn't even build mono-api-html or mono-api-diff
# but ships mono-api-info
APIDIFF_PROJ=../mono/mcs/tools/mono-api-html/mono-api-html.csproj
if [ ! -e $APIDIFF_PROJ ]; then
echo "need ../mono checked out"
exit 1
fi
xbuild ../mono/mcs/tools/mono-api-html/mono-api-html.csproj || exit 1
APIDIFF=../mono/mcs/tools/mono-api-html/bin/Debug/mono-api-html.exe
# we need a patched mono-api-info anyway
xbuild ../mono/mcs/tools/corcompare/mono-api-info.csproj || exit 1
APIINFO=../mono/mcs/tools/corcompare/bin/Debug/mono-api-info.exe
# don't bother with
echo '{
"dependencies": {
"NETStandard.Library": "1.6.0",
},
"frameworks": {
"netstandard1.5": {}
}
}' > project.json
mono nuget.exe restore project.json -PackagesDirectory packages || exit 1
# copy all the reference dlls to a single directory so
# cecil can resolve references
mkdir -p dlls
for VERSION in "1.0" "1.1" "1.2" "1.3" "1.4" "1.5" "1.6"; do
for DLL in `find ./packages | grep "ref/netstandard$VERSION/[^/]*.dll"`; do
cp $DLL dlls
done
done
mkdir -p ref
for DLL in dlls/*; do
mono $APIINFO -f $DLL > ref/`basename $DLL .dll`.xml || exit 1
done
echo "<html>" > report.html
rm -f log.txt
mkdir -p info
for DLL in dlls/*; do
NAME=`basename $DLL .dll`
DLL=$MONO_ASM_DIR/Facades/$NAME.dll
if [ ! -e $DLL ]; then
DLL=$MONO_ASM_DIR/$NAME.dll
fi
if [ ! -e $DLL ]; then
echo "MISSING: $DLL"
echo "<h1>$NAME.dll</h1><h2 style='color: red'>Missing</h2>" >> report.html
else
XMLNAME=`basename $DLL .dll`.xml
mono $APIINFO -f -d $MONO_ASM_DIR $DLL > info/$XMLNAME || exit 1
mono $APIDIFF -r '.*' info/$XMLNAME ref/$XMLNAME report_$NAME.html >> log.txt || exit 1
if [ -e report_$NAME.html ]; then
cat report_$NAME.html >> report.html
rm report_$NAME.html
else
echo "<h1>$NAME.dll</h1><h2>Unchanged</h2>" >> report.html
fi
fi
done
echo "</html>" >> report.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment