moved the 'continue' call to the find_removed_methods() function
This commit is contained in:
parent
fae4ed0f30
commit
422d942090
1 changed files with 16 additions and 17 deletions
33
.github/scripts/backwards_compatibility_check.sh
vendored
33
.github/scripts/backwards_compatibility_check.sh
vendored
|
|
@ -27,51 +27,50 @@ get_current_jar() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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.
|
||||||
ignore_kinesis_client_internal_api() {
|
is_kinesis_client_internal_api() {
|
||||||
local current_class="$1"
|
local current_class="$1"
|
||||||
local grep_internal_api_result=$(javap -v -classpath "$LATEST_JAR" "$current_class" | grep KinesisClientInternalApi)
|
local grep_internal_api_result=$(javap -v -classpath "$LATEST_JAR" "$current_class" | grep KinesisClientInternalApi)
|
||||||
if [[ "$grep_internal_api_result" != "" ]]
|
[[ "$grep_internal_api_result" != "" ]]
|
||||||
then
|
return $?
|
||||||
continue
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skip classes which are not public (e.g. package level). These classes will not break backwards compatibility.
|
# Skip classes which are not public (e.g. package level). These classes will not break backwards compatibility.
|
||||||
ignore_non_public_classes() {
|
is_non_public_class() {
|
||||||
local current_class="$1"
|
local current_class="$1"
|
||||||
local class_definition=$(javap -classpath "$LATEST_JAR" "$current_class" | head -2 | tail -1)
|
local class_definition=$(javap -classpath "$LATEST_JAR" "$current_class" | head -2 | tail -1)
|
||||||
if [[ "$class_definition" != *"public"* ]]
|
[[ "$class_definition" != *"public"* ]]
|
||||||
then
|
return $?
|
||||||
continue
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ignore methods that change from abstract to non-abstract (and vice versa) if the class is an interface.
|
# Ignore methods that change from abstract to non-abstract (and vice versa) if the class is an interface.
|
||||||
ignore_abstract_changes_in_interfaces(){
|
ignore_abstract_changes_in_interfaces() {
|
||||||
local current_class="$1"
|
local current_class="$1"
|
||||||
local class_definition=$(javap -classpath "$LATEST_JAR" "$current_class" | head -2 | tail -1)
|
local class_definition=$(javap -classpath "$LATEST_JAR" "$current_class" | head -2 | tail -1)
|
||||||
if [[ $class_definition == *"interface"* ]]
|
if [[ $class_definition == *"interface"* ]]
|
||||||
then
|
then
|
||||||
LATEST_METHODS=${latest_methods// abstract / }
|
LATEST_METHODS=${LATEST_METHODS// abstract / }
|
||||||
CURRENT_METHODS=${current_methods// abstract / }
|
CURRENT_METHODS=${CURRENT_METHODS// abstract / }
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# 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)"
|
||||||
local latest_classes=$(jar tf $LATEST_JAR | grep .class | tr / . | sed 's/\.class$//' | sort)
|
local latest_classes=$(jar tf $LATEST_JAR | grep .class | tr / . | sed 's/\.class$//')
|
||||||
for class in $latest_classes
|
for class in $latest_classes
|
||||||
do
|
do
|
||||||
ignore_kinesis_client_internal_api "$class"
|
|
||||||
ignore_non_public_classes "$class"
|
if is_kinesis_client_internal_api "$class" || is_non_public_class "$class"
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
LATEST_METHODS=$(javap -classpath "$LATEST_JAR" "$class")
|
LATEST_METHODS=$(javap -classpath "$LATEST_JAR" "$class")
|
||||||
CURRENT_METHODS=$(javap -classpath "$CURRENT_JAR" "$class")
|
CURRENT_METHODS=$(javap -classpath "$CURRENT_JAR" "$class")
|
||||||
|
|
||||||
ignore_abstract_changes_in_interfaces "$class"
|
ignore_abstract_changes_in_interfaces "$class"
|
||||||
|
|
||||||
local removed_methods=$(diff <(echo "$latest_methods") <(echo "$current_methods") | grep '^<')
|
local removed_methods=$(diff <(echo "$LATEST_METHODS") <(echo "$CURRENT_METHODS") | grep '^<')
|
||||||
|
|
||||||
if [[ "$removed_methods" != "" ]]
|
if [[ "$removed_methods" != "" ]]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue