github.com/bazelbuild/bazel-gazelle@v0.36.1-0.20240520142334-61b277ba6fed/rule/types.go (about) 1 /* Copyright 2018 The Bazel Authors. All rights reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package rule 17 18 // LoadInfo describes a file that Gazelle knows about and the symbols 19 // it defines. 20 type LoadInfo struct { 21 Name string 22 Symbols []string 23 After []string 24 } 25 26 // KindInfo stores metadata for a kind of rule, for example, "go_library". 27 type KindInfo struct { 28 // MatchAny is true if a rule of this kind may be matched with any rule 29 // of the same kind, regardless of attributes, if exactly one rule is 30 // present a build file. 31 MatchAny bool 32 33 // MatchAttrs is a list of attributes used in matching. For example, 34 // for go_library, this list contains "importpath". Attributes are matched 35 // in order. 36 MatchAttrs []string 37 38 // NonEmptyAttrs is a set of attributes that, if present, disqualify a rule 39 // from being deleted after merge. 40 NonEmptyAttrs map[string]bool 41 42 // SubstituteAttrs is a set of attributes that should be substituted 43 // after matching and before merging. For example, suppose generated rule A 44 // references B via an "embed" attribute, and B matches against rule C. 45 // The label for B in A's "embed" must be substituted with a label for C. 46 // "embed" would need to be in this set. 47 SubstituteAttrs map[string]bool 48 49 // MergeableAttrs is a set of attributes that should be merged before 50 // dependency resolution. See rule.Merge. 51 MergeableAttrs map[string]bool 52 53 // ResolveAttrs is a set of attributes that should be merged after 54 // dependency resolution. See rule.Merge. 55 ResolveAttrs map[string]bool 56 }