_id
stringlengths
2
7
text
stringlengths
6
2.61k
title
stringclasses
1 value
c178300
// Save writes the build file to disk. This method calls Sync internally.
c178301
// HasDefaultVisibility returns whether the File contains a "package" rule with // a "default_visibility" attribute. Rules generated by Gazelle should not // have their own visibility attributes if this is the case.
c178302
// NewLoad creates a new, empty load statement for the given file name.
c178303
// Symbols returns a list of symbols this statement loads.
c178304
// Has returns true if sym is loaded by this statement.
c178305
// Add inserts a new symbol into the load statement. This has no effect if // the symbol is already loaded. Symbols will be sorted, so the order // doesn't matter.
c178306
// Remove deletes a symbol from the load statement. This has no effect if // the symbol is not loaded.
c178307
// Insert marks this statement for insertion at the given index. If multiple // statements are inserted at the same index, they will be inserted in the // order Insert is called.
c178308
// NewRule creates a new, empty rule with the given kind and name.
c178309
// SetKind changes the kind of rule this is.
c178310
// AttrKeys returns a sorted list of attribute keys used in this rule.
c178311
// Attr returns the value of the named attribute. nil is returned when the // attribute is not set.
c178312
// AttrString returns the value of the named attribute if it is a scalar string. // "" is returned if the attribute is not set or is not a string.
c178313
// AttrStrings returns the string values of an attribute if it is a list. // nil is returned if the attribute is not set or is not a list. Non-string // values within the list won't be returned.
c178314
// DelAttr removes the named attribute from the rule.
c178315
// SetAttr adds or replaces the named attribute with an expression produced // by ExprFromValue.
c178316
// PrivateAttrKeys returns a sorted list of private attribute names.
c178317
// SetPrivateAttr associates a value with a key. Unlike SetAttr, this value // is not converted to a build syntax tree and will not be written to a build // file.
c178318
// Insert marks this statement for insertion at the end of the file. Multiple // statements will be inserted in the order Insert is called.
c178319
// IsEmpty returns true when the rule contains none of the attributes in attrs // for its kind. attrs should contain attributes that make the rule buildable // like srcs or deps and not descriptive attributes like name or visibility.
c178320
// CheckInternalVisibility overrides the given visibility if the package is // internal.
c178321
// New constructs a new label from components.
c178322
// Rel attempts to compute a relative label from this label. If this label // is already relative or is in a different package, this label may be // returned unchanged.
c178323
// Equal returns whether two labels are exactly the same. It does not return // true for different labels that refer to the same target.
c178324
// Contains returns whether other is contained by the package of l or a // sub-package. Neither label may be relative.
c178325
// // Process -go_googleapis case //
c178326
// shouldCall returns true if Walk should call the callback in the // directory rel.
c178327
// shouldUpdate returns true if Walk should pass true to the callback's update // parameter in the directory rel. This indicates the build file should be // updated.
c178328
// shouldVisit returns true if Walk should visit the subdirectory rel.
c178329
// SquashRules copies information from src into dst without discarding // information in dst. SquashRules detects duplicate elements in lists and // dictionaries, but it doesn't sort elements after squashing. If squashing // fails because the expression is not understood, an error is returned, // and neither rule is mo...
c178330
// runClient performs the main work of the client. It attempts to connect // to the server via a UNIX-domain socket. If the server is not running, // it starts the server and tries again. The server does all the work, so // the client just waits for the server to complete, then exits.
c178331
// UpdateRepo returns an object describing a repository at the most recent // commit or version tag. // // This function uses RemoteCache to retrieve information about the repository. // Depending on how the RemoteCache was initialized and used earlier, some // information may already be locally available. Frequently t...
c178332
// NewRemoteCache creates a new RemoteCache with a set of known repositories. // The Root and Remote methods will return information about repositories listed // here without accessing the network. However, the Head method will still // access the network for these repositories to retrieve information about new // vers...
c178333
// Remote returns the VCS name and the remote URL for a repository with the // given root import path. This is suitable for creating new repository rules.
c178334
// get retrieves a value associated with the given key from the cache. ok will // be true if the key exists in the cache, even if it's in the process of // being fetched.
c178335
// ensure retreives a value associated with the given key from the cache. If // the key does not exist in the cache, the load function will be called, // and its result will be associated with the key. The load function will not // be called more than once for any key.
c178336
// RelBaseName returns the base name for rel, a slash-separated path relative // to the repository root. If rel is empty, RelBaseName returns the base name // of prefix. If prefix is empty, RelBaseName returns the base name of root, // the absolute file path of the repository root directory. If that's empty // to, then...
c178337
// Clone creates a copy of the configuration for use in a subdirectory. // Note that the Exts map is copied, but its contents are not. // Configurer.Configure should do this, if needed.
c178338
// IsValidBuildFileName returns true if a file with the given base name // should be treated as a build file.
c178339
// check returns true if at least one of the tag groups is satisfied.
c178340
// fileNameInfo returns information that can be inferred from the name of // a file. It does not read data from the file.
c178341
// otherFileInfo returns information about a non-.go file. It will parse // part of the file to determine build tags. If the file can't be read, an // error will be logged, and partial information will be returned.
c178342
// protoFileInfo extracts metadata from a proto file. The proto extension // already "parses" these and stores metadata in proto.FileInfo, so this is // just processing relevant options.
c178343
// AddRule adds a rule r to the index. The rule will only be indexed if there // is a known resolver for the rule's kind and Resolver.Imports returns a // non-nil slice. // // AddRule may only be called before Finish.
c178344
// Finish constructs the import index and performs any other necessary indexing // actions after all rules have been added. This step is necessary because // a rule may be indexed differently based on what rules are added later. // // Finish must be called after all AddRule calls and before any // FindRulesByImport cal...
c178345
// buildImportIndex constructs the map used by FindRulesByImport.
c178346
// IsSelfImport returns true if the result's label matches the given label // or the result's rule transitively embeds the rule with the given label. // Self imports cause cyclic dependencies, so the caller may want to omit // the dependency or report an error.
c178347
// applyKindMappings returns a copy of LoadInfo that includes c.KindMap.
c178348
// appendOrMergeKindMapping adds LoadInfo for the given replacement.
c178349
// RuleName returns a name for a proto_library derived from the given strings. // For each string, RuleName will look for a non-empty suffix of identifier // characters and then append "_proto" to that.
c178350
// buildPackage extracts metadata from the .proto files in a directory and // constructs possibly several packages, then selects a package to generate // a proto_library rule for.
c178351
// selectPackage chooses a package to generate rules for.
c178352
// generateProto creates a new proto_library rule for a package. The rule may // be empty if there are no sources.
c178353
// generateEmpty generates a list of proto_library rules that may be deleted. // This is generated from existing proto_library rules with srcs lists that // don't match any static or generated files.
c178354
// ImportRepoRules reads the lock file of a vendoring tool and returns // a list of equivalent repository rules that can be merged into a WORKSPACE // file. The format of the file is inferred from its basename.
c178355
// MergeRules merges a list of generated repo rules with the already defined repo rules, // and then updates each rule's underlying file. If the generated rule matches an existing // one, then it inherits the file where the existing rule was defined. If the rule is new then // its file is set as the destFile parameter....
c178356
// GenerateRule returns a repository rule for the given repository that can // be written in a WORKSPACE file.
c178357
// FindExternalRepo attempts to locate the directory where Bazel has fetched // the external repository with the given name. An error is returned if the // repository directory cannot be located.
c178358
// ListRepositories extracts metadata about repositories declared in a // file.
c178359
// migrateLibraryEmbed converts "library" attributes to "embed" attributes, // preserving comments. This only applies to Go rules, and only if there is // no keep comment on "library" and no existing "embed" attribute.
c178360
// migrateGrpcCompilers converts "go_grpc_library" rules into "go_proto_library" // rules with a "compilers" attribute.
c178361
// squashCgoLibrary removes cgo_library rules with the default name and // merges their attributes with go_library with the default name. If no // go_library rule exists, a new one will be created. // // Note that the library attribute is disregarded, so cgo_library and // go_library attributes will be squashed even if...
c178362
// removeLegacyProto removes uses of the old proto rules. It deletes loads // from go_proto_library.bzl. It deletes proto filegroups. It removes // go_proto_library attributes which are no longer recognized. New rules // are generated in place of the deleted rules, but attributes and comments // are not migrated.
c178363
// removeLegacyGazelle removes loads of the "gazelle" macro from // @io_bazel_rules_go//go:def.bzl. The definition has moved to // @bazel_gazelle//:def.bzl, and the old one will be deleted soon.
c178364
// selectPackages selects one Go packages out of the buildable packages found // in a directory. If multiple packages are found, it returns the package // whose name matches the directory if such a package exists.
c178365
// AddBuiltin registers a builtin kind with its info.
c178366
// MappedKind records the fact that the given mapping was applied while // processing the given package.
c178367
// Resolver returns a resolver for the given rule and package, and a bool // indicating whether one was found. Empty string may be passed for pkgRel, // which results in consulting the builtin kinds only.
c178368
// sortExprLabels sorts lists of strings using the same order as buildifier. // Buildifier also sorts string lists, but not those involved with "select" // expressions. This function is intended to be used with bzl.Walk.
c178369
// checkRulesGoVersion checks whether a compatible version of rules_go is // being used in the workspace. A message will be logged if an incompatible // version is found. // // Note that we can't always determine the version of rules_go in use. Also, // if we find an incompatible version, we shouldn't bail out since th...
c178370
// preprocessTags adds some tags which are on by default before they are // used to match files.
c178371
// setBuildTags sets genericTags by parsing as a comma separated list. An // error will be returned for tags that wouldn't be recognized by "go build". // preprocessTags should be called before this.
c178372
// splitDirective splits a comma-separated directive value into its component // parts, trimming each of any whitespace characters.
c178373
// copyGoModToTemp copies to given go.mod file to a temporary directory. // go list tends to mutate go.mod files, but gazelle shouldn't do that.
c178374
// findGoTool attempts to locate the go executable. If GOROOT is set, we'll // prefer the one in there; otherwise, we'll rely on PATH. If the wrapper // script generated by the gazelle rule is invoked by Bazel, it will set // GOROOT to the configured SDK. We don't want to rely on the host SDK in // that situation.
c178375
// isBuildable returns true if anything in the package is buildable. // This is true if the package has Go code that satisfies build constraints // on any platform or has proto files not in legacy mode.
c178376
// startServer starts a new server process. This is called by the client.
c178377
// watchDir listens for file system changes in root and its // subdirectories. The record function is called with directories whose // contents have changed. New directories are watched recursively. // The returned cancel function may be called to stop watching.
c178378
// listDirs returns a slice containing all the subdirectories under dir, // including dir itself.
c178379
// shouldIgnore returns whether a write to the given file should be ignored // because they were caused by gazelle or autogazelle or something unrelated // to the build.
c178380
// recordWrite records that a directory has been modified and that its build // file should be updated the next time gazelle runs.
c178381
// getAndClearWrittenDirs retrieves a list of directories that have been // modified since the last time getAndClearWrittenDirs was called.
c178382
//CombineHandler takes variadic list of handlers and produces one handler //that calls each handler in order.
c178383
//VerifyContentType returns a handler that verifies that a request has a Content-Type header set to the //specified value
c178384
//VerifyMimeType returns a handler that verifies that a request has a specified mime type set //in Content-Type header
c178385
//VerifyBasicAuth returns a handler that verifies the request contains a BasicAuth Authorization header //matching the passed in username and password
c178386
//VerifyJSONRepresenting is similar to VerifyJSON. Instead of taking a JSON string, however, it //takes an arbitrary JSON-encodable object and verifies that the requests's body is a JSON representation //that matches the object
c178387
//VerifyFormKV returns a handler that verifies a request contains a form key with the specified values. // //It is a convenience wrapper around `VerifyForm` that lets you avoid having to create a `url.Values` object.
c178388
//RespondWithProto returns a handler that responds to a request with the specified status code and a body //containing the protobuf serialization of the provided message. // //Also, RespondWithProto can be given an optional http.Header. The headers defined therein will be added to the response headers.
c178389
// RegisterFailHandlerWithT ensures that the given types.TWithHelper and fail handler // are used globally.
c178390
// EventuallyWithOffset operates like Eventually but takes an additional // initial argument to indicate an offset in the call stack. This is useful when building helper // functions that contain matchers. To learn more, read about `ExpectWithOffset`.
c178391
// ConsistentlyWithOffset operates like Consistnetly but takes an additional // initial argument to indicate an offset in the call stack. This is useful when building helper // functions that contain matchers. To learn more, read about `ExpectWithOffset`.
c178392
// Expect is used to make assertions. See documentation for Expect.
c178393
// Eventually is used to make asynchronous assertions. See documentation for Eventually.
c178394
// Consistently is used to make asynchronous assertions. See documentation for Consistently.
c178395
// TimeoutCloser returns an io.Closer that wraps the passed-in io.Closer. If the underlying Closer fails to close within the alloted timeout ErrTimeout is returned.
c178396
// TimeoutReader returns an io.Reader that wraps the passed-in io.Reader. If the underlying Reader fails to read within the alloted timeout ErrTimeout is returned.
c178397
// TimeoutWriter returns an io.Writer that wraps the passed-in io.Writer. If the underlying Writer fails to write within the alloted timeout ErrTimeout is returned.
c178398
// Create a NestedError with the given path. // If err is a NestedError, prepend the path to it. // If err is an AggregateError, recursively Nest each error.
c178399
// SetMockService return a new MockService and set as a servicemanager