Created
December 12, 2024 00:15
-
-
Save anatawa12/5d1a2a7ebe82cbedd6dea4903a5c1964 to your computer and use it in GitHub Desktop.
SimpleVRCSDKApiCheck
This file contains hidden or 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/bash | |
set -eu | |
UNITY="/Applications/Unity/Hub/Editor/2022.3.6f1/Unity.app/Contents/MacOS/Unity" | |
UNITY="/Applications/Unity/Hub/Editor/2022.3.22f1/Unity.app/Contents/MacOS/Unity" | |
clear_and_install() { | |
local FOLDER="$1" | |
local PACKAGE="$2" | |
local VERSION="$3" | |
pushd "$FOLDER" | |
rm -rf Library Temp Logs VRCSDKApiChecker Packages/*/ Packages/vpm-manifest.json | |
vrc-get install --prerelease -y "$PACKAGE" "$VERSION" | |
popd | |
} | |
generate_api_folder() { | |
local FOLDER="$1" | |
local ENV_METHOD="VRC.Editor.EnvConfig.ConfigureSettings" | |
local CHECK_METHOD="VRCSDK_API_Checker.VRCSDKApiChecker.CheckVRCSDKAPI" | |
"$UNITY" -quit -batchmode -logFile - -nographics -projectPath "$FOLDER" -executeMethod "$ENV_METHOD" | |
"$UNITY" -quit -batchmode -logFile - -nographics -projectPath "$FOLDER" -executeMethod "$CHECK_METHOD" | |
} | |
process_project() { | |
local FOLDER="$1" | |
local OUT_FOLDER="$2" | |
local PACKAGE="$3" | |
local VERSION="$4" | |
clear_and_install "$FOLDER" "$PACKAGE" "$VERSION" | |
generate_api_folder "$FOLDER" | |
rsync --recursive "$FOLDER/VRCSDKApiChecker/" "$OUT_FOLDER" | |
} | |
WORLDS=auto | |
AVATARS=auto | |
while [[ "$1" == --* ]]; do | |
case "$1" in | |
--worlds) | |
WORLDS=true | |
shift | |
;; | |
--avatars) | |
AVATARS=true | |
shift | |
;; | |
*) | |
echo "Unknown option: $1" | |
exit 1 | |
;; | |
esac | |
done | |
if [ "$WORLDS" == "auto" ] && [ "$AVATARS" == "auto" ]; then | |
WORLDS=true | |
AVATARS=true | |
fi | |
if [ "$WORLDS" == "auto" ]; then | |
WORLDS=false | |
fi | |
if [ "$AVATARS" == "auto" ]; then | |
AVATARS=false | |
fi | |
OLD_VERSION="$1" | |
NEW_VERSION="$2" | |
if [ -z "$OLD_VERSION" ] || [ -z "$NEW_VERSION" ]; then | |
echo "Usage: $0 <old-version> <new-version>" | |
exit 1 | |
fi | |
rm -rf VRCSDKApi.old VRCSDKApi.new | |
AVATARS_OLD_PID= | |
AVATARS_NEW_PID= | |
WORLDS_OLD_PID= | |
WORLDS_NEW_PID= | |
if [ "$AVATARS" = true ]; then | |
process_project "Avatars-old" "VRCSDKApi.old" "com.vrchat.avatars" "$OLD_VERSION" & | |
AVATARS_OLD_PID=$! | |
process_project "Avatars-new" "VRCSDKApi.new" "com.vrchat.avatars" "$NEW_VERSION" & | |
AVATARS_NEW_PID=$! | |
fi | |
if [ "$WORLDS" = true ]; then | |
process_project "Worlds-old" "VRCSDKApi.old" "com.vrchat.worlds" "$OLD_VERSION" & | |
WORLDS_OLD_PID=$! | |
process_project "Worlds-new" "VRCSDKApi.new" "com.vrchat.worlds" "$NEW_VERSION" & | |
WORLDS_NEW_PID=$! | |
fi | |
wait $AVATARS_OLD_PID $AVATARS_NEW_PID $WORLDS_OLD_PID $WORLDS_NEW_PID | |
git diff --no-index --no-renames VRCSDKApi.old VRCSDKApi.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment