summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJanek Bogucki <janekdb@gmail.com>2015-09-23 21:58:15 +0100
committerJanek Bogucki <janekdb@gmail.com>2015-09-30 22:01:31 +0100
commitceebe88cb73ce252e68d7d379fa5c90e15831753 (patch)
tree70867520a17326f62c260453347bcc11fff47a4d /tools
parentdb95f868d9370a64df3b76a035d1731d55db666e (diff)
downloadscala-ceebe88cb73ce252e68d7d379fa5c90e15831753.tar.gz
scala-ceebe88cb73ce252e68d7d379fa5c90e15831753.tar.bz2
scala-ceebe88cb73ce252e68d7d379fa5c90e15831753.zip
Script to compare the current scaladoc with the parent commit's doc
Diffstat (limited to 'tools')
-rwxr-xr-xtools/scaladoc-diff71
1 files changed, 71 insertions, 0 deletions
diff --git a/tools/scaladoc-diff b/tools/scaladoc-diff
new file mode 100755
index 0000000000..64dc025ecd
--- /dev/null
+++ b/tools/scaladoc-diff
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+#
+# Script to compare the scaladoc of the current commit with the scaladoc
+# of the parent commit. No arguments.
+#
+
+
+oldsha=$(git log -1 --format="%H" HEAD^)
+oldsha=${oldsha#g}
+oldsha=${oldsha:0:10}
+
+sha=`sh tools/get-scala-commit-sha`
+echo "parent commit sha: $oldsha. current commit sha: $sha"
+
+# create scaladoc for parent commit if not done already
+if [ ! -f "build/scaladoc-output-$oldsha.txt" ]
+then
+ echo "making scaladoc for parent commit ($oldsha)"
+ git checkout HEAD^
+ ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$oldsha.txt
+ cp -r build/scaladoc/ build/scaladoc-${oldsha}
+ git checkout $sha
+fi
+
+# create scaladoc for current commit
+echo "making scaladoc for current commit ($sha)"
+ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$sha.txt
+cp -r build/scaladoc/ build/scaladoc-${sha}
+echo "opendiff build/scaladoc-output-$oldsha.txt build/scaladoc-output-$sha.txt"
+opendiff build/scaladoc-output-$oldsha.txt build/scaladoc-output-$sha.txt
+
+echo "Comparing files..."
+
+difffile=build/scaladoc-diff-${sha}-$oldsha.txt
+sh tools/scaladoc-compare build/scaladoc-${sha}/ build/scaladoc-$oldsha/ &> $difffile
+open $difffile &
+
+# Adapted from tools/scaladoc-compare
+echo "Comparing versions with difftool: build/scaladoc-${sha}/ build/scaladoc-$oldsha/"
+NEW_PATH=build/scaladoc-${sha}/
+OLD_PATH=build/scaladoc-$oldsha/
+
+FILES=`find $NEW_PATH -name '*.html.raw'`
+if [ "$FILES" == "" ]
+then
+ echo "No .html.raw files found in $NEW_PATH!"
+ exit 1
+fi
+
+for NEW_FILE in $FILES
+do
+ OLD_FILE=${NEW_FILE/$NEW_PATH/$OLD_PATH}
+ if [ -f $OLD_FILE ]
+ then
+ DIFF=`diff -q -w $NEW_FILE $OLD_FILE 2>&1`
+ if [ "$DIFF" != "" ]
+ then
+ opendiff $OLD_FILE $NEW_FILE > /dev/null
+ echo "next [y\N]? "
+ read -n 1 -s input
+
+ if [ "$input" == "N" ]
+ then exit 0
+ fi
+ fi
+ else
+ echo -e "$NEW_FILE: No corresponding file (expecting $OLD_FILE)\n\n"
+ fi
+done
+
+echo "Done."