Skip to content

Commit 66f97c7

Browse files
committed
make: skip translations fetch on any dist/, drop src/translations gate
The previous skip clause required both `dist/` to exist *and* `src/translations/` to be populated. The second condition was meant to guard against a stale `dist/` paired with an empty `src/translations/` silently producing a no-translations rebuild on `REFRESH_JS_BUILD=1`. In practice the defence cost more than it saved: every downstream CI job consuming `dist.tar.gz` (which never includes `src/translations/`) hit the fallback branch and re-fetched all ~50 locales, only to discard the result when `build`'s recipe short-circuited on existing `dist/`. The legitimate "I want fresh translations" workflow already has an explicit path (`REFRESH_L10N=1`) that bypasses the dist check, and `make prep-translations` direct-invocation still forces a fetch. Per code review: #513 (comment)
1 parent 825a86c commit 66f97c7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,24 @@ npm-dependencies: ## Install npm dependencies
4747

4848
.PHONY: prep-translations
4949
prep-translations: ## Fetch and cache locale string files
50-
# Skip when `dist/` already exists *and* `src/translations/` is
51-
# populated — translations are baked into the bundle at JS build time,
52-
# so there is nothing for a downstream consumer to refresh until the
53-
# bundle itself is rebuilt. This matters on CI agents that download
54-
# `dist.tar.gz` from an upstream job: without it, every downstream
55-
# `make` target that depends on `build` would re-fetch all ~50 locales
56-
# from translate.wordpress.org.
50+
# Skip when `dist/` already exists translations are baked into the
51+
# bundle at JS build time, so there is nothing for a downstream
52+
# consumer to refresh until the bundle itself is rebuilt. This matters
53+
# on CI agents that download `dist.tar.gz` from an upstream job:
54+
# without it, every downstream `make` target that depends on `build`
55+
# would re-fetch all ~50 locales from translate.wordpress.org only to
56+
# discard the result when `build`'s recipe short-circuits.
5757
#
58-
# We also require `src/translations/` to be populated so that a stale
59-
# `dist/` paired with an empty `src/translations/` doesn't silently
60-
# produce a no-translations rebuild when `REFRESH_JS_BUILD=1` or a
61-
# direct `make build` triggers JS rebuilding against empty inputs.
58+
# Use `REFRESH_L10N=1` (which still forces the fetch) for the explicit
59+
# "I want fresh translations on disk" workflow — `rm -rf
60+
# src/translations && make build` alone will not refetch, since `dist/`
61+
# being present is read as "translations already shipped".
6262
#
6363
# Otherwise, skip unless...
6464
# - src/translations doesn't contain any fetched bundles (only `.gitkeep` is committed)
6565
# - REFRESH_L10N is set to true or 1
6666
# - prep-translations was invoked directly
67-
@if [ -d "dist" ] && [ -n "$$(find src/translations -maxdepth 1 -name '*.json' -print -quit 2>/dev/null)" ] && [ "$(REFRESH_L10N)" != "true" ] && [ "$(REFRESH_L10N)" != "1" ] && ! echo "$(MAKECMDGOALS)" | grep -q "^prep-translations$$"; then \
67+
@if [ -d "dist" ] && [ "$(REFRESH_L10N)" != "true" ] && [ "$(REFRESH_L10N)" != "1" ] && ! echo "$(MAKECMDGOALS)" | grep -q "^prep-translations$$"; then \
6868
echo "--- :white_check_mark: Skipping translations fetch (dist/ already built, translations baked in). Use REFRESH_L10N=1 to force refresh."; \
6969
elif [ -z "$$(find src/translations -maxdepth 1 -name '*.json' -print -quit 2>/dev/null)" ] || [ "$(REFRESH_L10N)" = "true" ] || [ "$(REFRESH_L10N)" = "1" ] || echo "$(MAKECMDGOALS)" | grep -q "^prep-translations$$"; then \
7070
echo "--- :npm: Preparing Translations"; \

0 commit comments

Comments
 (0)