common/bin/compare.sh
changeset 25854 98ce0879ab4c
parent 23428 3c8a05bf4656
child 27595 cff167b3bfa2
child 27560 adc258b13e2c
--- a/common/bin/compare.sh	Sun Aug 10 19:38:50 2014 -0700
+++ b/common/bin/compare.sh	Sun Aug 17 15:51:37 2014 +0100
@@ -93,14 +93,16 @@
     fi
     # Ignore date strings in class files.
     # On Macosx the system sources for generated java classes produce different output on 
-    # consequtive invokations seemingly randomly.
+    # consequtive invocations seemingly randomly.
     # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
+    # Anonymous lambda classes get randomly assigned counters in their names.
     if test "x$SUFFIX" = "xclass"; then
         # To improve performance when large diffs are found, do a rough filtering of classes
         # elibeble for these exceptions
         if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
 	        -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
-	        -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
+	        -e thePoint -e aPoint -e setItemsPtr \
+                -e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
             $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
             $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
@@ -109,7 +111,8 @@
 		     -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
  	             -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
 	             -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
-	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
+	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d' \
+                     -e '/[<>].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d')
         fi
     fi
     if test "x$SUFFIX" = "xproperties"; then
@@ -122,7 +125,16 @@
 #            -e :a -e '/\\$/N; s/\\\n//; ta' \
 #  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
 #	    -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
-        TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
+        # Filter out date string differences.
+        TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE | \
+            $GREP '^[<>]' | \
+            $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
+    fi
+    if test "x$SUFFIX" = "xMF"; then
+        # Filter out date string differences.
+        TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
+            $GREP '^[<>]' | \
+            $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
     fi
     if test -n "$TMP"; then
         echo Files $OTHER_FILE and $THIS_FILE differ
@@ -145,7 +157,7 @@
     (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other)
     (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
 
-    $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff
+    $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff
     
     echo -n Directory structure...
     if [ -s $WORK_DIR/dirs_diff ]; then
@@ -251,8 +263,8 @@
     do
         if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
         if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
-        OF=`cd ${OTHER_DIR} && $FILE -h $f`
-        TF=`cd ${THIS_DIR} && $FILE -h $f`
+        OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
+        TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'`
         if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
         then
 	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
@@ -317,12 +329,14 @@
                                           -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
                                           -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
                                           -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
+                                          -e 's/^\(.*\)\( o'"'"'clock \)\([A-Z][A-Z][A-Z]\)/(removed)\2(removed)/' \
                     > $OTHER_FILE
                 $CAT $THIS_DIR/$f  | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
                                           -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
                                           -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
                                           -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
                                           -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
+                                          -e 's/^\(.*\)\( o'"'"'clock \)\([A-Z][A-Z][A-Z]\)/(removed)\2(removed)/' \
                     > $THIS_FILE
             else
                 OTHER_FILE=$OTHER_DIR/$f
@@ -510,7 +524,8 @@
     WORK_DIR=$3
 
     # TODO filter?
-    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER)
+    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
+        | $SORT | $FILTER)
 
     if [ -n "$ZIPS" ]; then
         echo Jar files...
@@ -538,9 +553,14 @@
     OTHER_DIR=$2
     WORK_DIR=$3
     BIN_FILE=$4
+    OTHER_BIN_FILE=$5
 
     THIS_FILE=$THIS_DIR/$BIN_FILE
-    OTHER_FILE=$OTHER_DIR/$BIN_FILE
+    if [ -n "$OTHER_BIN_FILE" ]; then
+        OTHER_FILE=$OTHER_DIR/$OTHER_BIN_FILE
+    else
+        OTHER_FILE=$OTHER_DIR/$BIN_FILE
+    fi
     NAME=$(basename $BIN_FILE)
     WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
     FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
@@ -970,6 +990,8 @@
     echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
     echo ""
     echo "-2zips <file1> <file2> Compare two zip files only"
