Skip to content

Always include src/scanner.c in Swift package sources#383

Open
iliaskarim wants to merge 1 commit into
tree-sitter:masterfrom
iliaskarim:always-include-scanner
Open

Always include src/scanner.c in Swift package sources#383
iliaskarim wants to merge 1 commit into
tree-sitter:masterfrom
iliaskarim:always-include-scanner

Conversation

@iliaskarim

Copy link
Copy Markdown

Summary

  • Stop probing for src/scanner.c with FileManager at manifest evaluation time.
  • Always list src/parser.c and src/scanner.c in the Swift package sources.

Why

Under Xcode / SwiftPM, Package.swift is often evaluated with a working directory where FileManager.default.fileExists(atPath: "src/scanner.c") returns false, so the external scanner is omitted and linking fails. Consumers work around this with local wrappers that hardcode both files. Listing the sources explicitly fixes the package for SPM clients.

Test plan

  • swift build / Xcode resolve includes scanner symbols from src/scanner.c
  • Package still builds on platforms that previously worked

Made with Cursor

SPM evaluates Package.swift with a cwd where FileManager.fileExists(atPath:) often misses src/scanner.c, so the scanner was dropped and consumers had to wrap the package. List parser.c and scanner.c explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant