Repository navigation
build(meson): normalize -I paths to absolute forward-slash form (#2328) - #2332
Conversation
📝 WalkthroughWalkthroughCentralizes and normalizes Meson-generated absolute include paths (forward-slash Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
ci/meson/shared/meson.build (1)
41-48: Use.replace()for cleaner forward-slash normalization.
meson.project_source_root() / '.'normalizes to forward slashes on Windows but doesn't collapse the trailing., resulting in paths likeC:/Users/.../FastLED/.and downstream-Iflags like-IC:/Users/.../FastLED/./src. While still absolute and forward-slash-only (satisfying the invariant), the embedded/./is cosmetically noisy incompile_commands.jsonand compiler diagnostics. Since every consumer derives frompath_norm_root, consistency is preserved regardless.Using
.replace('\\', '/')directly produces a literally normalized path without the/./segment:♻️ Proposed refactor
-path_norm_root = meson.project_source_root() / '.' +path_norm_root = meson.project_source_root().replace('\\', '/')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ci/meson/shared/meson.build` around lines 41 - 48, path_norm_root currently uses meson.project_source_root() / '.' which yields a trailing "/." on some platforms; change it to call .replace('\\', '/') on meson.project_source_root() (e.g., path_norm_root = meson.project_source_root().replace('\\', '/')) so the root is a clean forward-slash-normalized string, and keep the existing derived constants path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub concatenating '-I' with that normalized path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/tests/test_meson_include_paths.py`:
- Around line 112-124: The _is_absolute_forward_slash function currently treats
paths with dot-segments (e.g. C:/repo/./src or /repo/../repo/src) as absolute;
update it to reject any path that contains dot-segments by checking for '/.' or
'/..' segments after verifying there are no backslashes and it is absolute.
Specifically, inside _is_absolute_forward_slash add a check (after the existing
absolute checks) that splits the path on '/' or uses a regex like
r'(^|/)\.(\Z|/)|(^|/)\.\.(\Z|/)' to detect '.' or '..' path components and
return False if found; keep the existing drive-letter check (re.match(...)),
POSIX check (path.startswith('/')), and the initial backslash guard.
- Around line 31-41: Replace the hard-coded _MESON_BUILD_DIRS list with a
dynamic glob that enumerates BUILD.glob("meson*") (or equivalent) and filter for
directories that actually contain compile_commands.json; then change the test
skip logic so that if running under CI (detect via os.environ.get("CI") or
pytest.config) and no compile DBs are found the test fails (pytest.fail or raise
AssertionError) while only allowing a developer-friendly pytest.skip outside CI;
apply the same change to the other static list/logic referenced around lines
191-205 so both uses use the glob + CI-fail behavior.
- Line 47: The current _I_FLAG_RE approach rebuilds the command string and
misses split forms like ["-I", "../bad\\path"] or "-I ../bad\\path"; update the
parser in test_meson_include_paths.py to detect -I when the command is already
split (i.e., look for list elements equal to "-I" and take the next element) and
combine both detection modes instead of relying solely on _I_FLAG_RE; when you
need to reconstruct commands for assertions, use subprocess.list2cmdline() per
guidelines rather than " ".join so all argument quoting/escaping is preserved
(apply the same fix to the other occurrence around lines 85-92).
- Around line 101-104: The Meson `.p` whitelist is being applied to any path
ending with `.p`, including absolute paths; update the check around
_MESON_P_SCRATCH_RE so it only matches relative Meson scratch dirs by first
rejecting absolute paths (e.g. after normalizing with norm =
include_path.replace("\\", "/").rstrip("/"), ensure norm is not absolute: not
starting with '/' and not matching Windows drive-letter patterns like
'^[A-Za-z]:/'). Only if the path is relative should you then apply
_MESON_P_SCRATCH_RE and return True.
---
Nitpick comments:
In `@ci/meson/shared/meson.build`:
- Around line 41-48: path_norm_root currently uses meson.project_source_root() /
'.' which yields a trailing "/." on some platforms; change it to call
.replace('\\', '/') on meson.project_source_root() (e.g., path_norm_root =
meson.project_source_root().replace('\\', '/')) so the root is a clean
forward-slash-normalized string, and keep the existing derived constants
path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub
concatenating '-I' with that normalized path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3b4435ef-1c23-4716-b982-3babf768984c
📒 Files selected for processing (9)
ci/meson/native/meson.buildci/meson/shared/meson.buildci/meson/wasm/meson.buildci/tests/test_meson_include_paths.pyexamples/meson.buildmeson.buildsrc/fl/audio/detector/vibe.htests/meson.buildtests/profile/meson.build
| # Directories under .build/ where meson may have written a compile_commands.json. | ||
| # We check whichever ones exist at test time; we do NOT invoke meson setup here | ||
| # (that is done by the `bash test` driver / developer). Test is a no-op if no | ||
| # compile_commands.json files are present, so fresh clones don't fail here. | ||
| _MESON_BUILD_DIRS = [ | ||
| BUILD / "meson", | ||
| BUILD / "meson-quick", | ||
| BUILD / "meson-debug", | ||
| BUILD / "meson-release", | ||
| BUILD / "meson-wasm-quick", | ||
| ] |
There was a problem hiding this comment.
Discover Meson compile DBs dynamically and fail in CI when none are checked.
The fixed list can miss .build/meson-* directories, and the final skip lets CI pass without enforcing this regression if setup changes. Glob the generated compile DBs and only keep the developer-friendly skip outside CI.
Suggested fix
+import os
import json
import re
import unittest
@@
-# Directories under .build/ where meson may have written a compile_commands.json.
-# We check whichever ones exist at test time; we do NOT invoke meson setup here
-# (that is done by the `bash test` driver / developer). Test is a no-op if no
-# compile_commands.json files are present, so fresh clones don't fail here.
-_MESON_BUILD_DIRS = [
- BUILD / "meson",
- BUILD / "meson-quick",
- BUILD / "meson-debug",
- BUILD / "meson-release",
- BUILD / "meson-wasm-quick",
-]
+def _meson_build_dirs() -> list[Path]:
+ """Return Meson build dirs that have a compile_commands.json."""
+ build_dirs: list[Path] = []
+ if not BUILD.exists():
+ return build_dirs
+ for cc_json in sorted(BUILD.glob("meson*/compile_commands.json")):
+ build_dirs.append(cc_json.parent)
+ return build_dirs
@@
"""Check every known meson build dir. Skip any that don't exist yet."""
checked_any = False
- for build_dir in _MESON_BUILD_DIRS:
- if not (build_dir / "compile_commands.json").exists():
- continue
+ for build_dir in _meson_build_dirs():
checked_any = True
with self.subTest(build_dir=build_dir.name):
self._check_build_dir(build_dir)
if not checked_any:
- self.skipTest(
- "No meson compile_commands.json found under .build/; "
- "run `bash test --cpp` first to generate one."
- )
+ message = (
+ "No meson compile_commands.json found under .build/; "
+ "run `bash test --cpp` first to generate one."
+ )
+ if os.environ.get("CI"):
+ self.fail(message)
+ self.skipTest(message)As per coding guidelines, never use silent fallbacks for missing critical resources; always fail fast with descriptive errors.
Also applies to: 191-205
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/tests/test_meson_include_paths.py` around lines 31 - 41, Replace the
hard-coded _MESON_BUILD_DIRS list with a dynamic glob that enumerates
BUILD.glob("meson*") (or equivalent) and filter for directories that actually
contain compile_commands.json; then change the test skip logic so that if
running under CI (detect via os.environ.get("CI") or pytest.config) and no
compile DBs are found the test fails (pytest.fail or raise AssertionError) while
only allowing a developer-friendly pytest.skip outside CI; apply the same change
to the other static list/logic referenced around lines 191-205 so both uses use
the glob + CI-fail behavior.
| # emit tokens wrapped in double-quotes like `"-Ici/foo"` or `"-IC:/foo"` on | ||
| # Windows, so we match between quotes as well as bare -Ifoo. The captured | ||
| # path value never includes the surrounding quotes. | ||
| _I_FLAG_RE = re.compile(r'"-I([^"]+)"|(?<!\S)-I(\S+)') |
There was a problem hiding this comment.
Parse split -I arguments instead of rebuilding the command string.
This misses compile DB entries shaped as ["-I", "../bad\\path"] or command strings like -I ../bad\\path, so the regression test can pass while a non-normalized include remains.
Suggested fix
-_I_FLAG_RE = re.compile(r'"-I([^"]+)"|(?<!\S)-I(\S+)')
+_I_FLAG_RE = re.compile(r'"-I([^"]+)"|(?<!\S)-I(?:\s+"([^"]+)"|\s+(\S+)|(\S+))')
@@
def _extract_includes_from_entry(entry: dict[str, object]) -> list[str]:
"""Extract -I <path> values from a compile_commands.json entry."""
- raw = entry.get("command") or " ".join(entry.get("arguments", [])) # type: ignore[arg-type]
- assert isinstance(raw, str)
out: list[str] = []
+
+ arguments = entry.get("arguments")
+ if isinstance(arguments, list):
+ i = 0
+ while i < len(arguments):
+ arg = arguments[i]
+ assert isinstance(arg, str)
+ if arg == "-I":
+ if i + 1 >= len(arguments):
+ raise AssertionError("compile_commands entry contains '-I' without a path")
+ next_arg = arguments[i + 1]
+ assert isinstance(next_arg, str)
+ out.append(next_arg)
+ i += 2
+ continue
+ if arg.startswith("-I") and len(arg) > 2:
+ out.append(arg[2:])
+ i += 1
+ return out
+
+ raw = entry.get("command")
+ assert isinstance(raw, str)
for m in _I_FLAG_RE.finditer(raw):
- out.append(m.group(1) or m.group(2))
+ for group in m.groups():
+ if group:
+ out.append(group)
+ break
return outAs per coding guidelines, use subprocess.list2cmdline() for all command line construction instead of string join.
Also applies to: 85-92
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/tests/test_meson_include_paths.py` at line 47, The current _I_FLAG_RE
approach rebuilds the command string and misses split forms like ["-I",
"../bad\\path"] or "-I ../bad\\path"; update the parser in
test_meson_include_paths.py to detect -I when the command is already split
(i.e., look for list elements equal to "-I" and take the next element) and
combine both detection modes instead of relying solely on _I_FLAG_RE; when you
need to reconstruct commands for assertions, use subprocess.list2cmdline() per
guidelines rather than " ".join so all argument quoting/escaping is preserved
(apply the same fix to the other occurrence around lines 85-92).
| norm = include_path.replace("\\", "/").rstrip("/") | ||
| # (a) Private per-target scratch dir (contains only .obj files) | ||
| if _MESON_P_SCRATCH_RE.search(norm): | ||
| return True |
There was a problem hiding this comment.
Keep the .p whitelist scoped to relative Meson scratch dirs.
Right now any include ending in .p is ignored, including absolute/backslash paths. Since the comment says these Meson paths are always relative, reject absolute paths before applying this whitelist.
Suggested fix
def _is_meson_auto_include(include_path: str) -> bool:
@@
"""
norm = include_path.replace("\\", "/").rstrip("/")
+ if norm.startswith("/") or re.match(r"^[A-Za-z]:/", norm):
+ return False
# (a) Private per-target scratch dir (contains only .obj files)
if _MESON_P_SCRATCH_RE.search(norm):
return True🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/tests/test_meson_include_paths.py` around lines 101 - 104, The Meson `.p`
whitelist is being applied to any path ending with `.p`, including absolute
paths; update the check around _MESON_P_SCRATCH_RE so it only matches relative
Meson scratch dirs by first rejecting absolute paths (e.g. after normalizing
with norm = include_path.replace("\\", "/").rstrip("/"), ensure norm is not
absolute: not starting with '/' and not matching Windows drive-letter patterns
like '^[A-Za-z]:/'). Only if the path is relative should you then apply
_MESON_P_SCRATCH_RE and return True.
| def _is_absolute_forward_slash(path: str) -> bool: | ||
| """Return True if `path` is absolute (POSIX `/...` or Windows `X:/...`) | ||
| and contains no backslashes. | ||
| """ | ||
| if "\\" in path: | ||
| return False | ||
| # Windows drive letter | ||
| if re.match(r"^[A-Za-z]:/", path): | ||
| return True | ||
| # POSIX absolute | ||
| if path.startswith("/"): | ||
| return True | ||
| return False |
There was a problem hiding this comment.
Reject dot-segment spellings too.
This accepts absolute forward-slash paths like C:/repo/./src or /repo/../repo/src, even though the header comment calls out /./ spelling differences as part of the #pragma once failure mode.
Suggested fix
def _is_absolute_forward_slash(path: str) -> bool:
"""Return True if `path` is absolute (POSIX `/...` or Windows `X:/...`)
and contains no backslashes.
"""
if "\\" in path:
return False
+ parts = path.split("/")
+ if "." in parts or ".." in parts:
+ return False
# Windows drive letter
if re.match(r"^[A-Za-z]:/", path):
return True🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/tests/test_meson_include_paths.py` around lines 112 - 124, The
_is_absolute_forward_slash function currently treats paths with dot-segments
(e.g. C:/repo/./src or /repo/../repo/src) as absolute; update it to reject any
path that contains dot-segments by checking for '/.' or '/..' segments after
verifying there are no backslashes and it is absolute. Specifically, inside
_is_absolute_forward_slash add a check (after the existing absolute checks) that
splits the path on '/' or uses a regex like r'(^|/)\.(\Z|/)|(^|/)\.\.(\Z|/)' to
detect '.' or '..' path components and return False if found; keep the existing
drive-letter check (re.match(...)), POSIX check (path.startswith('/')), and the
initial backslash guard.
On Windows, Meson's `include_directories()` propagates `-I` flags using native backslash + relative-path spellings (e.g. `-I..\..\src\platforms\stub`). Clang keys `#pragma once` deduplication on the raw resolved path string — if the same directory reaches a translation unit via two different spellings (forward slash vs backslash, absolute vs relative), the header appears to be two different files and `#pragma once` is silently defeated, producing double-definition errors (#2324, #2325). This change ensures every `-I` flag we generate is absolute + forward-slash + spelled identically everywhere: * Add canonical `path_norm_*` -I args in ci/meson/shared/meson.build (path_norm_I_root, path_norm_I_src, path_norm_I_tests, path_norm_I_stub). Every consumer meson.build references these instead of redeclaring. * Replace every project-wide `include_directories(...)` consumer (`include_directories: [src_dir, stub_dir, ...]`) with explicit absolute cpp_args. This stops Meson from injecting relative backslash `-I` flags into the propagated compile lines. * For per-example discovered include dirs, build absolute forward-slash `-I` args from the discovered relative path via the `/` operator and the canonical `path_norm_root` prefix, replacing the previous `include_directories(inc_dir_fixed)` call. * Remove the `#ifndef FL_AUDIO_DETECTOR_VIBE_H` belt-and-suspenders guard added in #2325. With all `-I` flags normalized, `#pragma once` alone is sufficient. Verified with `bash test --cpp`: 300/300 tests pass. * Add ci/tests/test_meson_include_paths.py — a CI check that parses `.build/meson*/compile_commands.json` after setup and fails if any non-Meson-auto `-I` flag contains a backslash or is not absolute. Fixes #2328. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
9aaa0ed to
5aee970
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ci/meson/shared/meson.build`:
- Around line 41-45: The path_norm_root currently appends '/.' which creates a
trailing dot and leads to inconsistent -I spellings (path_norm_root =
meson.project_source_root() / '.'); change how path_norm_root is computed so it
does not include the '.' suffix—e.g. use meson.project_source_root() directly or
compute a sentinel subdir then take its parent—so path_norm_I_root ('-I' +
path_norm_root) and related flags (path_norm_I_src, etc.) all produce identical
canonical -I paths and avoid the '/.' variant.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 63ea7508-b6ec-4db8-bb93-9cc6672313c3
📒 Files selected for processing (9)
ci/meson/native/meson.buildci/meson/shared/meson.buildci/meson/wasm/meson.buildci/tests/test_meson_include_paths.pyexamples/meson.buildmeson.buildsrc/fl/audio/detector/vibe.htests/meson.buildtests/profile/meson.build
✅ Files skipped from review due to trivial changes (3)
- ci/meson/native/meson.build
- tests/meson.build
- meson.build
🚧 Files skipped from review as they are similar to previous changes (5)
- src/fl/audio/detector/vibe.h
- tests/profile/meson.build
- ci/meson/wasm/meson.build
- ci/tests/test_meson_include_paths.py
- examples/meson.build
| path_norm_root = meson.project_source_root() / '.' | ||
|
|
||
| # Canonical absolute forward-slash -I args for the four project-wide | ||
| # include roots. Use these everywhere instead of redeclaring. | ||
| path_norm_I_root = '-I' + path_norm_root |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm whether meson's '/' operator collapses a trailing '.' component.
# Also inspect any existing compile_commands.json fixture in the repo for the shape.
fd -t f 'compile_commands.json' | xargs -I{} sh -c 'echo "== {} =="; grep -oE "\-I[^ \"]+" "{}" | sort -u | head -50'
echo "---"
cat ci/tests/test_meson_include_paths.py 2>/dev/null | sed -n '1,120p'Repository: FastLED/FastLED
Length of output: 5002
🏁 Script executed:
cat -n ci/meson/shared/meson.build | sed -n '35,55p'Repository: FastLED/FastLED
Length of output: 898
🏁 Script executed:
# Search for any test or example showing how Meson's '/' operator handles '.'
rg -A 3 -B 3 "project_source_root\(\)" --type mesonRepository: FastLED/FastLED
Length of output: 6232
🏁 Script executed:
# Check for any compile_commands.json files that might show current behavior
find . -type f -name "compile_commands.json" 2>/dev/null | head -5Repository: FastLED/FastLED
Length of output: 41
🏁 Script executed:
# Check if there's any CI output or test results showing what the current code produces
find . -type f \( -name "*.log" -o -name "test_*.py" \) | xargs grep -l "path_norm\|compile_commands" 2>/dev/null | head -10Repository: FastLED/FastLED
Length of output: 144
🏁 Script executed:
# Search for any discussion or references to the trailing '.' behavior in the codebase
rg "/ '\.'" --type meson -B 2 -A 2Repository: FastLED/FastLED
Length of output: 447
🏁 Script executed:
# Check what Meson documentation or inline comments say about path normalization
rg -i "meson.*project_source_root.*\/" --type meson -B 1 -A 1 | head -40Repository: FastLED/FastLED
Length of output: 183
🏁 Script executed:
# Look at how path_norm_root is actually used in the codebase to infer its format
rg "path_norm_root" -B 1 -A 1Repository: FastLED/FastLED
Length of output: 1474
🏁 Script executed:
cat ci/tests/test_meson_include_paths.py | tail -n +60 | head -100Repository: FastLED/FastLED
Length of output: 3733
🏁 Script executed:
# Check if there's any build output or test results
find .build -type f -name "compile_commands.json" 2>/dev/null | head -3 | xargs cat 2>/dev/null | head -50Repository: FastLED/FastLED
Length of output: 41
🏁 Script executed:
# Look at the rest of the test to see what it's actually validating
wc -l ci/tests/test_meson_include_paths.pyRepository: FastLED/FastLED
Length of output: 99
🏁 Script executed:
tail -30 ci/tests/test_meson_include_paths.pyRepository: FastLED/FastLED
Length of output: 1287
🏁 Script executed:
# Now let's understand what the validation actually checks
# The key is whether path_norm_root with '.' will produce a path that fails the validation
python3 << 'EOF'
import re
# Simulate Meson's '/' operator behavior with '.'
# Most path libraries preserve the '.' component in string form
example_root_windows = r"C:\Users\repo"
example_root_posix = "/home/repo"
# When Meson normalizes Windows to forward slashes via '/'
normalized_win = example_root_windows.replace("\\", "/") # "C:/Users/repo"
# Then appends '.'
with_dot_win = normalized_win + "/" + "." # "C:/Users/repo/."
normalized_posix = example_posix_root = "/home/repo"
with_dot_posix = normalized_posix + "/" + "." # "/home/repo/."
# Test if regex for absolute path with forward slashes catches this
absolute_fwd_slash_re = r"^[A-Za-z]:/|^/"
print(f"Windows with dot: {with_dot_win}")
print(f" Matches absolute fwd-slash pattern: {bool(re.match(absolute_fwd_slash_re, with_dot_win))}")
print(f" Contains backslash: {chr(92) in with_dot_win}")
print()
# The key question: Does Meson's '/' operator collapse the '.' or leave it?
# We need to check what the actual behavior is by looking at how it's used
print("Simulating path_norm_I_root construction:")
print(f" '-I' + '{with_dot_win}' = '-I{with_dot_win}'")
print()
print("This would pass the validation if:")
print(" 1. It doesn't contain backslashes ✓")
print(" 2. It's absolute ✓")
print()
print("But the concern is the /. suffix means different spelling from")
print(" '-IC:/Users/repo' (without the /.)")
EOFRepository: FastLED/FastLED
Length of output: 451
🏁 Script executed:
# Let's look for any Meson documentation or real behavior test
# Check if there's a way Meson actually handles the '/' operator
rg -i "meson.*build.*string\|path.*concat" docs/ 2>/dev/null | head -20Repository: FastLED/FastLED
Length of output: 41
🏁 Script executed:
# Check if path_norm_I_root is actually used or exported in a way that could affect compilation
rg "path_norm_I_root[^_]" --type meson -B 1 -A 1Repository: FastLED/FastLED
Length of output: 1576
🏁 Script executed:
# Check if the root path is ever used without the '/' subpath
rg "path_norm_root\s*[^/]" --type meson -B 1 -A 1 | head -30Repository: FastLED/FastLED
Length of output: 1384
🏁 Script executed:
# Verify: Does the use pattern show that path_norm_root is ONLY used via path_norm_I_*?
rg "path_norm_I_" --type meson | wc -lRepository: FastLED/FastLED
Length of output: 61
🏁 Script executed:
# Check the actual behavior by seeing how these are exported/used across files
rg "path_norm_I_root\b" --type mesonRepository: FastLED/FastLED
Length of output: 686
Trailing /. in path_norm_I_root creates inconsistent spelling across -I flags.
path_norm_root = meson.project_source_root() / '.' results in a path ending with /. (e.g., C:/Users/.../repo/.). When used directly in path_norm_I_root = '-I' + path_norm_root, this produces -IC:/Users/.../repo/., which is a different spelling from the root without the suffix. Other uses like path_norm_I_src = '-I' + path_norm_root / 'src' overwrite the trailing /. with a subdirectory, resulting in identical -IC:/.../repo/src. This spelling inconsistency contradicts the comment's stated goal to use these "everywhere instead of redeclaring" and being "spelled identically everywhere"—and risks defeating #pragma once deduplication if the same header is reached via both -IC:/repo and -IC:/repo/..
Compute path_norm_root without the . suffix so all four -I flags maintain consistent spelling. For example, join with a sentinel subdir, then remove it; or refactor to avoid the need for a normalization trick altogether.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@ci/meson/shared/meson.build` around lines 41 - 45, The path_norm_root
currently appends '/.' which creates a trailing dot and leads to inconsistent -I
spellings (path_norm_root = meson.project_source_root() / '.'); change how
path_norm_root is computed so it does not include the '.' suffix—e.g. use
meson.project_source_root() directly or compute a sentinel subdir then take its
parent—so path_norm_I_root ('-I' + path_norm_root) and related flags
(path_norm_I_src, etc.) all produce identical canonical -I paths and avoid the
'/.' variant.
… path The esbuild alias `three=./vendor/three/three.module.js` and the direct relative imports in app.ts and fastled_background_worker.ts (both of which use `./vendor/three/build/three.module.js`) both pointed at paths that were never populated — the original vendor commit 7d5bb4e committed only `vendor/three/examples/jsm/` and missed the runtime module. Every WASM CI build has been failing at the esbuild step with "Could not resolve ./vendor/three/three.module.js". Fixes by: - Committing three.module.js (three.js v0.170.0, MIT) under vendor/three/build/, matching the actual import paths. - Adding an unignore rule so vendor/three/build/ isn't swept by the project-wide build/ ignore (follows the existing precedent for !src/fl/build/). - Updating the esbuild alias to the same path so bare `three` imports from examples/jsm files resolve to the identical module instance as the direct relative imports (no double-bundle). - Vendoring LICENSE alongside for attribution. Verified locally: bash compile wasm --examples AudioUrl now produces fastled.js + fastled.wasm + index.html (previously the final esbuild step failed, leaving those artifacts missing and breaking the "Check for required artifacts" step in build.yml). Unblocks CI for #2331, #2332, #2335, and every future PR. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Fixes #2328. On Windows, Meson's
include_directories()propagates-Iflags using native backslash + relative-path spellings (e.g.-I..\..\src\platforms\stub). Clang keys#pragma oncededuplication on the raw resolved path string — if the same directory reaches a TU via two different spellings, the header appears to be two different files and#pragma onceis silently defeated, producing double-definition errors (this is what caused #2324 / #2325 — the vibe.h double-definition that was papered over with a manual#ifndefguard).This change makes every
-Iflag we generate be absolute + forward-slash + spelled identically everywhere.path_norm_*-Iargs inci/meson/shared/meson.build— every consumermeson.buildreferences these instead of redeclaring.include_directories(...)consumer with explicit absolutecpp_args. Stops Meson from injecting relative backslash-Iflags into propagated compile lines.path_norm_root / <rel>instead ofinclude_directories(inc_dir_fixed).#ifndef FL_AUDIO_DETECTOR_VIBE_Hbelt-and-suspenders guard added in fix(audio): add #ifndef guards to vibe.h for PCH-safe inclusion #2325 — verified withbash test --cpp: 300/300 tests pass.ci/tests/test_meson_include_paths.pyparses.build/meson*/compile_commands.jsonafter setup and fails if any non-Meson-auto-Iflag contains a backslash or is not absolute.Before / after (compile_commands.json on Windows)
Before — 346 distinct backslash
-Iflags, e.g.:After — all our own
-Iflags are absolute forward-slash:(Meson still auto-injects a handful of
-I<subdir>/-I<target>.pflags that reference private scratch dirs and source subdirs. These are empty of user headers and can't defeat#pragma oncebecause our canonical absolute paths resolve first during header search. The CI check whitelists exactly these Meson-internal shapes.)Test plan
bash test --cpp— 300/300 pass with vibe.h guard removedbash lint— all linters passuv run pytest ci/tests/test_meson_include_paths.py -v— passes against current.build/meson-quick+.build/meson-wasm-quick..\..\src,..\..\src\fl, etc.) in a unit checkFiles changed
ci/meson/shared/meson.buildpath_norm_root+path_norm_I_{root,src,tests,stub}ci/meson/native/meson.buildpath_norm_I_*instead of inline absolute pathsci/meson/wasm/meson.buildpath_norm_I_*meson.build(root)include_directories()objectstests/meson.buildrunner_exe+ test PCH use absolutecpp_args-Iexamples/meson.buildexample_runner_exe+ per-example DLLs use absolutecpp_args-Itests/profile/meson.buildcpp_args-Isrc/fl/audio/detector/vibe.h#ifndef FL_AUDIO_DETECTOR_VIBE_Hguardci/tests/test_meson_include_paths.py-IflagsRun the new check directly with:
Generated with Claude Code
Summary by CodeRabbit