+    echo "-2bins <file1> <file2> Compare two binary files only"
+    echo "-2dirs <dir1> <dir2> Compare two directories as if they were images"
     echo ""
     exit 10
 fi
@@ -1032,6 +1054,15 @@
         -execs)
             CMP_EXECS=true
             ;;
+        -2dirs)
+            THIS="$(cd "$2" && pwd )"
+            OTHER="$(cd "$3" && pwd )"
+            THIS_BASE_DIR="$THIS"
+            OTHER_BASE_DIR="$OTHER"
+            SKIP_DEFAULT=true
+            shift
+            shift
+            ;;
         -2zips)
             CMP_2_ZIPS=true
             THIS_FILE=$2
@@ -1039,6 +1070,13 @@
             shift
             shift
             ;;
+        -2bins)
+            CMP_2_BINS=true
+            THIS_FILE=$2
+            OTHER_FILE=$3
+            shift
+            shift
+            ;;
         *)
             CMP_NAMES=false
             CMP_PERMS=false
@@ -1069,6 +1107,18 @@
     exit
 fi
 
+if [ "$CMP_2_BINS" = "true" ]; then
+    THIS_DIR="$(dirname $THIS_FILE)"
+    THIS_DIR="$(cd "$THIS_DIR" && pwd )"
+    OTHER_DIR="$(dirname $OTHER_FILE)"
+    OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
+    THIS_FILE_NAME="$(basename $THIS_FILE)"
+    OTHER_FILE_NAME="$(basename $OTHER_FILE)"
+    echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
+    compare_bin_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2bins $THIS_FILE_NAME $OTHER_FILE_NAME
+    exit
+fi
+
 if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
     CMP_NAMES=true
     CMP_PERMS=true
@@ -1084,151 +1134,154 @@
     FILTER="$CAT"
 fi
 
-if [ -z "$OTHER" ]; then
-    OTHER="$THIS/../$LEGACY_BUILD_DIR"
-    if [ -d "$OTHER" ]; then
+if [ "$SKIP_DEFAULT" != "true" ]; then
+    if [ -z "$OTHER" ]; then
+        OTHER="$THIS/../$LEGACY_BUILD_DIR"
+        if [ -d "$OTHER" ]; then
+            OTHER="$( cd "$OTHER" && pwd )"
+        else
+            echo "Default old build directory does not exist:"
+            echo "$OTHER"
+            exit 1
+        fi
+        echo "Comparing to default old build:"
+        echo "$OTHER"
+        echo
+    else
+        if [ ! -d "$OTHER" ]; then
+            echo "Other build directory does not exist:"
+            echo "$OTHER"
+            exit 1
+        fi
         OTHER="$( cd "$OTHER" && pwd )"
-    else
-        echo "Default old build directory does not exist:"
+        echo "Comparing to:"
         echo "$OTHER"
-        exit 1
+        echo
     fi
-    echo "Comparing to default old build:"
-    echo "$OTHER"
-    echo
-else
-    if [ ! -d "$OTHER" ]; then
-        echo "Other build directory does not exist:"
-        echo "$OTHER"
-        exit 1
-    fi
-    OTHER="$( cd "$OTHER" && pwd )"
-    echo "Comparing to:"
-    echo "$OTHER"
-    echo
-fi
 
 
-# Figure out the layout of the this build. Which kinds of images have been produced
-if [ -d "$THIS/install/j2sdk-image" ]; then
-    THIS_J2SDK="$THIS/install/j2sdk-image"
-    THIS_J2RE="$THIS/install/j2re-image"
-    echo "Selecting install images in this build"
-elif [ -d "$THIS/deploy/j2sdk-image" ]; then
-    THIS_J2SDK="$THIS/deploy/j2sdk-image"
-    THIS_J2RE="$THIS/deploy/j2re-image"
-    echo "Selecting deploy images in this build"
-elif [ -d "$THIS/images/j2sdk-image" ]; then
-    THIS_J2SDK="$THIS/images/j2sdk-image"
-    THIS_J2RE="$THIS/images/j2re-image"
-    echo "Selecting jdk images in this build"
-fi
-
-if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
+    # Figure out the layout of the this build. Which kinds of images have been produced
     if [ -d "$THIS/install/j2sdk-image" ]; then
