Last active
May 20, 2020 14:03
-
-
Save mannodermaus/4a6fb94989ed0080b7bde57998a731a3 to your computer and use it in GitHub Desktop.
Runs the JAPI Compliance Checker on two AAR files. (https://github.com/lvc/japi-compliance-checker)
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
#!/bin/sh | |
# Performs the JAPI compliance checker on two Android Archive files. | |
# https://github.com/lvc/japi-compliance-checker | |
AAR1="$1" | |
AAR2="$2" | |
function usage { | |
echo "Usage:" | |
echo " android-compliance-checker <old.aar> <new.aar>" | |
echo "" | |
echo "Replace <old.aar> and <new.aar> with the two files to compare." | |
exit 1 | |
} | |
if [ -z "$AAR1" ] || [ -z "$AAR2" ]; then | |
usage | |
fi | |
if [ -f "$AAR1" ] && [ -f "$AAR2" ] && [[ "$AAR1" == *.aar ]] && [[ "$AAR2" == *.aar ]]; then | |
# Unzip both AARs and run JAPI compliance checker against their classes.jar | |
TMPDIR=$(mktemp -d) | |
trap "rm -r $TMPDIR" EXIT | |
unzip -q "$AAR1" "classes.jar" -d "$TMPDIR/old" | |
unzip -q "$AAR2" "classes.jar" -d "$TMPDIR/new" | |
japi-compliance-checker -lib "Android Library" -v1 "$AAR1" -v2 "$AAR2" -old "$TMPDIR/old/classes.jar" -new "$TMPDIR/new/classes.jar" | |
else | |
usage | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment