Skip to content

Commit 6f6aaff

Browse files
author
FolderView Plus Test
committed
Translate WSL paths for Windows runtimes
1 parent 46eb735 commit 6f6aaff

6 files changed

Lines changed: 33 additions & 10 deletions

File tree

scripts/dev_finalize.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fvplus::require_commands bash node git
7474
NODE_BIN="$(fvplus::resolve_platform_command node)"
7575

7676
if [[ "${OPEN_FIXTURE}" == true ]]; then
77-
"${NODE_BIN}" scripts/generate_runtime_fixture.mjs
77+
"${NODE_BIN}" "$(fvplus::path_for_command "${NODE_BIN}" "scripts/generate_runtime_fixture.mjs")"
7878
fi
7979

8080
bash scripts/doctor.sh

scripts/install_smoke.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ for required_file in "${REQUIRED_FILES[@]}"; do
156156
done
157157

158158
while IFS= read -r -d '' file; do
159-
"${PHP_BIN}" -l "${file}" >/dev/null
159+
php_target="$(fvplus::path_for_command "${PHP_BIN}" "${file}")"
160+
"${PHP_BIN}" -l "${php_target}" >/dev/null
160161
done < <(find "${PLUGIN_DIR}/server" -type f -name "*.php" -print0)
161162

162163
while IFS= read -r -d '' file; do
163-
"${NODE_BIN}" --check "${file}" >/dev/null
164+
node_target="$(fvplus::path_for_command "${NODE_BIN}" "${file}")"
165+
"${NODE_BIN}" --check "${node_target}" >/dev/null
164166
done < <(find "${PLUGIN_DIR}/scripts" -type f -name "*.js" ! -path "*/scripts/include/*" -print0)
165167

166168
MUTATING_ENDPOINTS=(

scripts/lib.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ fvplus::resolve_platform_command() {
2020
return 1
2121
}
2222

23+
fvplus::path_for_command() {
24+
local command_path="${1:-}"
25+
local target_path="${2:-}"
26+
local normalized_path=""
27+
[[ -n "${target_path}" ]] || return 1
28+
if [[ "${command_path}" == *.exe ]] && command -v wslpath >/dev/null 2>&1; then
29+
normalized_path="${target_path}"
30+
if [[ "${normalized_path}" != /* && ! "${normalized_path}" =~ ^[A-Za-z]:[\\/].* ]]; then
31+
normalized_path="$(realpath -m "${normalized_path}" 2>/dev/null || printf '%s/%s' "$(pwd)" "${normalized_path}")"
32+
fi
33+
wslpath -w "${normalized_path}"
34+
return 0
35+
fi
36+
printf '%s\n' "${target_path}"
37+
}
38+
2339
fvplus::require_commands() {
2440
local missing=()
2541
local cmd

scripts/release_guard.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ if command -v xmllint >/dev/null 2>&1; then
152152
xmllint --noout "${PLG_FILE}"
153153
else
154154
PHP_BIN="$(resolve_php_bin)"
155+
PLG_VALIDATE_PATH="$(fvplus::path_for_command "${PHP_BIN}" "${PLG_FILE}")"
155156
# shellcheck disable=SC2016
156157
"${PHP_BIN}" -r '
157158
libxml_use_internal_errors(true);
@@ -162,7 +163,7 @@ else
162163
fwrite(STDERR, "ERROR: Invalid PLG XML\n");
163164
exit(1);
164165
}
165-
' "${PLG_FILE}"
166+
' "${PLG_VALIDATE_PATH}"
166167
fi
167168

168169
ARCHIVE_FILE="${ARCHIVE_DIR}/folderview.plus-${VERSION}.txz"

scripts/run_ci_suite.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,20 @@ lint_shell_scripts() {
144144
lint_javascript_syntax() {
145145
mapfile -d '' files < <(find src -type f -name "*.js" ! -path "*/scripts/include/*" -print0)
146146
local file=""
147+
local target=""
147148
for file in "${files[@]}"; do
148-
"${NODE_BIN}" --check "${file}"
149+
target="$(fvplus::path_for_command "${NODE_BIN}" "${file}")"
150+
"${NODE_BIN}" --check "${target}"
149151
done
150152
}
151153

152154
lint_php_syntax() {
153155
mapfile -d '' files < <(find src -type f -name "*.php" -print0)
154156
local file=""
157+
local target=""
155158
for file in "${files[@]}"; do
156-
"${PHP_BIN}" -l "${file}"
159+
target="$(fvplus::path_for_command "${PHP_BIN}" "${file}")"
160+
"${PHP_BIN}" -l "${target}"
157161
done
158162
}
159163

@@ -188,8 +192,8 @@ run_lane() {
188192
run_timed_step shellcheck lint_shell_scripts
189193
run_timed_step javascript-syntax lint_javascript_syntax
190194
run_timed_step php-syntax lint_php_syntax
191-
run_timed_step javascript-unused-symbols "${NODE_BIN}" scripts/js_unused_symbols_guard.mjs
192-
run_timed_step php-static-analysis "${PHP_BIN}" scripts/php_unused_helpers_guard.php
195+
run_timed_step javascript-unused-symbols "${NODE_BIN}" "$(fvplus::path_for_command "${NODE_BIN}" "scripts/js_unused_symbols_guard.mjs")"
196+
run_timed_step php-static-analysis "${PHP_BIN}" "$(fvplus::path_for_command "${PHP_BIN}" "scripts/php_unused_helpers_guard.php")"
193197
;;
194198
tests)
195199
run_timed_step node-mobile-tests "${NODE_BIN}" --test tests/mobile-touch-support.test.mjs tests/mobile-regression-guard.test.mjs

tests/versioning-guard.test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ test('shared ci suite centralizes linting, tests, guards, docs metadata, and smo
367367
assert.match(runCiSuite, /NPX_BIN="\$\(fvplus::resolve_platform_command npx\)"/);
368368
assert.match(runCiSuite, /"\$\{NODE_BIN\}" --check/);
369369
assert.match(runCiSuite, /"\$\{PHP_BIN\}" -l/);
370-
assert.match(runCiSuite, /"\$\{NODE_BIN\}" scripts\/js_unused_symbols_guard\.mjs/);
371-
assert.match(runCiSuite, /"\$\{PHP_BIN\}" scripts\/php_unused_helpers_guard\.php/);
370+
assert.match(runCiSuite, /"\$\{NODE_BIN\}" "\$\(fvplus::path_for_command "\$\{NODE_BIN\}" "scripts\/js_unused_symbols_guard\.mjs"\)"/);
371+
assert.match(runCiSuite, /"\$\{PHP_BIN\}" "\$\(fvplus::path_for_command "\$\{PHP_BIN\}" "scripts\/php_unused_helpers_guard\.php"\)"/);
372372
assert.match(runCiSuite, /"\$\{NODE_BIN\}" --test tests\/mobile-touch-support\.test\.mjs tests\/mobile-regression-guard\.test\.mjs/);
373373
assert.match(runCiSuite, /"\$\{NODE_BIN\}" --test tests\/\*\.mjs/);
374374
assert.match(runCiSuite, /"\$\{NODE_BIN\}" --test tests\/versioning-guard\.test\.mjs tests\/support-policy-contract\.test\.mjs/);

0 commit comments

Comments
 (0)