Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/xcframework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions Example/Tuist.swift
Original file line number Diff line number Diff line change
@@ -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])
)
)
50 changes: 4 additions & 46 deletions Scripts/Tuist/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() (
Expand All @@ -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
)
8 changes: 5 additions & 3 deletions Tuist.swift
Original file line number Diff line number Diff line change
@@ -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])
)
)
Loading