Skip to content

Commit 1ee5707

Browse files
abueideclaude
andcommitted
refactor(ios): remove redundant shellenv call from init hook
Calling `devbox shellenv` inside a devbox init hook is redundant since we're already in a devbox shell. Keep only the Darwin-specific cleanup (unset standard build vars, set CC/CXX, DEVELOPER_DIR, PATH). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e0637ca commit 1ee5707

1 file changed

Lines changed: 1 addition & 49 deletions

File tree

  • plugins/ios/virtenv/scripts/platform

plugins/ios/virtenv/scripts/platform/core.sh

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -136,45 +136,12 @@ ios_resolve_devbox_bin() {
136136
# Environment Setup
137137
# ============================================================================
138138

139-
# Resolves devbox project bin directory
140-
ios_resolve_devbox_project_bin() {
141-
if [ -n "${DEVBOX_PROJECT_ROOT:-}" ] && [ -d "${DEVBOX_PROJECT_ROOT}/.devbox/bin" ]; then
142-
printf '%s\n' "${DEVBOX_PROJECT_ROOT}/.devbox/bin"
143-
elif [ -n "${DEVBOX_WD:-}" ] && [ -d "${DEVBOX_WD}/.devbox/bin" ]; then
144-
printf '%s\n' "${DEVBOX_WD}/.devbox/bin"
145-
fi
146-
}
147-
148-
# Resolves devbox config path
149-
ios_resolve_devbox_config() {
150-
if [ -n "${DEVBOX_CONFIG:-}" ] && [ -f "$DEVBOX_CONFIG" ]; then
151-
printf '%s\n' "$DEVBOX_CONFIG"
152-
elif [ -n "${DEVBOX_CONFIG_PATH:-}" ] && [ -f "$DEVBOX_CONFIG_PATH" ]; then
153-
printf '%s\n' "$DEVBOX_CONFIG_PATH"
154-
elif [ -n "${DEVBOX_CONFIG_DIR:-}" ] && [ -f "${DEVBOX_CONFIG_DIR%/}/devbox.json" ]; then
155-
printf '%s\n' "${DEVBOX_CONFIG_DIR%/}/devbox.json"
156-
fi
157-
}
158-
159-
# Setup omit-nix-env for iOS (use system Xcode/tools instead of Nix)
139+
# Setup Darwin environment for iOS (use system Xcode/tools instead of Nix)
160140
devbox_omit_nix_env() {
161141
if [ "${DEVBOX_OMIT_NIX_ENV_APPLIED:-}" = "1" ]; then
162142
return 0
163143
fi
164144

165-
devbox_bin="$(ios_resolve_devbox_bin 2>/dev/null || true)"
166-
if [ -n "$devbox_bin" ]; then
167-
devbox_config_path="$(ios_resolve_devbox_config)"
168-
if [ -n "$devbox_config_path" ]; then
169-
eval "$("$devbox_bin" --config "$devbox_config_path" shellenv --install --no-refresh-alias --omit-nix-env=true)"
170-
else
171-
eval "$("$devbox_bin" shellenv --install --no-refresh-alias --omit-nix-env=true)"
172-
fi
173-
else
174-
ios_log_debug "devbox not found; skipping shellenv eval (Darwin cleanup still runs)."
175-
fi
176-
177-
# Darwin cleanup — runs unconditionally (even if devbox binary not found)
178145
if [ "$(uname -s)" = "Darwin" ]; then
179146
# Unset standard build variables that Xcode tools read
180147
unset LD LDFLAGS CFLAGS
@@ -197,21 +164,6 @@ devbox_omit_nix_env() {
197164
unset SDKROOT
198165
fi
199166

200-
# Re-add devbox paths to PATH
201-
devbox_init_path="${DEVBOX_INIT_PATH:-}"
202-
if [ -n "$devbox_init_path" ]; then
203-
PATH="${devbox_init_path}:${PATH}"
204-
fi
205-
if [ -n "$devbox_bin" ]; then
206-
PATH="$(dirname "$devbox_bin"):${PATH}"
207-
fi
208-
devbox_project_bin="$(ios_resolve_devbox_project_bin)"
209-
if [ -n "$devbox_project_bin" ]; then
210-
PATH="${devbox_project_bin}:${PATH}"
211-
fi
212-
export PATH
213-
214-
# Flag set AFTER all cleanup succeeds
215167
export DEVBOX_OMIT_NIX_ENV_APPLIED=1
216168
}
217169

0 commit comments

Comments
 (0)