compute_setup.sh 977 B

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