#




# Original templates:
# https://github.com/mozilla/glean/runs/10060562202
# taskcluster/ci/module-build/kind.yml
# taskcluster/docker/linux/Dockerfile




set -vxe

# set -vxeu

if [ -d glean ]; then

  cd glean

  git switch main

  git pull

else

# git clone --branch 061ab89f5aedfcd0c052f4bec8cedb3726c3bdb5 https://gitlab.torproject.org/guest475646844/glean.git

git clone -n https://gitlab.torproject.org/guest475646844/glean.git

# git clone -n https://github.com/mozilla/glean.git

cd glean

fi

git checkout 061ab89f5aedfcd0c052f4bec8cedb3726c3bdb5

# git checkout 061ab89f

# cd glean

# chmod 744 taskcluster/scripts/rustup-setup.sh || true

# chmod 744 taskcluster/scripts/cross-compile-setup.sh || true

# chmod 744 gradlew || true

# taskcluster/scripts/rustup-setup.sh && source taskcluster/scripts/cross-compile-setup.sh && bash -c \'echo "rust.targets=arm,arm64,x86_64,x86,darwin-x86-64,darwin-aarch64,linux-x86-64,win32-x86-64-gnu\\n" > local.properties\' && ./gradlew :glean-gradle-plugin:assembleRelease :glean-gradle-plugin:publish :glean-gradle-plugin:checkMavenArtifacts

# taskcluster/scripts/rustup-setup.sh && taskcluster/scripts/cross-compile-setup.sh && bash -c 'echo rust.targets=arm64 >local.properties' && ./gradlew :glean-gradle-plugin:assembleRelease :glean-gradle-plugin:publish :glean-gradle-plugin:checkMavenArtifacts

# source taskcluster/scripts/rustup-setup.sh && source taskcluster/scripts/cross-compile-setup.sh && bash -c 'echo rust.targets=arm64 >local.properties' && ./gradlew :glean-gradle-plugin:assembleRelease :glean-gradle-plugin:publish :glean-gradle-plugin:checkMavenArtifacts

curl -sfSL --retry 5 --retry-delay 10 \
         -o /usr/local/bin/tooltool.py \
         https://raw.githubusercontent.com/mozilla/build-tooltool/36511dae0ead6848017e2d569b1f6f1b36984d40/tooltool.py && \
         chmod +x /usr/local/bin/tooltool.py

rm -fv /usr/bin/python || true

# ln -s /usr/bin/python3 /usr/bin/python || true

ln -s /usr/bin/python2 /usr/bin/python || true

export GRADLE_OPTS='-Xmx4096m -Dorg.gradle.daemon=false'

source taskcluster/scripts/rustup-setup.sh && source taskcluster/scripts/cross-compile-setup.sh && bash -c 'echo -e "rust.targets=arm,arm64,x86_64,x86,darwin-x86-64,darwin-aarch64,linux-x86-64,win32-x86-64-gnu\n" >local.properties' && ./gradlew :glean-gradle-plugin:assembleRelease :glean-gradle-plugin:publish :glean-gradle-plugin:checkMavenArtifacts
