Skip to content

Commit 724faa4

Browse files
SONARIAC-2741 Isolate tree-sitter native library extraction per module (#105)
## Summary - Set `tree-sitter-lib` system property per test JVM to isolate native library extraction directories - Each module extracts tree-sitter native libraries to its own `build/tree-sitter-native/` directory - Fixes intermittent `LinkageError` on Windows CI caused by parallel Gradle test JVMs racing to extract the same `.dll` to a shared `~/.tree-sitter/` path ## Context The "QA Windows OS Tests" CI job in sonar-iac-enterprise fails intermittently because Windows locks DLL files while loaded, preventing concurrent extraction by parallel test JVMs. Linux is unaffected because `.so` files are not locked on disk. tree-sitter-ng's `NativeUtils.getLibStorePath()` checks `System.getProperty("tree-sitter-lib")` first, falling back to `${user.home}/.tree-sitter`. By setting this property per module, each test JVM gets its own extraction path. ## Test plan - [x] shell and docker tests pass locally when run in parallel - [x] Verified separate extraction: `shell/build/tree-sitter-native/lib/` and `docker/build/tree-sitter-native/lib/` each contain their own `.dll` copies - [ ] Windows CI no longer fails intermittently 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f029d6a commit 724faa4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gradle-modules/src/main/kotlin/org.sonarsource.cloud-native.java-conventions.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ tasks.withType<Javadoc> {
4545
tasks.withType<Test> {
4646
useJUnitPlatform()
4747

48+
// Each module gets its own tree-sitter native library extraction directory.
49+
// Without this, parallel Gradle test JVMs race to extract the same .dll to ${user.home}/.tree-sitter/,
50+
// which causes LinkageError on Windows due to file locking (SONARIAC-2741).
51+
systemProperty("tree-sitter-lib", layout.buildDirectory.dir("tree-sitter-native").get().asFile.absolutePath)
52+
4853
testLogging {
4954
// log the full stack trace (default is the 1st line of the stack trace)
5055
exceptionFormat = TestExceptionFormat.FULL

0 commit comments

Comments
 (0)