-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Build] Add a script to execute revapi without gradle plugin
- Loading branch information
Showing
7 changed files
with
144 additions
and
1,309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ build | |
.gradle | ||
.idea | ||
.rat-excludes | ||
.revapi.template | ||
LICENSE | ||
NOTICE | ||
revapi.yml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[ | ||
{ | ||
"extension": "revapi.differences", | ||
"id": "1.6.0", | ||
"configuration": { | ||
"differences": [ | ||
{ | ||
"justification": "This is a test", | ||
"code": "java.method.addedToInterface", | ||
"new": "method void org.apache.iceberg.catalog.SessionCatalog::testing()" | ||
} | ||
] | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<#ftl strip_whitespace=true> | ||
Old API: <#list analysis.oldApi.archives as archive>${archive.name}<#sep>, </#list> | ||
New API: <#list analysis.newApi.archives as archive>${archive.name}<#sep>, </#list> | ||
<#if reports?has_content> | ||
<#list reports as report> | ||
<#list report.differences as diff> | ||
<#list diff.classification?keys as compat> | ||
<#if compat == "SOURCE" && diff.classification?api.get(compat) == "BREAKING"> | ||
[ERROR] ${diff.description!} | ||
code: ${diff.code} | ||
new: ${report.newElement!""} | ||
old: ${report.oldElement!""} | ||
</#if> | ||
</#list> | ||
</#list> | ||
</#list> | ||
</#if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
export REVAPI_VERSION=0.12.0 | ||
export OLD_VERSION=1.5.2 | ||
export NEW_VERSION=1.6.0-SNAPSHOT | ||
|
||
# Go to the root directory | ||
ROOT_DIR="$(cd "`dirname "$0"`"/..; pwd)" | ||
cd "$ROOT_DIR" | ||
|
||
REVAPI_WORKING_DIR="$ROOT_DIR/lib/temp/revapi" | ||
|
||
mkdir -p $REVAPI_WORKING_DIR | ||
|
||
export REVAPI_ZIP="$ROOT_DIR"/lib/revapi-standalone-${REVAPI_VERSION}-standalone.zip | ||
|
||
if test -x "$JAVA_HOME/bin/java"; then | ||
declare java_cmd="$JAVA_HOME/bin/java" | ||
else | ||
declare java_cmd=java | ||
fi | ||
|
||
REVAPI_URL=https://repo1.maven.org/maven2/org/revapi/revapi-standalone/${REVAPI_VERSION}/revapi-standalone-${REVAPI_VERSION}-standalone.zip | ||
|
||
if [ ! -f "$REVAPI_ZIP" ]; then | ||
printf "Downloading revapi\n" | ||
REVAPI_ZIP_DL="${REVAPI_ZIP}.part" | ||
if [ $(command -v curl) ]; then | ||
curl -L --silent "${REVAPI_URL}" > "$REVAPI_ZIP_DL" && mv "$REVAPI_ZIP_DL" "$REVAPI_ZIP" | ||
elif [ $(command -v wget) ]; then | ||
wget --quiet ${REVAPI_URL} -O "$REVAPI_ZIP_DL" && mv "$REVAPI_ZIP_DL" "$REVAPI_ZIP" | ||
else | ||
printf "You do not have curl or wget installed, please install revapi manually.\n" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
unzip -q -o "$REVAPI_ZIP" -d "$ROOT_DIR/lib" | ||
|
||
export REVAPI_HOME="$ROOT_DIR/lib/revapi-$REVAPI_VERSION" | ||
|
||
REVAPI_PROJECTS="api core parquet orc common data" | ||
|
||
REVAPI_OUT=lib/revapi.report | ||
rm "$REVAPI_OUT" | ||
rm -f "$REVAPI_OUT" | ||
for REVAPI_PROJECT in $REVAPI_PROJECTS; do | ||
echo "========================" | ||
echo "Checking iceberg-$REVAPI_PROJECT, comparing $OLD_VERSION / $NEW_VERSION" | ||
echo "Downloading iceberg-$REVAPI_PROJECT $OLD_VERSION" | ||
if [ $(command -v curl) ]; then | ||
curl -L --silent "https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-$REVAPI_PROJECT/$OLD_VERSION/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" > "$REVAPI_WORKING_DIR/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" | ||
elif [ $(command -v wget) ]; then | ||
wget --quiet "https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-$REVAPI_PROJECT/$OLD_VERSION/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" -O "$REVAPI_REVAPI_WORKING_DIR/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" | ||
else | ||
printf "You do not have curl or wget installed, please download artifact manually.\n" | ||
exit 1 | ||
fi | ||
if ! [ -f "$REVAPI_WORKING_DIR/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" ]; then | ||
echo "$REVAPI_WORKING_DIR/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar does not exist. Please check if you can download the artifact via curl or wget." | ||
exit 1 | ||
fi | ||
if ! [ -f "$REVAPI_PROJECT/build/libs/iceberg-$REVAPI_PROJECT-$NEW_VERSION.jar" ]; then | ||
echo "$REVAPI_PROJECT/build/libs/iceberg-$REVAPI_PROJECT-$NEW_VERSION.jar does not exist. You have to build artifacts (with gradle publishToMavenLocal) before checking API" | ||
exit 1 | ||
fi | ||
$REVAPI_HOME/revapi.sh --extensions=org.revapi:revapi-java:0.28.1,org.revapi:revapi-reporter-text:0.15.0 --old "$REVAPI_WORKING_DIR/iceberg-$REVAPI_PROJECT-$OLD_VERSION.jar" --new "$REVAPI_PROJECT/build/libs/iceberg-$REVAPI_PROJECT-$NEW_VERSION.jar" -c dev/.revapi.json -Drevapi.java.missing-classes.behavior=ignore -Drevapi.reporter.text.minCriticality=error -Drevapi.reporter.text.append=true -Drevapi.reporter.text.output=$REVAPI_OUT -Drevapi.reporter.text.minSeverity=BREAKING -Drevapi.reporter.text.template=dev/.revapi.template | ||
if [[ $(grep "ERROR" $REVAPI_OUT) ]]; then | ||
echo "==================================================================================" | ||
echo "API/ABI breaks detected." | ||
echo "Details can be found in ${REVAPI_OUT}" | ||
echo "Adding RevAPI breaks should only be done after going through a deprecation cycle." | ||
echo "Please make sure to follow the deprecation rules defined in" | ||
echo "https://github.com/apache/iceberg/blob/main/CONTRIBUTING.md#semantic-versioning." | ||
echo "==================================================================================" | ||
exit 2 | ||
fi | ||
done | ||
|
||
echo "revapi check passed" |