-        # If there is an install image, prefer that, it's also overlay
-        THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
-        THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
-        echo "Selecting install overlay images in this build"
-    else
-        THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
-        THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
-        echo "Selecting jdk overlay images in this build"
+        THIS_J2SDK="$THIS/install/j2sdk-image"
+        THIS_J2RE="$THIS/install/j2re-image"
+        echo "Selecting install images in this build"
+    elif [ -d "$THIS/deploy/j2sdk-image" ]; then
+        THIS_J2SDK="$THIS/deploy/j2sdk-image"
+        THIS_J2RE="$THIS/deploy/j2re-image"
+        echo "Selecting deploy images in this build"
+    elif [ -d "$THIS/images/j2sdk-image" ]; then
+        THIS_J2SDK="$THIS/images/j2sdk-image"
+        THIS_J2RE="$THIS/images/j2re-image"
+        echo "Selecting jdk images in this build"
     fi
-fi
 
-if [ -d "$THIS/images/j2sdk-bundle" ]; then
-    THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
-    THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
-    echo "Selecting bundles in this build"
-fi
+    if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
+        if [ -d "$THIS/install/j2sdk-image" ]; then
+            # If there is an install image, prefer that, it's also overlay
+            THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
+            THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
+            echo "Selecting install overlay images in this build"
+        else
+            THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
+            THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
+            echo "Selecting jdk overlay images in this build"
+        fi
+    fi
+
+    if [ -d "$THIS/images/j2sdk-bundle" ]; then
+        THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
+        THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
+        echo "Selecting bundles in this build"
+    fi
 
-# Figure out the layout of the other build (old or new, normal or overlay image)
-if [ -d "$OTHER/j2sdk-image" ]; then
-    if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
-        OTHER_J2SDK="$OTHER/j2sdk-image"
-        OTHER_J2RE="$OTHER/j2re-image"
-        echo "Selecting old-style images in other build"
-    else
-        OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
-        OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
-        echo "Selecting overlay images in other build"
+    # Figure out the layout of the other build (old or new, normal or overlay image)
+    if [ -d "$OTHER/j2sdk-image" ]; then
+        if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
+            OTHER_J2SDK="$OTHER/j2sdk-image"
+            OTHER_J2RE="$OTHER/j2re-image"
+            echo "Selecting old-style images in other build"
+        else
+            OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
+            OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
+            echo "Selecting overlay images in other build"
+        fi
+    elif [ -d "$OTHER/install/j2sdk-image" ]; then
+        OTHER_J2SDK="$OTHER/install/j2sdk-image"
+        OTHER_J2RE="$OTHER/install/j2re-image"
+        echo "Selecting install images in other build"
+    elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
+        OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
+        OTHER_J2RE="$OTHER/deploy/j2re-image"
+        echo "Selecting deploy images in other build"
+    elif [ -d "$OTHER/images/j2sdk-image" ]; then
+        OTHER_J2SDK="$OTHER/images/j2sdk-image"
+        OTHER_J2RE="$OTHER/images/j2re-image"
+        echo "Selecting jdk images in other build"
     fi
-elif [ -d "$OTHER/install/j2sdk-image" ]; then
-    OTHER_J2SDK="$OTHER/install/j2sdk-image"
-    OTHER_J2RE="$OTHER/install/j2re-image"
-    echo "Selecting install images in other build"
-elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
-    OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
-    OTHER_J2RE="$OTHER/deploy/j2re-image"
-    echo "Selecting deploy images in other build"
-elif [ -d "$OTHER/images/j2sdk-image" ]; then
-    OTHER_J2SDK="$OTHER/images/j2sdk-image"
-    OTHER_J2RE="$OTHER/images/j2re-image"
-    echo "Selecting jdk images in other build"
-fi
 
