fix(build): make source discovery deterministic

debug/ci-class-id-cache
韩天峰 9 hours ago
parent 0ac6dfe499
commit 8c6ea1d14e
  1. 9
      phpunit/src/FileScannerTest.php
  2. 6
      src/Build/FileScanner.php

@ -141,6 +141,15 @@ class FileScannerTest extends TestCase
$scanner = new FileScanner($tmpDir);
$files = $scanner->scan();
$this->assertSame([
$tmpDir . '/helper.c',
$tmpDir . '/lib.m',
$tmpDir . '/main.php',
$tmpDir . '/math.S',
$tmpDir . '/module.cc',
$tmpDir . '/sub/nested.cpp',
], $files);
// Python and Markdown should not be included
$this->assertContains($tmpDir . '/main.php', $files);
$this->assertContains($tmpDir . '/helper.c', $files);

@ -100,6 +100,12 @@ class FileScanner
}
}
// RecursiveDirectoryIterator follows filesystem directory-entry order,
// which differs between a fresh checkout and a long-lived worktree.
// Preparation allocates symbol-cache IDs while visiting this list, so
// keep both generated code and cache classification deterministic.
sort($files, SORT_STRING);
return $files;
}

Loading…
Cancel
Save