Skip to content

Commit 42d163f

Browse files
committed
feat(cli): declare rules_js js_binary+js_run_binary for use by orion plugins (#7614)
All rules need to be declared so gazelle knows of them, where they are loaded from, what attributes exist etc. The plugin for the rules_js rules should declare those rules, orion plugins can then generate those rules without re-defining them. --- ### Changes are visible to end-users: yes - Searched for relevant documentation and updated as needed: yes - Breaking change (forces users to change their own code or config): no - Suggested release notes appear below: yes Orion CLI `configure` plugins can generate rules_js/ts rules such as `ts_project`, `js_library`, `js_binary` etc. ### Test plan - Covered by existing test cases - New test cases added GitOrigin-RevId: e28a9d40b081091f4b0216aaaca6c7845f2508c6
1 parent 7263c17 commit 42d163f

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

gazelle/js/kinds.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const (
99
TsProjectKind = "ts_project"
1010
TsProtoLibraryKind = "ts_proto_library"
1111
JsLibraryKind = "js_library"
12+
JsBinaryKind = "js_binary"
13+
JsRunBinaryKind = "js_run_binary"
1214
TsConfigKind = "ts_config"
1315
NpmPackageKind = "npm_package"
1416
NpmLinkAllKind = "npm_link_all_packages"
@@ -52,6 +54,29 @@ var tsKinds = map[string]rule.KindInfo{
5254
"deps": true,
5355
},
5456
},
57+
JsBinaryKind: {
58+
MatchAny: false,
59+
NonEmptyAttrs: map[string]bool{
60+
"entry_point": true,
61+
},
62+
SubstituteAttrs: map[string]bool{},
63+
MergeableAttrs: map[string]bool{},
64+
ResolveAttrs: map[string]bool{
65+
"data": true,
66+
},
67+
},
68+
JsRunBinaryKind: {
69+
MatchAny: false,
70+
NonEmptyAttrs: map[string]bool{
71+
"tool": true,
72+
},
73+
SubstituteAttrs: map[string]bool{},
74+
MergeableAttrs: map[string]bool{},
75+
ResolveAttrs: map[string]bool{
76+
"srcs": true,
77+
"tool": true,
78+
},
79+
},
5580
TsConfigKind: {
5681
NonEmptyAttrs: map[string]bool{
5782
"src": true,
@@ -123,7 +148,7 @@ var tsLoads = []rule.LoadInfo{
123148
{
124149
Name: "@" + RulesJsRepositoryName + "//js:defs.bzl",
125150
Symbols: []string{
126-
JsLibraryKind,
151+
JsLibraryKind, JsBinaryKind, JsRunBinaryKind,
127152
},
128153
},
129154

0 commit comments

Comments
 (0)