view tools/scripts/compareBuilds @ 10914:f29f3fbe6810

8198329: Support FX build / test using JDK that doesn't include javafx.* modules Reviewed-by: prr, jvos, aghaisas
author kcr
date Fri, 27 Apr 2018 05:19:35 -0700
parents aca37cf99592
children
line wrap: on
line source
#!/bin/bash
#
# a simple script to compare the file output of two builds.
#
# usage: compareBuilds full_path_to_top_one full_path_to_top_two

# TODO KCR: update this to also compare standalone sdk

one="$1"
two="$2"

if [ "$one" = '.' ]
then
    one="$PWD"
fi
if [ -d "$one/rt" ]
then
    one="$one/rt"
fi

if [ "$two" = '.' ]
then
    two="$PWD"
fi
if [ -d "$two/rt" ]
then
    two="$two/rt"
fi

echo "Comparing:"
echo "    one: $one"
echo "    two: $two"

if [ ! -d "$one/../rt" -o ! -d "$two/../rt" ]
then
  echo "error: $0 repo_one repo_two"
  exit 0
fi

CYGPATH=''
platform=''
case "`uname`" in
    Darwin*) 
        platform='mac'
        ;;
    CYGWIN*) 
        platform='cygwin'
        CYGPATH="cygpath -m"
        ;;
    Linux*)  
        platform='linux'
        ;;
esac

doCygpath() {
    if [ "${CYGPATH}" ]
    then
        eval ${CYGPATH} "${1}"
    else
        echo "${1}"
    fi
}

echo "Comparing rt/build files:"
(cd "$one";
 find build -type f | sort > /tmp/build-files-one
) 

(cd "$two";
 find build -type f | sort > /tmp/build-files-two
) 

comm -13 /tmp/build-files-one /tmp/build-files-two | while read f
do
    echo "    new: ${f}"
done

comm -23 /tmp/build-files-one /tmp/build-files-two | while read f
do
    echo "    missing: ${f}"
done


#########################################################

(cd "$one";
 find build/modular-sdk/modules_libs -name '*.jar') | while read i
do
    if [ -f "${one}/$i" -a -f "${two}/$i" ]
    then
        jar=${i##*/}
        jar=${jar%.jar}
        echo "Comparing JAR $i $jar"
        jar tf `doCygpath "${one}/$i"` | sort > /tmp/files-one-$jar
        jar tf `doCygpath "${two}/$i"` | sort > /tmp/files-two-$jar
        comm -13 /tmp/files-one-$jar /tmp/files-two-$jar | while read f
        do
            echo "    new: ${f}"
        done
        comm -23 /tmp/files-one-$jar /tmp/files-two-$jar | while read f
        do
            echo "    missing: ${f}"
        done
    else
        echo "Skipping missing JAR $i $jar"
    fi
done

#########################################################

if [ -d "$one/../artifacts" -a -d "$two/../artifacts" ]
then
    echo "Comparing artifact files:"
    (cd "$one/../artifacts";
     find . -type f | sort > /tmp/artifact-files-one
    ) 

    (cd "$two/../artifacts";
     find . -type f | sort > /tmp/artifact-files-two
    ) 

    comm -13 /tmp/artifact-files-one /tmp/artifact-files-two | while read f
    do
        echo "    new: ${f}"
    done

    comm -23 /tmp/artifact-files-one /tmp/artifact-files-two | while read f
    do
        echo "    missing: ${f}"
    done


fi