Documentation ¶
Index ¶
- Constants
- func CollectGenerationMetadata(root string) (map[string]GenerationMetadata, error)
- func FormatPackage(dir string) error
- func GetChangelogForPackage(lhs, rhs *exports.Content) (*model.Changelog, error)
- type ChangelogContext
- type ChangelogProcessError
- type ChangelogProcessor
- type ChangelogResult
- type GenerateError
- type GenerationMetadata
- type GenerationMetadataAdditionalProperties
- type Generator
- func (g *Generator) Arguments() []string
- func (g *Generator) Generate() error
- func (g *Generator) Run() error
- func (g *Generator) Start() error
- func (g *Generator) StderrPipe() (io.ReadCloser, error)
- func (g *Generator) StdoutPipe() (io.ReadCloser, error)
- func (g *Generator) Wait() error
- func (g *Generator) WithMetadataOutput(output string) *Generator
- func (g *Generator) WithMultiAPI() *Generator
- func (g *Generator) WithOption(option model.Option) *Generator
- func (g *Generator) WithReadme(readme string) *Generator
- func (g *Generator) WithTag(tag string) *Generator
- type MetadataProcessError
- type MetadataProcessor
Constants ¶
const ( // NormalizedSpecRoot this is the prefix for readme NormalizedSpecRoot = "/_/azure-rest-api-specs/" // NormalizedSDKRoot this is the prefix for readme NormalizedSDKRoot = "/_/azure-sdk-for-go/" // MetadataFilename ... MetadataFilename = "_meta.json" )
const (
// ChangelogFilename ...
ChangelogFilename = "CHANGELOG.md"
)
Variables ¶
This section is empty.
Functions ¶
func CollectGenerationMetadata ¶
func CollectGenerationMetadata(root string) (map[string]GenerationMetadata, error)
CollectGenerationMetadata iterates every track 1 go sdk package under root, and collect all the GenerationMetadata into a map using relative path of the package as keys
func FormatPackage ¶
FormatPackage formats the given package using gofmt
Types ¶
type ChangelogContext ¶
ChangelogContext describes all necessary data that would be needed in the processing of changelogs
type ChangelogProcessError ¶
type ChangelogProcessError struct {
Errors []error
}
ChangelogProcessError describes the errors during the processing
type ChangelogProcessor ¶
type ChangelogProcessor struct {
// contains filtered or unexported fields
}
ChangelogProcessor processes the metadata and output changelog with the desired format
func NewChangelogProcessorFromContext ¶
func NewChangelogProcessorFromContext(ctx ChangelogContext) *ChangelogProcessor
NewChangelogProcessorFromContext returns a new ChangelogProcessor
func (*ChangelogProcessor) GenerateChangelog ¶
func (p *ChangelogProcessor) GenerateChangelog(packageFullPath, tag string) (*ChangelogResult, error)
GenerateChangelog generates a changelog for one package
func (*ChangelogProcessor) Process ¶
func (p *ChangelogProcessor) Process(metadataMap map[string]model.Metadata) ([]ChangelogResult, error)
Process generates the changelogs using the input metadata map. Please ensure the input metadata map does not contain any package that is not under the sdk root, otherwise this might give weird results.
type ChangelogResult ¶
type ChangelogResult struct { Tag string PackageName string PackageFullPath string Changelog model.Changelog }
ChangelogResult describes the result of the generated changelog for one package
func (ChangelogResult) ToMarkdown ¶
func (r ChangelogResult) ToMarkdown() string
type GenerateError ¶
GenerateError ...
type GenerationMetadata ¶
type GenerationMetadata struct { // AutorestVersion is the version of autorest.core AutorestVersion string `json:"autorest,omitempty"` // CommitHash is the commit hash of azure-rest-api-specs from which this SDK package is generated CommitHash string `json:"commit,omitempty"` // Readme is the normalized path of the readme file from which this SDK package is generated. It should be in this pattern: /_/azure-rest-api-specs/{relative_path} Readme string `json:"readme,omitempty"` // Tag is the tag from which this SDK package is generated Tag string `json:"tag,omitempty"` // CodeGenVersion is the version of autorest.go using when this package is generated CodeGenVersion string `json:"use,omitempty"` // RepositoryURL is the URL of the azure-rest-api-specs. This should always be a constant "https://github.com/Azure/azure-rest-api-specs.git" RepositoryURL string `json:"repository_url,omitempty"` // AutorestCommand is the full command that generates this package AutorestCommand string `json:"autorest_command,omitempty"` // AdditionalProperties is a map of addition information in this metadata AdditionalProperties GenerationMetadataAdditionalProperties `json:"additional_properties,omitempty"` }
GenerationMetadata contains all the metadata that has been used when generating a track 1 package
func GetGenerationMetadata ¶
func GetGenerationMetadata(pkg track1.Package) (*GenerationMetadata, error)
GetGenerationMetadata gets the GenerationMetadata in one specific package
func (*GenerationMetadata) RelativeReadme ¶
func (meta *GenerationMetadata) RelativeReadme() string
RelativeReadme returns the relative readme path
type GenerationMetadataAdditionalProperties ¶
type GenerationMetadataAdditionalProperties struct {
AdditionalOptions string `json:"additional_options,omitempty"`
}
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator collects all the related context of an autorest generation
func NewGeneratorFromOptions ¶
NewGeneratorFromOptions returns a new Generator with the given model.Options
func (*Generator) Generate ¶
Generate executes the autorest generation. The error will be of type *GenerateError
func (*Generator) StderrPipe ¶
func (g *Generator) StderrPipe() (io.ReadCloser, error)
StderrPipe returns the stderr pipeline of the command
func (*Generator) StdoutPipe ¶
func (g *Generator) StdoutPipe() (io.ReadCloser, error)
StdoutPipe returns the stdout pipeline of the command
func (*Generator) WithMetadataOutput ¶
WithMetadataOutput appends a `metadata-output-folder` option to the autorest argument list
func (*Generator) WithMultiAPI ¶
WithMultiAPI appends a multiapi flag to the autorest argument list
func (*Generator) WithOption ¶
WithOption appends an model.Option to the argument list of the autorest generation
func (*Generator) WithReadme ¶
WithReadme appends a readme argument
type MetadataProcessError ¶
MetadataProcessError ...
type MetadataProcessor ¶
type MetadataProcessor struct {
// contains filtered or unexported fields
}
MetadataProcessor processes the metadata
func NewMetadataProcessorFromLocation ¶
func NewMetadataProcessorFromLocation(metadataOutput string) *MetadataProcessor
NewMetadataProcessorFromLocation creates a new MetadataProcessor using the metadata output folder location