-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Metadata
inner class for Language
versioning
#119
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From `CSHARP` to `C_SHARP`
This reverts commit 541d031
This script is intended to trigger at build time, generating a file called `language.properties`. Each file consists of a repetition of three-line sections in the format: ``` tree-sitter.language.{language-name}.url={language-url} tree-sitter.language.{language-name}.sha={language-sha} tree-sitter.language.{language-name}.tag={language-tag} ``` Where `language-url` and `language-sha` are the remote URL and full last commit SHA of the specified language submodule. The `language-tag` is the current Git tag at which the submodule is situated, and it may or may not be present. This information will be used at runtime to inject additional information into `Language` enum values.
We want to ignore the generated language metadata properties file. I've recently come to the realization that generated files should never see a VCS, and this one is no exception. We only have to take care to bind the generation to the correct build step, in order to ensure the file is always picked up for packaging.
Rather than adhering to the format described in 971dc00, I have decided to switch to a more compact format: ``` url.{language-name}={language-url} sha.{language-name}={language-sha} tag.{language-name}={language-tag} ``` This has the added benefit of easier mapping at runtime, as well as more concise filtering by prefix. For instance, if we only need URLs, we need only filter the keys that start with `url`.
Not useful to the average end-user, but will be of great use to us. For this reason, it will remain `private`.
Said instance method fetches the information loaded from the properties file, and compiles it in the `Language#Metadata` wrapper.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR introduces a new data class intended to give users a more accurate representation of the current grammar version at runtime. This is achieved through bundling the Git submodule information into a dedicated
.properties
file, which is then read at runtime.