From 488e78ea71de841a668d576544790c347cb35f94 Mon Sep 17 00:00:00 2001
From: Cody Northrop <cnorthrop@google.com>
Date: Mon, 27 Mar 2017 16:30:14 -0600
Subject: [PATCH] android: Update toolchain revisions and locations

Start pulling from github again for more recent bits.

This includes changes to easily allow changing the repo url.
---
 build-android/glslang_revision_android        |  2 +-
 build-android/glslang_url_android             |  1 +
 build-android/shaderc_revision_android        |  2 +-
 build-android/shaderc_url_android             |  1 +
 build-android/spirv-headers_revision_android  |  2 +-
 build-android/spirv-headers_url_android       |  1 +
 build-android/spirv-tools_revision_android    |  2 +-
 build-android/spirv-tools_url_android         |  1 +
 .../update_external_sources_android.bat       |  8 ++--
 .../update_external_sources_android.sh        | 41 ++++++++++++++++---
 10 files changed, 48 insertions(+), 13 deletions(-)
 create mode 100644 build-android/glslang_url_android
 create mode 100644 build-android/shaderc_url_android
 create mode 100644 build-android/spirv-headers_url_android
 create mode 100644 build-android/spirv-tools_url_android

diff --git a/build-android/glslang_revision_android b/build-android/glslang_revision_android
index a81a930ba..f2b15fc4c 100644
--- a/build-android/glslang_revision_android
+++ b/build-android/glslang_revision_android
@@ -1 +1 @@
-7fb605aeb525728edc23aaf3d3fd0ce08a6df95b
+aa3c64c214703709f520dfe47116320213128f39
diff --git a/build-android/glslang_url_android b/build-android/glslang_url_android
new file mode 100644
index 000000000..d66100088
--- /dev/null
+++ b/build-android/glslang_url_android
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/glslang.git
diff --git a/build-android/shaderc_revision_android b/build-android/shaderc_revision_android
index 12319e1df..5e8aa6ef4 100644
--- a/build-android/shaderc_revision_android
+++ b/build-android/shaderc_revision_android
@@ -1 +1 @@
-d65b38bd6b95dea19e02814eb776dd1738aae0da
+71b9b3ba28dc1a0503362d6798a4be635fbf5988
diff --git a/build-android/shaderc_url_android b/build-android/shaderc_url_android
new file mode 100644
index 000000000..488a1fe22
--- /dev/null
+++ b/build-android/shaderc_url_android
@@ -0,0 +1 @@
+https://github.com/google/shaderc.git
diff --git a/build-android/spirv-headers_revision_android b/build-android/spirv-headers_revision_android
index d3fb69ea7..3628df788 100644
--- a/build-android/spirv-headers_revision_android
+++ b/build-android/spirv-headers_revision_android
@@ -1 +1 @@
-e9f7d8ac3cda59f2637776eea1dfad0e171fba21
+6c08995e6e7b94129e6086c78198c77111f2f262
diff --git a/build-android/spirv-headers_url_android b/build-android/spirv-headers_url_android
new file mode 100644
index 000000000..c37214f0b
--- /dev/null
+++ b/build-android/spirv-headers_url_android
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/SPIRV-Headers.git
diff --git a/build-android/spirv-tools_revision_android b/build-android/spirv-tools_revision_android
index 0fedfe925..5f0fe2d2c 100644
--- a/build-android/spirv-tools_revision_android
+++ b/build-android/spirv-tools_revision_android
@@ -1 +1 @@
-1401a61b1e7d1516578171a94edbac33858fb1a2
+7fe8a57a5bd72094e91f9f93e51dac2f2461dcb4
diff --git a/build-android/spirv-tools_url_android b/build-android/spirv-tools_url_android
new file mode 100644
index 000000000..19ccae71f
--- /dev/null
+++ b/build-android/spirv-tools_url_android
@@ -0,0 +1 @@
+https://github.com/KhronosGroup/SPIRV-Tools.git
diff --git a/build-android/update_external_sources_android.bat b/build-android/update_external_sources_android.bat
index 1961d396d..36deaf8c0 100755
--- a/build-android/update_external_sources_android.bat
+++ b/build-android/update_external_sources_android.bat
@@ -179,7 +179,7 @@ REM // ======== Functions ======== //
    echo Creating local glslang repository %GLSLANG_DIR%
    if not exist "%GLSLANG_DIR%\" mkdir %GLSLANG_DIR%
    cd %GLSLANG_DIR%
