compute_setup.sh 974 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # A `realpath` alternative using the default C implementation.
  3. filepath() {
  4. [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
  5. }
  6. REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))"
  7. clone_checkout_compute() {
  8. cd $REPO_ROOT
  9. revision="${OPENSWIFTUI_OPENATTRIBUTESHIMS_COMPUTE_SOURCE_VERSION:-}"
  10. if [ -z "$revision" ]; then
  11. revision=$(Scripts/CI/get_revision.sh compute 2>/dev/null || true)
  12. fi
  13. if [ -z "$revision" ]; then
  14. revision="0.3.0-bugfix.1"
  15. fi
  16. cd ..
  17. if [ ! -d Compute ]; then
  18. gh repo clone OpenSwiftUIProject/Compute
  19. cd Compute
  20. else
  21. echo "Compute already exists, skipping clone."
  22. cd Compute
  23. git fetch --all --quiet
  24. git stash --quiet || true
  25. git reset --hard --quiet origin/main
  26. fi
  27. git checkout --quiet "$revision"
  28. }
  29. update_compute() {
  30. cd $REPO_ROOT/../Compute
  31. git submodule sync --recursive --quiet
  32. git submodule update --init --recursive
  33. }
  34. clone_checkout_compute
  35. update_compute