diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index efeaf09a..ee78d22b 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -41,7 +41,7 @@ jobs: with: install: false cache: false - - name: Set up Tuist cache + - name: Set up Tuist run: | source Scripts/Tuist/common.sh tuist_ci_setup diff --git a/.github/workflows/compute.yml b/.github/workflows/compute.yml index 9024a523..1e3ec9a8 100644 --- a/.github/workflows/compute.yml +++ b/.github/workflows/compute.yml @@ -88,7 +88,7 @@ jobs: with: install: false cache: false - - name: Set up Tuist cache + - name: Set up Tuist run: | source Scripts/Tuist/common.sh tuist_ci_setup diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index ae168895..c4c96431 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -43,7 +43,7 @@ jobs: with: install: false cache: false - - name: Set up Tuist cache + - name: Set up Tuist run: | source Scripts/Tuist/common.sh tuist_ci_setup diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d569f0a..31a1c24d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: with: install: false cache: false - - name: Set up Tuist cache + - name: Set up Tuist run: | source Scripts/Tuist/common.sh tuist_ci_setup diff --git a/.github/workflows/xcframework.yml b/.github/workflows/xcframework.yml index 56ef57dc..6fdb4123 100644 --- a/.github/workflows/xcframework.yml +++ b/.github/workflows/xcframework.yml @@ -35,7 +35,7 @@ jobs: with: install: false cache: false - - name: Set up Tuist cache + - name: Set up Tuist run: | source Scripts/Tuist/common.sh tuist_ci_setup diff --git a/Example/Tuist.swift b/Example/Tuist.swift index 82f67208..1822651a 100644 --- a/Example/Tuist.swift +++ b/Example/Tuist.swift @@ -1,18 +1,20 @@ import ProjectDescription +// Keep remote caches disabled to reduce metered network traffic. let tuist = Tuist( fullHandle: "OpenSwiftUIProject/openattributegraph", xcodeCache: .xcodeCache( - upload: Environment.isCI + upload: false ), project: .tuist( generationOptions: .options( optionalAuthentication: true, - enableCaching: Environment.isCI, + enableCaching: false, manifestEnvironment: [ "OPENSWIFTUI_*", "OPENATTRIBUTEGRAPH_*", ] - ) + ), + cacheOptions: .options(storages: [.local]) ) ) diff --git a/Scripts/Tuist/common.sh b/Scripts/Tuist/common.sh index 4e65d36c..df657d34 100644 --- a/Scripts/Tuist/common.sh +++ b/Scripts/Tuist/common.sh @@ -4,29 +4,6 @@ TUIST_REPOSITORY_ROOT="$( cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 pwd -P )" -TUIST_CACHE_SOCKET_PATH="${TUIST_CACHE_SOCKET_PATH:-${XDG_STATE_HOME:-$HOME/.local/state}/tuist/OpenSwiftUIProject_openattributegraph.sock}" - -tuist_cache_service_is_ready() { - [[ -S "$TUIST_CACHE_SOCKET_PATH" ]] || return 1 - - if command -v lsof >/dev/null 2>&1; then - lsof "$TUIST_CACHE_SOCKET_PATH" >/dev/null 2>&1 - fi -} - -tuist_wait_for_cache_service() { - local attempt - for ((attempt = 0; attempt < 40; attempt++)); do - if tuist_cache_service_is_ready; then - return 0 - fi - sleep 0.25 - done - - echo "Tuist cache service is not listening at $TUIST_CACHE_SOCKET_PATH." >&2 - echo "If Tuist reported a different socket, set TUIST_CACHE_SOCKET_PATH to that path." >&2 - return 69 -} tuist_ci_setup() ( set -e @@ -35,8 +12,6 @@ tuist_ci_setup() ( mise trust mise.toml mise install mise exec -- tuist auth login - mise exec -- tuist setup cache --path "$TUIST_REPOSITORY_ROOT" - tuist_wait_for_cache_service ) tuist_xcodebuild() ( @@ -60,29 +35,12 @@ tuist_xcodebuild() ( result_bundle_path="$PWD/$result_bundle_path" fi - local cache_settings=() - if tuist_cache_service_is_ready; then - cache_settings=( - COMPILATION_CACHE_ENABLE_CACHING=YES - "COMPILATION_CACHE_REMOTE_SERVICE_PATH=$TUIST_CACHE_SOCKET_PATH" - COMPILATION_CACHE_ENABLE_PLUGIN=YES - COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS=YES - ) - elif [[ -n "${CI:-}" ]]; then - echo "Tuist cache service is unavailable at $TUIST_CACHE_SOCKET_PATH." >&2 - return 69 - else - echo "Tuist cache service is unavailable; building without compilation caching." >&2 - echo "Run 'mise exec -- tuist setup cache' to enable it locally." >&2 - cache_settings=( - COMPILATION_CACHE_ENABLE_CACHING=NO - COMPILATION_CACHE_ENABLE_PLUGIN=NO - ) - fi - rm -rf "$result_bundle_path" + # Override remote cache settings from existing generated projects. mise exec -- tuist xcodebuild "$action" \ -resultBundlePath "$result_bundle_path" \ "$@" \ - "${cache_settings[@]}" + COMPILATION_CACHE_ENABLE_CACHING=NO \ + COMPILATION_CACHE_REMOTE_SERVICE_PATH= \ + COMPILATION_CACHE_ENABLE_PLUGIN=NO ) diff --git a/Tuist.swift b/Tuist.swift index 82f67208..1822651a 100644 --- a/Tuist.swift +++ b/Tuist.swift @@ -1,18 +1,20 @@ import ProjectDescription +// Keep remote caches disabled to reduce metered network traffic. let tuist = Tuist( fullHandle: "OpenSwiftUIProject/openattributegraph", xcodeCache: .xcodeCache( - upload: Environment.isCI + upload: false ), project: .tuist( generationOptions: .options( optionalAuthentication: true, - enableCaching: Environment.isCI, + enableCaching: false, manifestEnvironment: [ "OPENSWIFTUI_*", "OPENATTRIBUTEGRAPH_*", ] - ) + ), + cacheOptions: .options(storages: [.local]) ) )