-   git clone https://android.googlesource.com/platform/external/shaderc/glslang .
+   git clone https://github.com/KhronosGroup/glslang.git .
    git checkout %GLSLANG_REVISION%
    if not exist %GLSLANG_DIR%\SPIRV (
       echo glslang source download failed!
@@ -204,7 +204,7 @@ goto:eof
    echo Creating local spirv-tools repository %SPIRV_TOOLS_DIR%
    if not exist "%SPIRV_TOOLS_DIR%\" mkdir %SPIRV_TOOLS_DIR%
    cd %SPIRV_TOOLS_DIR%
-   git clone https://android.googlesource.com/platform/external/shaderc/spirv-tools .
+   git clone https://github.com/KhronosGroup/SPIRV-Tools.git .
    git checkout %SPIRV_TOOLS_REVISION%
    if not exist %SPIRV_TOOLS_DIR%\source (
       echo spirv-tools source download failed!
@@ -229,7 +229,7 @@ goto:eof
    echo Creating local spirv-headers repository %SPIRV_HEADERS_DIR%
    if not exist "%SPIRV_HEADERS_DIR%\" mkdir %SPIRV_HEADERS_DIR%
    cd %SPIRV_HEADERS_DIR%
-   git clone https://android.googlesource.com/platform/external/shaderc/spirv-headers .
+   git clone https://github.com/KhronosGroup/SPIRV-Headers.git .
    git checkout %SPIRV_HEADERS_REVISION%
    if not exist %SPIRV_HEADERS_DIR%\include (
       echo spirv-headers source download failed!
@@ -254,7 +254,7 @@ goto:eof
    echo Creating local shaderc repository %SHADERC_DIR%
    if not exist "%SHADERC_DIR%\" mkdir %SHADERC_DIR%
    cd %SHADERC_DIR%
-   git clone https://android.googlesource.com/platform/external/shaderc/shaderc .
+   git clone https://github.com/google/shaderc.git .
    git checkout %SHADERC_REVISION%
    if not exist %SHADERC_DIR%\libshaderc (
       echo shaderc source download failed!
diff --git a/build-android/update_external_sources_android.sh b/build-android/update_external_sources_android.sh
index f3f832150..b1ee742b5 100755
--- a/build-android/update_external_sources_android.sh
+++ b/build-android/update_external_sources_android.sh
@@ -29,8 +29,19 @@ SHADERC_REVISION=$(cat $ANDROIDBUILDDIR/shaderc_revision_android)
 
 echo "GLSLANG_REVISION=$GLSLANG_REVISION"
 echo "SPIRV_TOOLS_REVISION=$SPIRV_TOOLS_REVISION"
+echo "SPIRV_HEADERS_REVISION=$SPIRV_HEADERS_REVISION"
 echo "SHADERC_REVISION=$SHADERC_REVISION"
 
+GLSLANG_URL=$(cat $ANDROIDBUILDDIR/glslang_url_android)
+SPIRV_TOOLS_URL=$(cat $ANDROIDBUILDDIR/spirv-tools_url_android)
+SPIRV_HEADERS_URL=$(cat $ANDROIDBUILDDIR/spirv-headers_url_android)
+SHADERC_URL=$(cat $ANDROIDBUILDDIR/shaderc_url_android)
+
+echo "GLSLANG_URL=$GLSLANG_URL"
+echo "SPIRV_TOOL_URLS_=$SPIRV_TOOLS_URL"
+echo "SPIRV_HEADERS_URL=$SPIRV_HEADERS_URL"
+echo "SHADERC_URL=$SHADERC_URL"
+
 if [[ $(uname) == "Linux" ]]; then
     cores="$(nproc || echo 4)"
 elif [[ $(uname) == "Darwin" ]]; then
@@ -42,13 +53,18 @@ function create_glslang () {
    echo "Creating local glslang repository ($BASEDIR/glslang)."
    mkdir -p $BASEDIR/glslang
    cd $BASEDIR/glslang
-   git clone https://android.googlesource.com/platform/external/shaderc/glslang .
+   git clone $GLSLANG_URL .
    git checkout $GLSLANG_REVISION
 }
 
 function update_glslang () {
    echo "Updating $BASEDIR/glslang"
    cd $BASEDIR/glslang
+   if [[ $(git config --get remote.origin.url) != $GLSLANG_URL ]]; then
+      echo "glslang URL mismatch, recreating local repo"
+      create_glslang
+      return
+   fi
    git fetch --all
    git checkout $GLSLANG_REVISION
 }
@@ -58,13 +74,18 @@ function create_spirv-tools () {
    echo "Creating local spirv-tools repository ($BASEDIR/spirv-tools)."
    mkdir -p $BASEDIR/spirv-tools
    cd $BASEDIR/spirv-tools
-   git clone https://android.googlesource.com/platform/external/shaderc/spirv-tools .
+   git clone $SPIRV_TOOLS_URL .
    git checkout $SPIRV_TOOLS_REVISION
 }
 
 function update_spirv-tools () {
    echo "Updating $BASEDIR/spirv-tools"
    cd $BASEDIR/spirv-tools
+   if [[ $(git config --get remote.origin.url) != $SPIRV_TOOLS_URL ]]; then
+      echo "spirv-tools URL mismatch, recreating local repo"
+      create_spirv-tools
+      return
+   fi
    git fetch --all
    git checkout $SPIRV_TOOLS_REVISION
 }
@@ -74,13 +95,18 @@ function create_spirv-headers () {
    echo "Creating local spirv-headers repository ($BASEDIR/spirv-tools/external/spirv-headers)."
    mkdir -p $BASEDIR/spirv-tools/external/spirv-headers
    cd $BASEDIR/spirv-tools/external/spirv-headers
-   git clone https://android.googlesource.com/platform/external/shaderc/spirv-headers .
+   git clone $SPIRV_HEADERS_URL .
    git checkout $SPIRV_HEADERS_REVISION
 }
 
 function update_spirv-headers () {
    echo "Updating $BASEDIR/spirv-tools/external/spirv-headers"
    cd $BASEDIR/spirv-tools/external/spirv-headers
+   if [[ $(git config --get remote.origin.url) != $SPIRV_HEADERS_URL ]]; then
+      echo "spirv-headers URL mismatch, recreating local repo"
+      create_spirv-headers
+      return
+   fi
    git fetch --all
    git checkout $SPIRV_HEADERS_REVISION
 }
@@ -89,7 +115,7 @@ function create_shaderc () {
    rm -rf $BASEDIR/shaderc
    echo "Creating local shaderc repository ($BASEDIR/shaderc)."
    cd $BASEDIR
-   git clone https://android.googlesource.com/platform/external/shaderc/shaderc
+   git clone $SHADERC_URL
    cd shaderc
    git checkout $SHADERC_REVISION
 }
@@ -97,6 +123,11 @@ function create_shaderc () {
 function update_shaderc () {
    echo "Updating $BASEDIR/shaderc"
    cd $BASEDIR/shaderc
+   if [[ $(git config --get remote.origin.url) != $SHADERC_URL ]]; then
+      echo "shaderc URL mismatch, recreating local repo"
+      create_shaderc
+      return
+   fi
    git fetch --all
    git checkout $SHADERC_REVISION
 }
@@ -110,7 +141,7 @@ function build_shaderc () {
 if [ ! -d "$BASEDIR/glslang" -o ! -d "$BASEDIR/glslang/.git" -o -d "$BASEDIR/glslang/.svn" ]; then
    create_glslang
 fi
- update_glslang
+update_glslang
 
 
 if [ ! -d "$BASEDIR/spirv-tools" -o ! -d "$BASEDIR/spirv-tools/.git" ]; then
-- 
GitLab