Update backward compatibility check script
Dont fail the check for major release but print the output for information/review purposes to know what API changes have occurred in a major release Manually tested the changes with some incompatible API changes between patch release, minor release and major release.
This commit is contained in:
parent
fbfd74df39
commit
bedb605cf6
1 changed files with 21 additions and 5 deletions
26
.github/scripts/backwards_compatibility_check.sh
vendored
26
.github/scripts/backwards_compatibility_check.sh
vendored
|
|
@ -27,12 +27,21 @@ get_current_jar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
is_new_minor_release() {
|
is_new_minor_release() {
|
||||||
|
is_new_major_release && return 1
|
||||||
|
|
||||||
local latest_minor_version=$(echo "$LATEST_VERSION" | cut -d . -f 2)
|
local latest_minor_version=$(echo "$LATEST_VERSION" | cut -d . -f 2)
|
||||||
local current_minor_version=$(echo "$CURRENT_VERSION" | cut -d . -f 2)
|
local current_minor_version=$(echo "$CURRENT_VERSION" | cut -d . -f 2)
|
||||||
[[ "$latest_minor_version" != "$current_minor_version" ]]
|
[[ "$latest_minor_version" != "$current_minor_version" ]]
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_new_major_release() {
|
||||||
|
local latest_major_version=$(echo "$LATEST_VERSION" | cut -d . -f 1)
|
||||||
|
local current_major_version=$(echo "$CURRENT_VERSION" | cut -d . -f 1)
|
||||||
|
[[ "$latest_major_version" != "$current_major_version" ]]
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
# 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.
|
||||||
is_kinesis_client_internal_api() {
|
is_kinesis_client_internal_api() {
|
||||||
local current_class="$1"
|
local current_class="$1"
|
||||||
|
|
@ -63,9 +72,9 @@ ignore_abstract_changes_in_interfaces() {
|
||||||
# Checks if there are any methods in the latest version that were removed in the current version.
|
# Checks if there are any methods in the latest version that were removed in the current version.
|
||||||
find_removed_methods() {
|
find_removed_methods() {
|
||||||
echo "Checking if methods in current version (v$CURRENT_VERSION) were removed from latest version (v$LATEST_VERSION)"
|
echo "Checking if methods in current version (v$CURRENT_VERSION) were removed from latest version (v$LATEST_VERSION)"
|
||||||
if is_new_minor_release
|
if is_new_minor_release || is_new_major_release
|
||||||
then
|
then
|
||||||
echo "New minor release is being performed. Ignoring changes in classes marked with @KinesisClientInternalApi annotation."
|
echo "New minor/major release is being performed. Ignoring changes in classes marked with @KinesisClientInternalApi annotation."
|
||||||
fi
|
fi
|
||||||
local latest_classes=$(
|
local latest_classes=$(
|
||||||
jar tf $LATEST_JAR |
|
jar tf $LATEST_JAR |
|
||||||
|
|
@ -79,13 +88,20 @@ find_removed_methods() {
|
||||||
grep -v 'software\.amazon\.kinesis\.retrieval\.kpl\.Messages')
|
grep -v 'software\.amazon\.kinesis\.retrieval\.kpl\.Messages')
|
||||||
for class in $latest_classes
|
for class in $latest_classes
|
||||||
do
|
do
|
||||||
if (is_kinesis_client_internal_api "$class" && is_new_minor_release) || is_non_public_class "$class"
|
if (is_kinesis_client_internal_api "$class" && (is_new_minor_release || is_new_major_release)) || is_non_public_class "$class"
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CURRENT_METHODS=$(javap -classpath "$CURRENT_JAR" "$class" 2>/dev/null)
|
||||||
|
if [ -z "$CURRENT_METHODS" ]
|
||||||
|
then
|
||||||
|
echo "Class $class was removed"
|
||||||
|
REMOVED_METHODS_FLAG=$TRUE
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
LATEST_METHODS=$(javap -classpath "$LATEST_JAR" "$class")
|
LATEST_METHODS=$(javap -classpath "$LATEST_JAR" "$class")
|
||||||
CURRENT_METHODS=$(javap -classpath "$CURRENT_JAR" "$class")
|
|
||||||
|
|
||||||
ignore_abstract_changes_in_interfaces "$class"
|
ignore_abstract_changes_in_interfaces "$class"
|
||||||
|
|
||||||
|
|
@ -111,7 +127,7 @@ get_backwards_compatible_result() {
|
||||||
if [[ $REMOVED_METHODS_FLAG == $TRUE ]]
|
if [[ $REMOVED_METHODS_FLAG == $TRUE ]]
|
||||||
then
|
then
|
||||||
echo "Current KCL version $CURRENT_VERSION is not backwards compatible with version $LATEST_VERSION. See output above for removed packages/methods."
|
echo "Current KCL version $CURRENT_VERSION is not backwards compatible with version $LATEST_VERSION. See output above for removed packages/methods."
|
||||||
exit 1
|
is_new_major_release || exit 1
|
||||||
else
|
else
|
||||||
echo "Current KCL version $CURRENT_VERSION is backwards compatible with version $LATEST_VERSION."
|
echo "Current KCL version $CURRENT_VERSION is backwards compatible with version $LATEST_VERSION."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue