Update Build Script to Better Support Multi-Target Packages #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses issues when adding
tree-sitter-markdownand running the build script with it.This tree-sitter features a split parser (essentially two tree-sitters in one repo), one for Markdown and the other for Markdown Inline. Since each parser contains separate highlight and injection files of the same name, the current build script will fail when copying these files.
This PR addresses this by using
swift package dump-packageandjqto get target info. Particularly, the path property of each target and the number of targets.Any single-target packages, output exactly the same.
With
tree-sitter-markdown, the paths go to thetree-sitter-markdownandtree-sitter-markdown-inlinedirectories respectively. These paths become the name of directories created inSources/CodeEditLanguages/Resourcesand copy the correct files over.The are some tree sitters, like
tree-sitter-typescript, that, despite having multiple targets, the path properties for every target points to the root directory. In this case, it is treated as a single-target package.All currently supported languages pass through the build script properly.
I also updated the "Add Language" and "Update Language" documentation to reflect the new dependency on
jq.Related Issues
Checklist