-if [ -d "$OTHER/j2sdk-bundle" ]; then
-    OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
-    OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
-    echo "Selecting bundles in other build"
-elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
-    OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
-    OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
-    echo "Selecting jdk bundles in other build"
-fi
+    if [ -d "$OTHER/j2sdk-bundle" ]; then
+        OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
+        OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
+        echo "Selecting bundles in other build"
+    elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
+        OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
+        OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
+        echo "Selecting jdk bundles in other build"
+    fi
+    
+    if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
+        if [ -z "$THIS_J2SDK_OVERLAY" ]; then
+            echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
+            exit 1
+        fi
+    fi
 
-if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
-    if [ -z "$THIS_J2SDK_OVERLAY" ]; then
-        echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
+    if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
+        echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
         exit 1
     fi
-fi
 
-if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
-    echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
-    exit 1
-fi
-
-if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
-    echo "WARNING! OTHER build has bundles built while this build does not."
-    echo "Skipping bundle compare!"
-fi
-
-if [ -d "$THIS/docs" ]; then
-    THIS_DOCS="$THIS/docs"
-fi
-
-if [ -d "$OTHER/docs" ]; then
-    OTHER_DOCS="$OTHER/docs"
-fi
+    if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
+        echo "WARNING! OTHER build has bundles built while this build does not."
+        echo "Skipping bundle compare!"
+    fi
 
-if [ -z "$THIS_DOCS" ]; then
-    echo "WARNING! Docs haven't been built and won't be compared."
-fi
-
-if [ -z "$OTHER_DOCS" ]; then
-    echo "WARNING! Other build doesn't contain docs, skipping doc compare."
-fi
+    if [ -d "$OTHER/images" ]; then
+        OTHER_SEC_DIR="$OTHER/images"
+    else
+        OTHER_SEC_DIR="$OTHER/tmp"
+    fi
+    OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
+    THIS_SEC_DIR="$THIS/images"
+    THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
+    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+        if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+            JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
+        else
+            JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
+        fi
+        OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
+        OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
+        THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
+        THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
+    fi
 
-if [ -d "$OTHER/images" ]; then
-    OTHER_SEC_DIR="$OTHER/images"
-else
-    OTHER_SEC_DIR="$OTHER/tmp"
-fi
-OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
-THIS_SEC_DIR="$THIS/images"
-THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
-if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-    if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
-        JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
-    else
-        JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
+    if [ -d "$THIS/docs" ]; then
+        THIS_DOCS="$THIS/docs"
+    fi
+
+    if [ -d "$OTHER/docs" ]; then
+        OTHER_DOCS="$OTHER/docs"
     fi
-    OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
-    OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
-    THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
-    THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
+
+    if [ -z "$THIS_DOCS" ]; then
+        echo "WARNING! Docs haven't been built and won't be compared."
+    fi
+
+    if [ -z "$OTHER_DOCS" ]; then
+        echo "WARNING! Other build doesn't contain docs, skipping doc compare."
+    fi
+
 fi
 
 ##########################################################################################
@@ -1274,6 +1327,10 @@
         echo -n "Docs "
         compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+        compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_PERMS" = "true" ]; then
@@ -1295,6 +1352,9 @@
         echo -n "J2RE  Bundle "
         compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_TYPES" = "true" ]; then
@@ -1316,6 +1376,9 @@
         echo -n "J2RE  Bundle "
         compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_GENERAL" = "true" ]; then
@@ -1341,6 +1404,9 @@
         echo -n "Docs "
         compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_ZIPS" = "true" ]; then
@@ -1365,12 +1431,18 @@
             compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN
         fi
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_JARS" = "true" ]; then
     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
         compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_LIBS" = "true" ]; then
@@ -1386,6 +1458,9 @@
         echo -n "Bundle   "
         compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 if [ "$CMP_EXECS" = "true" ]; then
@@ -1396,6 +1471,9 @@
         echo -n "Overlay "
         compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
     fi
+    if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
+        compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
+    fi
 fi
 
 echo