Skip to content

Commit f232555

Browse files
committed
Map Ninja producers using declared output paths
1 parent 95e3bd3 commit f232555

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎scripts/ci_verify.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ def register(raw: str, target: str, directory: Path) -> None:
12161216
if ninja.is_file():
12171217
text = re.sub(r'\$\r?\n[ \t]*', '', ninja.read_text())
12181218
for edge in re.finditer(
1219-
r'(?m)^build .+: [^\s:]*_LINKER__[^\s:]+[^\n]*\n'
1219+
r'(?m)^build (?P<outputs>(?:\$[^\n]|[^$:\n])+): [^\s:]*_LINKER__[^\s:]+[^\n]*\n'
12201220
r'(?P<bindings>(?:[ \t]+[^\n]*\n|\n)*)', text):
12211221
bindings = edge['bindings']
12221222
directory = re.search(r'(?m)^ OBJECT_DIR = (.+)$', bindings)
@@ -1236,7 +1236,11 @@ def escaped(match: re.Match) -> str:
12361236
match = OBJECT_DIR.search(object_dir.as_posix() + '/')
12371237
if match is None or object_dir.resolve() not in active:
12381238
raise ValueError(f'generated Ninja link edge has no active CMake target: {directory[1]}')
1239-
register(literal(product[1]), match[1], root)
1239+
# TARGET_FILE is a shell fragment; declared edge outputs instead
1240+
# use Ninja path escapes, including $ spaces within a path.
1241+
for output in re.findall(r'(?:\$[^\n]|[^ \t$])+|\$', edge['outputs']):
1242+
if output != '|': # Ninja's implicit-output separator.
1243+
register(literal(output), match[1], root)
12401244
else:
12411245
for directory in sorted(active):
12421246
link = directory / 'link.txt'

0 commit comments

Comments
 (0)