scripts: Update android-generate to support UUID
This allows use of the script as is, automatically
selecting git_dir vs. rev_file based on detected paths.
diff --git a/build-android/android-generate.sh b/build-android/android-generate.sh
index 6f97a6c..0c0f5e1 100755
--- a/build-android/android-generate.sh
+++ b/build-android/android-generate.sh
@@ -37,6 +37,39 @@
( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_extension_helper.h )
( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml object_tracker.cpp )
( cd generated/include; python3 ../../../scripts/lvl_genvk.py -registry ../../../scripts/vk.xml vk_typemap_helper.h )
-( cd generated/include; python3 ../../../scripts/external_revision_generator.py --git_dir ../../third_party/shaderc/third_party/spirv-tools -s SPIRV_TOOLS_COMMIT_ID -o spirv_tools_commit_id.h )
+
+SPIRV_TOOLS_PATH=../../third_party/shaderc/third_party/spirv-tools
+SPIRV_TOOLS_UUID=spirv_tools_uuid.txt
+
+set -e
+
+( cd generated/include;
+
+ if [[ -d $SPIRV_TOOLS_PATH ]]; then
+
+ echo Found spirv-tools, using git_dir for external_revision_generator.py
+
+ python3 ../../../scripts/external_revision_generator.py \
+ --git_dir $SPIRV_TOOLS_PATH \
+ -s SPIRV_TOOLS_COMMIT_ID \
+ -o spirv_tools_commit_id.h
+
+ else
+
+ echo No spirv-tools git_dir found, generating UUID for external_revision_generator.py
+
+ # Ensure uuidgen is installed, this should error if not found
+ uuidgen --v
+
+ uuidgen > $SPIRV_TOOLS_UUID;
+ cat $SPIRV_TOOLS_UUID;
+ python3 ../../../scripts/external_revision_generator.py \
+ --rev_file $SPIRV_TOOLS_UUID \
+ -s SPIRV_TOOLS_COMMIT_ID \
+ -o spirv_tools_commit_id.h
+
+ fi
+)
+
exit 0