Skip to content

Commit 1a648de

Browse files
(GH-1153) Move tree-sitter subprojects into grammars folder
This change moves the tree-sitter subprojects, which define grammars, into the `grammars` folder. This makes discovering which projects provide DSC grammars easier, instead of relying on the `tree-sitter-` prefix convention. This change does not rename the folders, it only moves them. This change doesn't require modifying any code or cargo manifests, except for pointing to the correct path in the build script and virtual workspace manifest. This change also updates the `.gitignore` to generically ignore generated grammar files in the `grammars` folder.
1 parent 7eab2c2 commit 1a648de

23 files changed

+20
-20
lines changed

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ bin/
66
# Node.js generated files for tree-sitter
77
build/
88
node_modules/
9-
tree-sitter-dscexpression/bindings/
10-
tree-sitter-dscexpression/src/
11-
tree-sitter-dscexpression/parser.*
9+
grammars/**/bindings/
10+
grammars/**/src/
11+
grammars/**/parser.*

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ members = [
1717
"resources/sshdconfig",
1818
"tools/dsctest",
1919
"tools/test_group_resource",
20-
"tree-sitter-dscexpression",
21-
"tree-sitter-ssh-server-config",
20+
"grammars/tree-sitter-dscexpression",
21+
"grammars/tree-sitter-ssh-server-config",
2222
"y2j"
2323
]
2424
# This value is modified by the `Set-DefaultWorkspaceMember` helper.
@@ -39,8 +39,8 @@ default-members = [
3939
"resources/sshdconfig",
4040
"tools/dsctest",
4141
"tools/test_group_resource",
42-
"tree-sitter-dscexpression",
43-
"tree-sitter-ssh-server-config",
42+
"grammars/tree-sitter-dscexpression",
43+
"grammars/tree-sitter-ssh-server-config",
4444
"y2j"
4545
]
4646

@@ -63,8 +63,8 @@ Windows = [
6363
"resources/sshdconfig",
6464
"tools/dsctest",
6565
"tools/test_group_resource",
66-
"tree-sitter-dscexpression",
67-
"tree-sitter-ssh-server-config",
66+
"grammars/tree-sitter-dscexpression",
67+
"grammars/tree-sitter-ssh-server-config",
6868
"y2j"
6969
]
7070
macOS = [
@@ -79,8 +79,8 @@ macOS = [
7979
"resources/sshdconfig",
8080
"tools/dsctest",
8181
"tools/test_group_resource",
82-
"tree-sitter-dscexpression",
83-
"tree-sitter-ssh-server-config",
82+
"grammars/tree-sitter-dscexpression",
83+
"grammars/tree-sitter-ssh-server-config",
8484
"y2j"
8585
]
8686
Linux = [
@@ -95,8 +95,8 @@ Linux = [
9595
"resources/sshdconfig",
9696
"tools/dsctest",
9797
"tools/test_group_resource",
98-
"tree-sitter-dscexpression",
99-
"tree-sitter-ssh-server-config",
98+
"grammars/tree-sitter-dscexpression",
99+
"grammars/tree-sitter-ssh-server-config",
100100
"y2j"
101101
]
102102

@@ -206,6 +206,6 @@ static_vcruntime = { version = "2.0" }
206206
dsc_lib = { path = "lib/dsc_lib" }
207207
osinfo_lib = { path = "lib/osinfo_lib" }
208208
security_context_lib = { path = "lib/security_context_lib" }
209-
tree-sitter-dscexpression = { path = "tree-sitter-dscexpression" }
209+
tree-sitter-dscexpression = { path = "grammars/tree-sitter-dscexpression" }
210210
registry_lib = { path = "lib/registry_lib" }
211-
tree-sitter-ssh-server-config = { path = "tree-sitter-ssh-server-config" }
211+
tree-sitter-ssh-server-config = { path = "grammars/tree-sitter-ssh-server-config" }

build.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ if (!$SkipBuild) {
354354
# projects are in dependency order
355355
$projects = @(
356356
".",
357-
"tree-sitter-dscexpression",
358-
"tree-sitter-ssh-server-config",
357+
"grammars/tree-sitter-dscexpression",
358+
"grammars/tree-sitter-ssh-server-config",
359359
"lib/security_context_lib",
360360
"lib/osinfo_lib",
361361
"lib/dsc_lib",
@@ -373,8 +373,8 @@ if (!$SkipBuild) {
373373
"y2j"
374374
)
375375
$pedantic_unclean_projects = @()
376-
$clippy_unclean_projects = @("tree-sitter-dscexpression", "tree-sitter-ssh-server-config")
377-
$skip_test_projects_on_windows = @("tree-sitter-dscexpression", "tree-sitter-ssh-server-config")
376+
$clippy_unclean_projects = @("grammars/tree-sitter-dscexpression", "grammars/tree-sitter-ssh-server-config")
377+
$skip_test_projects_on_windows = @("grammars/tree-sitter-dscexpression", "grammars/tree-sitter-ssh-server-config")
378378

379379
if ($IsWindows) {
380380
$projects += $windows_projects
@@ -397,7 +397,7 @@ if (!$SkipBuild) {
397397
Write-Verbose -Verbose "Current directory is $(Get-Location)"
398398

399399
# check if the project is either tree-sitter-dscexpression or tree-sitter-ssh-server-config
400-
if (($project -eq 'tree-sitter-dscexpression') -or ($project -eq 'tree-sitter-ssh-server-config')) {
400+
if (($project -match 'tree-sitter-dscexpression$') -or ($project -match 'tree-sitter-ssh-server-config$')) {
401401
if ($UpdateLockFile) {
402402
cargo generate-lockfile
403403
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)