You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on bazelbuild/rules_python#1789 and am trying to get the deps to use a function rather than a string. From what I can tell, there's no way to pass a non-string as one of the values sent to rule.SetAttr.
It sounds like this might be a feature request, though it's possible I'm just not familiar enough with build-gazelle yet (I've only started updating rules_python about a week or two ago, haha).
I think the solution I'd like to see is to be able to do something like:
// Caveat Emptor: I'm still quite new to Go. Almost all my experience is with python, so// some python idioms might sneak in.typeDepLabelOrFuncstruct {
labelstringisFuncbool
}
func (t*targetBuilder) build() *rule.Rule {
r:=rule.NewRule(t.kind, t.name)
...deps:= []DepLabelOrFunc{
DepLabelOrFunc{"//foo:bar", false},
DepLabelOrFunc{`requirement("boto3")`, true},
}
r.SetAttr("deps", deps) // some magic somewhere looks at isFunc and removes the// surrounding quotes when actually writing the BUILD file.// or r.SetPrivateAttr(config.GazelleImportsKey, deps)returnr
}
Does something like that already exist? If not, then this is a feature request 🙃.
What version of gazelle are you using?
0.33.0
rules_python_gazelle_plugin @ commit da10ac4 (main)
What version of rules_go are you using?
0.41.0
What version of Bazel are you using?
7.0.0
Does this issue reproduce with the latest releases of all the above?
It looks like it, but I'm not 100% sure I'm testing things correctly.
What operating system and processor architecture are you using?
Ubuntu on WSL1 on Windows10, x86_64
What did you do?
I'm working on bazelbuild/rules_python#1789 and am trying to get the deps to use a function rather than a string. From what I can tell, there's no way to pass a non-string as one of the values sent to
rule.SetAttr
.It sounds like this might be a feature request, though it's possible I'm just not familiar enough with
build-gazelle
yet (I've only started updatingrules_python
about a week or two ago, haha).I think the solution I'd like to see is to be able to do something like:
Does something like that already exist? If not, then this is a feature request 🙃.
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: