Documentation ¶
Overview ¶
Package resolver contains the .proto resolver API and implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactoryConfig ¶
type ArtifactoryConfig struct { URL string `hcl:"url" help:"Artifactory URL, eg. \"https://artifactory.mycompany.com/artifactory\""` DownloadURL string `hcl:"download_url,optional" help:"Optional URL to download artifacts from. If not provided Artifactory itself will be used."` Repositories []ArtifactoryRepositoryConfig `hcl:"repository,block" help:"Artifactory repositories to download the latest JAR from."` }
ArtifactoryConfig defines how to talk to Artifactory and where to download artifacts from.
type ArtifactoryRepositoryConfig ¶
type ArtifactoryRepositoryConfig struct { Path string `hcl:"name,label" help:"Artifact repository name."` Version string `hcl:"version,optional" help:"The artifact version to use."` }
ArtifactoryRepositoryConfig is the config for a single repository within Artifactory.
type NamedReadCloser ¶
type NamedReadCloser interface { Name() string io.ReadCloser }
NamedReadCloser gives an io.ReadCloser an identity.
type RemoteConfig ¶
type RemoteConfig struct {
BitbucketServers []string `hcl:"bitbucket-servers,optional" help:"List of hostnames to treat as Bitbucket servers."`
}
RemoteConfig contains the configuration for Remote().
type Repo ¶
type Repo struct { URL string `hcl:"url,label" help:"Git cloneable URL of repository."` Root string `hcl:"root,optional" help:"Root path in remote repository to search for protos."` Prefix string `hcl:"prefix,optional" help:"Prefix of proto path that will match this repository. eg. 'google'"` Protos []string `hcl:"protos,optional" help:"A list of specific .proto files that this repository contains."` CommitHash string `hcl:"commit,optional" help:"Specific commit to retrieve .proto files from."` }
Repo defines a source repository and where to retrieve protos from it.
type Resolver ¶
type Resolver func(path string) (NamedReadCloser, error)
A Resolver can resolve proto imports to source.
Will return (nil, nil) if not found.
func ArtifactoryJAR ¶
func ArtifactoryJAR(artifactoryURL, jarURL string, repository ArtifactoryRepositoryConfig) Resolver
ArtifactoryJAR resolves protobufs from JAR files in Artifactory.
This will sync metadata from Artifactory, download, cache, and unpack the latest JAR.
"artifactoryURL" should be the base Artifactory URL, eg. "https://artifactory.mycompany.com/artifactory". "jarURL" should have the same URL layout as Artifactory, but could be a JAR mirror, eg. "https://edge-cache.mycompany.com/artifactory". "repositoryPath" is the Artifactory repository path to the artifact we're retrieving, eg. "jar-releases/com/mycompany/external/protos/mycompany-protos" or "mycompany-public/com/mycompany/protos/all-protos"
func Remote ¶
func Remote(config RemoteConfig, repos []Repo) Resolver
Remote resolves imports from their source repositories.