remove package diff
This commit is contained in:
parent
aef9717935
commit
43d9ad0685
1 changed files with 16 additions and 23 deletions
39
.github/scripts/backwards_compatibility_check.sh
vendored
39
.github/scripts/backwards_compatibility_check.sh
vendored
|
|
@ -3,14 +3,13 @@
|
||||||
TRUE=1
|
TRUE=1
|
||||||
FALSE=0
|
FALSE=0
|
||||||
|
|
||||||
REMOVED_PACKAGES_FLAG=$FALSE
|
|
||||||
REMOVED_METHODS_FLAG=$FALSE
|
REMOVED_METHODS_FLAG=$FALSE
|
||||||
|
|
||||||
KCL_MAVEN_DIR=~/.m2/repository/software/amazon/kinesis/amazon-kinesis-client
|
KCL_MAVEN_DIR=~/.m2/repository/software/amazon/kinesis/amazon-kinesis-client
|
||||||
|
|
||||||
# clear the Maven directory so that the latest release will be the only version in the Maven directory after running mvn dependency:get
|
# clear the Maven directory so that the latest release will be the only version in the Maven directory after running mvn dependency:get
|
||||||
rm -rf $KCL_MAVEN_DIR
|
rm -rf $KCL_MAVEN_DIR
|
||||||
mvn dependency:get -Dartifact=software.amazon.kinesis:amazon-kinesis-client:LATEST
|
mvn -B dependency:get -Dartifact=software.amazon.kinesis:amazon-kinesis-client:LATEST
|
||||||
LATEST_VERSION=$(ls $KCL_MAVEN_DIR | grep '[0-9].[0-9].[0-9]')
|
LATEST_VERSION=$(ls $KCL_MAVEN_DIR | grep '[0-9].[0-9].[0-9]')
|
||||||
LATEST_JAR=$KCL_MAVEN_DIR/$LATEST_VERSION/amazon-kinesis-client-$LATEST_VERSION.jar
|
LATEST_JAR=$KCL_MAVEN_DIR/$LATEST_VERSION/amazon-kinesis-client-$LATEST_VERSION.jar
|
||||||
|
|
||||||
|
|
@ -19,23 +18,16 @@ mvn -B install -DskipTests
|
||||||
CURRENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
CURRENT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
||||||
CURRENT_JAR=$KCL_MAVEN_DIR/$CURRENT_VERSION/amazon-kinesis-client-$CURRENT_VERSION.jar
|
CURRENT_JAR=$KCL_MAVEN_DIR/$CURRENT_VERSION/amazon-kinesis-client-$CURRENT_VERSION.jar
|
||||||
|
|
||||||
echo "Comparing KCL versions $LATEST_VERSION (latest release) to $CURRENT_VERSION (current)."
|
echo "Checking if methods in KCL version $LATEST_VERSION (latest release) were removed in version $CURRENT_VERSION (current)"
|
||||||
|
|
||||||
# check if any packages were removed
|
LATEST_CLASSES=$(jar tf $LATEST_JAR | grep .class | tr / . | sed 's/\.class$//' | sort)
|
||||||
echo "Checking if packages in version $LATEST_VERSION were removed in $CURRENT_VERSION"
|
for CLASS in $LATEST_CLASSES
|
||||||
LATEST_PACKAGES=$(jar tf $LATEST_JAR | grep .class | tr / . | sed 's/\.class$//' | sort)
|
|
||||||
CURRENT_PACKAGES=$(jar tf $CURRENT_JAR | grep .class | tr / . | sed 's/\.class$//' | sort)
|
|
||||||
diff <(echo "$LATEST_PACKAGES") <(echo "$CURRENT_PACKAGES") | grep '^<' && REMOVED_PACKAGES_FLAG=$TRUE || echo "No packages removed in version $CURRENT_VERSION."
|
|
||||||
|
|
||||||
# check if any methods within the packages were removed
|
|
||||||
echo "Checking if methods in $LATEST_VERSION were removed in $CURRENT_VERSION"
|
|
||||||
for package in $LATEST_PACKAGES
|
|
||||||
do
|
do
|
||||||
# Skip classes which are not public. Only public class should be checked since other classes will not break backwards compatibility.
|
# Skip classes which are not public. Only public class should be checked since other classes will not break backwards compatibility.
|
||||||
CLASS_DEFINITION=$(javap -classpath $LATEST_JAR $package | head -2 | tail -1)
|
CLASS_DEFINITION=$(javap -classpath $LATEST_JAR $CLASS | head -2 | tail -1)
|
||||||
|
|
||||||
# Skip classes with the KinesisClientInternalApi annotation. These classes are subject to breaking backwards compatibility.
|
# Skip classes with the KinesisClientInternalApi annotation. These classes are subject to breaking backwards compatibility.
|
||||||
INTERNAL_API_RESULT=$(javap -v -classpath $LATEST_JAR $package | grep KinesisClientInternalApi)
|
INTERNAL_API_RESULT=$(javap -v -classpath $LATEST_JAR $CLASS | grep KinesisClientInternalApi)
|
||||||
|
|
||||||
if [[ $CLASS_DEFINITION != *"public"* || $INTERNAL_API_RESULT != "" ]]
|
if [[ $CLASS_DEFINITION != *"public"* || $INTERNAL_API_RESULT != "" ]]
|
||||||
then
|
then
|
||||||
|
|
@ -43,17 +35,18 @@ do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if any methods were removed
|
# check if any methods were removed
|
||||||
LATEST_METHODS=$(javap -classpath $LATEST_JAR $package)
|
LATEST_METHODS=$(javap -classpath $LATEST_JAR $CLASS)
|
||||||
CURRENT_METHODS=$(javap -classpath $CURRENT_JAR $package)
|
CURRENT_METHODS=$(javap -classpath $CURRENT_JAR $CLASS)
|
||||||
diff <(echo "$LATEST_METHODS") <(echo "$CURRENT_METHODS") | grep '^<' && REMOVED_METHODS_FLAG=$TRUE || :
|
REMOVED_METHODS=$(diff <(echo "$LATEST_METHODS") <(echo "$CURRENT_METHODS") | grep '^<')
|
||||||
|
if [[ $REMOVED_METHODS != "" ]]
|
||||||
|
then
|
||||||
|
REMOVED_METHODS_FLAG=$TRUE
|
||||||
|
echo "Methods removed in class ${CLASS##*.}"
|
||||||
|
echo "$REMOVED_METHODS"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $REMOVED_METHODS_FLAG == $FALSE ]]
|
if [[ $REMOVED_METHODS_FLAG == $TRUE ]]
|
||||||
then
|
|
||||||
echo "No methods removed in version $CURRENT_VERSION."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $REMOVED_PACKAGES_FLAG == $TRUE || $REMOVED_METHODS_FLAG == $TRUE ]]
|
|
||||||
then
|
then
|
||||||
echo "KCL version $CURRENT_VERSION is not backwards compatible with version $LATEST_VERSION. See output above for removed packages/methods."
|
echo "KCL version $CURRENT_VERSION is not backwards compatible with version $LATEST_VERSION. See output above for removed packages/methods."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue