Documentation ¶
Index ¶
- func BuildArgsFromScript(productTaskOutputInfo ProductTaskOutputInfo, buildArgsScript string) ([]string, error)
- func BuildScriptEnvVariables(outputInfo ProductTaskOutputInfo) map[string]string
- func ClassifyProductParams(productParams []ProductParam) (allProducts map[ProductID]struct{}, specifiedProducts map[ProductID]struct{}, ...)
- func DistScriptEnvVariables(distID DistID, outputInfo ProductTaskOutputInfo) map[string]string
- func DryRunPrint(w io.Writer, msg string)
- func DryRunPrintln(w io.Writer, msg string)
- func ExecutableName(productName, goos string) string
- func PrintOrDryRunPrint(w io.Writer, msg string, dryRun bool)
- func PrintlnOrDryRunPrintln(w io.Writer, msg string, dryRun bool)
- func ProductBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[osarch.OSArch]string
- func ProductBuildOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) string
- func ProductDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
- func ProductDistOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo, distID DistID) string
- func ProductDistWorkDirs(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID]string
- func ProductDistWorkDirsAndArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
- func ProductDockerBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[osarch.OSArch]string
- func ProductDockerDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[DistID][]string
- func ProductIDsToStrings(in []ProductID) []string
- func ProjectVersion(projectDir, versionScriptContent string) (rVersion string, rErr error)
- func RenderTemplate(tmplContent string, data interface{}, fns ...TemplateFunction) (string, error)
- func RunCommandWithVerboseOption(cmd *exec.Cmd, verbose, dryRun bool, stdout io.Writer) error
- func ToMapSlice(in interface{}) (yaml.MapSlice, error)
- func WriteAndExecuteScript(projectInfo ProjectInfo, script string, additionalEnvVars map[string]string, ...) (rErr error)
- func WriteScript(projectInfo ProjectInfo, script string) (name string, cleanup func() error, rErr error)
- type BuildConfig
- type BuildFunc
- type BuildOutputInfo
- type BuildParam
- type ByDistID
- type ByDockerID
- type ByOSArchID
- type ByProductID
- type DistConfig
- type DistID
- type DistOutputInfo
- type DistOutputInfos
- type DistParam
- type Dister
- type DisterConfig
- type DisterFactory
- type DisterParam
- type DistersConfig
- type DockerBuilder
- type DockerBuilderConfig
- type DockerBuilderFactory
- type DockerBuilderOutputInfo
- func (doi *DockerBuilderOutputInfo) InputBuildOSArchs(productID ProductID) []OSArchID
- func (doi *DockerBuilderOutputInfo) InputBuildProductIDs() []ProductID
- func (doi *DockerBuilderOutputInfo) InputDistDistIDs(productID ProductID) []DistID
- func (doi *DockerBuilderOutputInfo) InputDistProductIDs() []ProductID
- type DockerBuilderParam
- type DockerBuildersConfig
- type DockerConfig
- type DockerID
- type DockerOutputInfos
- type DockerParam
- type FlagType
- type OSArchID
- type ProcessFunc
- type ProductBuildID
- type ProductConfig
- type ProductDistID
- type ProductDockerID
- type ProductErrors
- type ProductID
- type ProductOutputInfo
- type ProductParam
- func ProductParamsForBuildProductArgs(inputProducts map[ProductID]ProductParam, productBuildIDs ...ProductBuildID) ([]ProductParam, error)
- func ProductParamsForDistProductArgs(inputProducts map[ProductID]ProductParam, productDistIDs ...ProductDistID) ([]ProductParam, error)
- func ProductParamsForDockerProductArgs(inputProducts map[ProductID]ProductParam, productDockerIDs ...ProductDockerID) ([]ProductParam, error)
- func ProductParamsForProductArgs(inputProducts map[ProductID]ProductParam, productIDs ...ProductID) ([]ProductParam, error)
- type ProductTaskOutputInfo
- func (p *ProductTaskOutputInfo) AllProductOutputInfos() []ProductOutputInfo
- func (p *ProductTaskOutputInfo) AllProductOutputInfosMap() map[ProductID]ProductOutputInfo
- func (p *ProductTaskOutputInfo) POM(groupID string) (string, string, error)
- func (p *ProductTaskOutputInfo) ProductBuildArtifactPaths() map[osarch.OSArch]string
- func (p *ProductTaskOutputInfo) ProductBuildOutputDir() string
- func (p *ProductTaskOutputInfo) ProductDistArtifactPaths() map[DistID][]string
- func (p *ProductTaskOutputInfo) ProductDistOutputDir(distID DistID) string
- func (p *ProductTaskOutputInfo) ProductDistWorkDirs() map[DistID]string
- func (p *ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths() map[DistID][]string
- func (p *ProductTaskOutputInfo) ProductDockerBuildArtifactPaths() map[DockerID]map[ProductID]map[osarch.OSArch]string
- func (p *ProductTaskOutputInfo) ProductDockerDistArtifactPaths() map[DockerID]map[ProductID]map[DistID][]string
- type ProjectConfig
- type ProjectInfo
- type ProjectParam
- type PublishConfig
- type PublishID
- type PublishOutputInfo
- type PublishParam
- type Publisher
- type PublisherFlag
- type PublisherFlagName
- type RunConfig
- type RunParam
- type TemplateFunction
- func GroupIDTemplateFunction(groupID string) TemplateFunction
- func ProductTemplateFunction(productID ProductID) TemplateFunction
- func RepositoryTemplateFunction(repository string) TemplateFunction
- func TemplateValueFunction(key string, val interface{}) TemplateFunction
- func VersionTemplateFunction(version string) TemplateFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildArgsFromScript ¶
func BuildArgsFromScript(productTaskOutputInfo ProductTaskOutputInfo, buildArgsScript string) ([]string, error)
func BuildScriptEnvVariables ¶
func BuildScriptEnvVariables(outputInfo ProductTaskOutputInfo) map[string]string
BuildScriptEnvVariables returns a map of environment variables for the script for the builder. The returned map contains the following environment variables:
PROJECT_DIR: the root directory of project VERSION: the version of the project PRODUCT: the name of the product
The following environment variables are defined if the build configuration for the product is non-nil:
BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") BUILD_NAME: the rendered NameTemplate for the build for this product BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product BUILD_OS_ARCH_{#}: for 0 <= # < BUILD_OS_ARCHS_COUNT, contains the OS/arch for the build
func ClassifyProductParams ¶
func ClassifyProductParams(productParams []ProductParam) (allProducts map[ProductID]struct{}, specifiedProducts map[ProductID]struct{}, dependentProducts map[ProductID]struct{})
func DistScriptEnvVariables ¶
func DistScriptEnvVariables(distID DistID, outputInfo ProductTaskOutputInfo) map[string]string
DistScriptEnvVariables returns a map of environment variables for the script for the dister with the specified DistID in the provided output configuration. The returned map contains the following environment variables:
PROJECT_DIR: the root directory of project VERSION: the version of the project PRODUCT: the name of the product DEP_PRODUCT_ID_COUNT: the number of dependent products for the product DEP_PRODUCT_ID_{#}: for 0 <= # < DEP_PRODUCT_IDS_COUNT, contains the dependent products for the product
The following environment variables are defined if the build configuration for the product is non-nil:
BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") BUILD_NAME: the rendered NameTemplate for the build for this product BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product BUILD_OS_ARCH_{#}: for 0 <= # < BUILD_OS_ARCHS_COUNT, contains the OS/arch for the build
The following environment variables are defined if the dist configuration for the product is non-nil:
DIST_ID: the DistID for the current distribution DIST_DIR: the distribution output directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}") DIST_WORK_DIR: the distribution work directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}") DIST_NAME: the rendered NameTemplate for the distribution DIST_ARTIFACT_COUNT: the number of artifacts generated by the current distribution DIST_ARTIFACT_{#}: for 0 <= # < DIST_ARTIFACT_COUNT, the name of the dist artifact generated by the current distribution
Each dependent product adds the following set of environment variables that start with "DEP_PRODUCT_ID_{#}_", where 0 <= # < DEP_PRODUCT_ID_COUNT:
The following environment variables are defined if the build configuration for the product is non-nil:
DEP_PRODUCT_ID_{#}_BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ProductID}}/{{Version}}") DEP_PRODUCT_ID_{#}_BUILD_NAME: the rendered NameTemplate for the build for this product DEP_PRODUCT_ID_{#}_BUILD_OS_ARCH_COUNT: the number of OS/arch combinations for this product DEP_PRODUCT_ID_{#}_BUILD_OS_ARCH_{##}: for 0 <= ## < BUILD_OS_ARCH_COUNT, contains the OS/arch for the build
The following environment variables are defined if the dist configuration for the product is non-nil:
DEP_PRODUCT_ID_{#}_DIST_ID_COUNT: the number of disters for this product DEP_PRODUCT_ID_{#}_DIST_ID_{##}: for 0 <= ## < DIST_ID_COUNT, the DistID DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_DIR: for 0 <= ## < DIST_ID_COUNT, the distribution output directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}") DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_WORK_DIR: for 0 <= ## < DIST_ID_COUNT, the distribution work directory for the dist ("{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}") DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_NAME: for 0 <= ## < DIST_ID_COUNT, the rendered NameTemplate for the distribution DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_ARTIFACT_COUNT: for 0 <= ## < DIST_DISTER_IDS_COUNT, contains the number of artifacts generated by the dister DEP_PRODUCT_ID_{#}_DIST_ID_{##}_DIST_ARTIFACT_{###}: for 0 <= ## < DIST_DISTER_IDS_COUNT and 0 <= ### < DIST_DISTER_IDS_{#}_DIST_ARTIFACTS_COUNT, contains the name of the specified dist artifact
func DryRunPrint ¶
func DryRunPrintln ¶
func ExecutableName ¶
func ProductBuildArtifactPaths ¶
func ProductBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[osarch.OSArch]string
ProductBuildArtifactPaths returns a map that contains the paths to the executables created by the provided product for the provided project. The keys in the map are the OS/architecture of the executable and the values are the executable output paths for that OS/architecture. The output paths are of the form "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{OSArch}}/{{NameTemplateRendered}}" (and if the OS is Windows, the ".exe" extension is appended).
func ProductBuildOutputDir ¶
func ProductBuildOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) string
ProductBuildOutputDir returns the output directory for the build outputs, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}".
func ProductDistArtifactPaths ¶
func ProductDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
ProductDistArtifactPaths returns a map from DistID to the output paths for the dist, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{Artifacts}}".
func ProductDistOutputDir ¶
func ProductDistOutputDir(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo, distID DistID) string
ProductDistOutputDir returns the output directory for the dist outputs for the dist with the given DistID, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}".
func ProductDistWorkDirs ¶
func ProductDistWorkDirs(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID]string
ProductDistWorkDirs returns a map from DistID to the directory used to prepare the distribution for that DistID, which is "{{ProjectDir}}/{{OutputDir}}/{{ProductID}}/{{Version}}/{{DistID}}/{{NameTemplateRendered}}".
func ProductDistWorkDirsAndArtifactPaths ¶
func ProductDistWorkDirsAndArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DistID][]string
ProductDistWorkDirsAndArtifactPaths returns a map that is the result of joining the values of the outputs of ProductDistWorkDirs and ProductDistArtifactPaths.
func ProductDockerBuildArtifactPaths ¶
func ProductDockerBuildArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[osarch.OSArch]string
ProductDockerBuildArtifactPaths returns a map that contains the paths to the locations where the input build artifacts should be placed in the Docker context directory. The DockerID key identifies the DockerBuilder, the ProductID represents the input product for that DockerBuilder, and the osarch.OSArch represents the OS/Arch for the build. Paths are of the form "{{ProjectDir}}/{{DockerID.ContextDir}}/{{DockerID.InputProductsDir}}/{{ProductID}}/build/{{OSArch}}/{{ExecutableName}}".
func ProductDockerDistArtifactPaths ¶
func ProductDockerDistArtifactPaths(projectInfo ProjectInfo, productOutputInfo ProductOutputInfo) map[DockerID]map[ProductID]map[DistID][]string
ProductDockerDistArtifactPaths returns a map that contains the paths to the locations where the input dist artifacts should be placed in the Docker context directory. The DockerID key identifies the DockerBuilder, the ProductID represents the input product for that DockerBuilder, and the DistID represents the Dister for the product. Paths are of the form "{{ProjectDir}}/{{DockerID.ContextDir}}/{{DockerID.InputProductsDir}}/{{ProductID}}/dist/{{DistID}}/{{Artifacts}}".
func ProductIDsToStrings ¶
func ProjectVersion ¶
func RenderTemplate ¶
func RenderTemplate(tmplContent string, data interface{}, fns ...TemplateFunction) (string, error)
func ToMapSlice ¶
func ToMapSlice(in interface{}) (yaml.MapSlice, error)
func WriteAndExecuteScript ¶
func WriteScript ¶
func WriteScript(projectInfo ProjectInfo, script string) (name string, cleanup func() error, rErr error)
Types ¶
type BuildConfig ¶
type BuildConfig struct { // NameTemplate is the template used for the executable output. The following template parameters can be used in the // template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project // // If a value is not specified, "{{Product}}" is used as the default value. NameTemplate *string `yaml:"name-template"` // OutputDir specifies the default build output directory for products executables built by the "build" task. The // executables generated by "build" are written to "{{OutputDir}}/{{ID}}/{{Version}}/{{OSArch}}/{{NameTemplate}}". // // If not specified, "out/build" is used as the default value. OutputDir *string `yaml:"output-dir"` // MainPkg is the location of the main package for the product relative to the project root directory. For example, // "./distgo/main". MainPkg *string `yaml:"main-pkg"` // BuildArgsScript is the content of a script that is written to a file and run before this product is built // to provide supplemental build arguments for the product. The contents of this value are written to a file // with a header `#!/bin/bash` and executed. The script process inherits the environment variables of the Go // process. Each line of output of the script is provided to the "build" command as a separate argument. For // example, the following script would add the arguments "-ldflags" "-X" "main.year=$YEAR" to the build command: // // build-args-script: | // #!/usr/bin/env bash // YEAR=$(date +%Y) // echo "-ldflags" // echo "-X" // echo "main.year=$YEAR" BuildArgsScript *string `yaml:"build-args-script"` // VersionVar is the path to a variable that is set with the version information for the build. For example, // "github.com/palantir/godel/cmd/godel.Version". If specified, it is provided to the "build" command as an // ldflag. VersionVar *string `yaml:"version-var"` // Environment specifies values for the environment variables that should be set for the build. For example, // the following sets CGO to false: // // environment: // CGO_ENABLED: "0" Environment *map[string]string `yaml:"environment"` // OSArchs specifies the GOOS and GOARCH pairs for which the product is built. If blank, defaults to the GOOS // and GOARCH of the host system at runtime. OSArchs *[]osarch.OSArch `yaml:"os-archs"` }
func (*BuildConfig) ToParam ¶
func (cfg *BuildConfig) ToParam(scriptIncludes string, defaultCfg BuildConfig) (BuildParam, error)
ToParam returns the BuildParam represented by the receiver *BuildConfig and the provided default BuildConfig. If a config value is specified (non-nil) in the receiver config, it is used. If a config value is not specified in the receiver config but is specified in the default config, the default config value is used. If a value is not specified in either configuration, the program-specified default value (if any) is used.
type BuildFunc ¶
type BuildFunc func(projectInfo ProjectInfo, productParams []ProductParam, stdout io.Writer) error
func ProcessSerially ¶
func ProcessSerially(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
ProcessSerially returns a BuildFunc that processes each of the provided specs in order using the provided function. If the function returns an error for any of the specifications, the function immediately returns that error.
func ProcessSeriallyBatchErrors ¶
func ProcessSeriallyBatchErrors(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
ProcessSeriallyBatchErrors returns a BuildFunc that processes each of the provided specs in order using the provided function. If the function returns an error for any of the specifications, it is stored, but the function will will continue processing the provided specifications. The function return nil if no errors occurred; otherwise, it returns a ProductErrors error that contains the individual errors.
type BuildOutputInfo ¶
type BuildParam ¶
type BuildParam struct { // NameTemplate is the template used for the executable output. The following template parameters can be used in the // template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project NameTemplate string // OutputDir specifies the default build output directory for products executables built by the "build" task. The // executables generated by "build" are written to "{{OutputDir}}/{{ID}}/{{Version}}/{{OSArch}}/{{NameTemplate}}". OutputDir string // MainPkg is the location of the main package for the product relative to the project root directory. For example, // "distgo/main". MainPkg string // BuildArgsScript is the content of a script that is written to a file and run before this product is built // to provide supplemental build arguments for the product. The contents of this value are written to a file // and executed with the project directory as the working directory. The script process inherits the environment // variables of the Go process. Each line of output of the script is provided to the "build" command as a separate // argument. For example, the following script would add the arguments "-ldflags" "-X" "main.year=$YEAR" to the // build command: // // #!/usr/bin/env bash // YEAR=$(date +%Y) // echo "-ldflags" // echo "-X" // echo "main.year=$YEAR" BuildArgsScript string // VersionVar is the path to a variable that is set with the version information for the build. For example, // "github.com/palantir/godel/cmd/godel.Version". If specified, it is provided to the "build" command as an // ldflag. VersionVar string // Environment specifies values for the environment variables that should be set for the build. For example, // a value of map[string]string{"CGO_ENABLED": "0"} would build with CGo disabled. Environment map[string]string // OSArchs specifies the GOOS and GOARCH pairs for which the product is built. OSArchs []osarch.OSArch }
func (*BuildParam) BuildArgs ¶
func (p *BuildParam) BuildArgs(productTaskOutputInfo ProductTaskOutputInfo) ([]string, error)
func (*BuildParam) ToBuildOutputInfo ¶
func (p *BuildParam) ToBuildOutputInfo(productID ProductID, version string) (BuildOutputInfo, error)
type ByDockerID ¶
type ByDockerID []DockerID
func (ByDockerID) Len ¶
func (a ByDockerID) Len() int
func (ByDockerID) Less ¶
func (a ByDockerID) Less(i, j int) bool
func (ByDockerID) Swap ¶
func (a ByDockerID) Swap(i, j int)
type ByOSArchID ¶
type ByOSArchID []OSArchID
func (ByOSArchID) Len ¶
func (a ByOSArchID) Len() int
func (ByOSArchID) Less ¶
func (a ByOSArchID) Less(i, j int) bool
func (ByOSArchID) Swap ¶
func (a ByOSArchID) Swap(i, j int)
type ByProductID ¶
type ByProductID []ProductID
func (ByProductID) Len ¶
func (a ByProductID) Len() int
func (ByProductID) Less ¶
func (a ByProductID) Less(i, j int) bool
func (ByProductID) Swap ¶
func (a ByProductID) Swap(i, j int)
type DistConfig ¶
type DistConfig struct { // OutputDir specifies the default distribution output directory for product distributions created by the "dist" // task. The distribution output directory is written to // "{{OutputDir}}/{{ID}}/{{Version}}/{{NameTemplate}}", and the distribution artifacts are written to // "{{OutputDir}}/{{ID}}/{{Version}}". // // If a value is not specified, "out/dist" is used as the default value. OutputDir *string `yaml:"output-dir"` // Disters is the configuration for the disters for this product. The YAML representation can be a single DisterConfig // or a map[DistID]DisterConfig. Disters *DistersConfig `yaml:"disters"` }
func (*DistConfig) ToParam ¶
func (cfg *DistConfig) ToParam(scriptIncludes string, defaultCfg DistConfig, disterFactory DisterFactory) (DistParam, error)
ToParam returns the DistParam represented by the receiver *DisterConfig and the provided default DisterConfig. If a config value is specified (non-nil) in the receiver config, it is used. If a config value is not specified in the receiver config but is specified in the default config, the default config value is used. If a value is not specified in either configuration, the program-specified default value (if any) is used.
type DistOutputInfo ¶
type DistOutputInfos ¶
type DistOutputInfos struct { DistOutputDir string `json:"distOutputDir"` DistIDs []DistID `json:"distIds"` DistInfos map[DistID]DistOutputInfo `json:"distInfos"` }
type DistParam ¶
type DistParam struct { // OutputDir specifies the default distribution output directory for product distributions created by the "dist" // task. The distribution output directory is written to // "{{OutputDir}}/{{ID}}/{{Version}}/{{DistID}}/{{NameTemplate}}", and the distribution artifacts are written to // "{{OutputDir}}/{{ID}}/{{Version}}/{{DistID}}". OutputDir string // DistParams contains the dist params for this distribution. DistParams map[DistID]DisterParam }
func (*DistParam) ToDistOutputInfos ¶
func (p *DistParam) ToDistOutputInfos(productID ProductID, version string) (DistOutputInfos, error)
type Dister ¶
type Dister interface { // TypeName returns the type of this dister. TypeName() (string, error) // Artifacts returns the names of the artifacts generated by running RunDist. Artifacts(renderedName string) ([]string, error) // RunDist runs the distribution task. The provided DistID specifies the ID for the current dister and the // ProductTaskOutputInfo contains all of the output information for the product. When this function is called, the // DistWorkDir for the product should have already been created and the dist script should have already been run. // Running this function should populate the DistWorkDir with any files and/or directories required for the // distribution. However, the dist artifacts themselves should not be created. May return a value that is the // JSON-serialized bytes that is provided as the runDistResult parameter to GenerateDistArtifacts. RunDist(distID DistID, productTaskOutputInfo ProductTaskOutputInfo) ([]byte, error) // GenerateDistArtifacts generates the dist artifact outputs from the DistWorkDir for the distribution. The // runDistResult argument contains the JSON-serialized bytes returned by the RunDist call. The DistWorkDir contains // the output generated by RunDist. The outputs written by GenerateDistArtifacts should match the artifacts returned // by the Artifacts function. GenerateDistArtifacts(distID DistID, productTaskOutputInfo ProductTaskOutputInfo, runDistResult []byte) error }
type DisterConfig ¶
type DisterConfig struct { // Type is the type of the dister. This field must be non-nil and non-empty and resolve to a valid Dister. Type *string `yaml:"type"` // Config is the YAML configuration content for the dister. Config *yaml.MapSlice `yaml:"config"` // NameTemplate is the template used for the executable output. The following template parameters can be used in the // template: // * {{Product}}: the name of the product. // * {{Version}}: the version of the project. // // If a value is not specified, "{{Product}}-{{Version}}" is used as the default value. NameTemplate *string `yaml:"name-template"` // Script is the content of a script that is written to file a file and run after the initial distribution // process but before the artifact generation process. The content of this value is written to a file and executed // with the project directory as the working directory. The script process inherits the environment variables of the // Go process and also has the following environment variables defined: // // PROJECT_DIR: the root directory of project. // VERSION: the version of the project. // PRODUCT: the name of the product. // DEP_PRODUCT_IDS: the IDs of the dependent products for the product, where each item is delimited by a colon. // // The following environment variables are defined if the build configuration for the product is non-nil: // BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // BUILD_NAME: the rendered NameTemplate for the build for this project. // OS_ARCHS: the OS/Arch combinations for this product, where each item is delimited by a colon. // // The following environment variables are defined if the dist configuration for the product is non-nil: // DIST_DIR: the distribution output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // DIST_NAME: the rendered NameTemplate for the distribution. // DIST_ARTIFACTS: the dist artifacts for the product, where each item is delimited by a colon. // // Each dependent product adds the following set of environment variables that start with "{{ID}}_": // // The following environment variables are defined if the build configuration for the product is non-nil: // {{ID}}_BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // {{ID}}_BUILD_NAME: the rendered NameTemplate for the build for this project. // {{ID}}_OS_ARCHS: the OS/Arch combinations for this product, where each item is delimited by a colon. // // The following environment variables are defined if the dist configuration for the product is non-nil: // {{ID}}_DIST_DIR: the distribution output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // {{ID}}_DIST_NAME: the rendered NameTemplate for the distribution. // {{ID}}_DIST_ARTIFACTS: the dist artifacts for the product, where each item is delimited by a colon. Script *string `yaml:"script"` }
func (*DisterConfig) ToParam ¶
func (cfg *DisterConfig) ToParam(defaultCfg DisterConfig, scriptIncludes string, disterFactory DisterFactory) (DisterParam, error)
type DisterFactory ¶
type DisterParam ¶
type DisterParam struct { // NameTemplate is the template used for the dist output. The following template parameters can be used in the // template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project NameTemplate string // Script is the content of a script that is written to file a file and run after the initial distribution // process but before the artifact generation process. The contents of this value are written to a file and executed // with the project directory as the working directory. The script process inherits the environment variables of the // Go process and also has the following environment variables defined: // // PROJECT_DIR: the root directory of project. // VERSION: the version of the project. // PRODUCT: the name of the product. // DEP_PRODUCT_IDS: the IDs of the dependent products for the product, where each item is delimited by a colon. // // The following environment variables are defined if the build configuration for the product is non-nil: // BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // BUILD_NAME: the rendered NameTemplate for the build for this project. // OS_ARCHS: the OS/Arch combinations for this product, where each item is delimited by a colon. // // The following environment variables are defined if the dist configuration for the product is non-nil: // DIST_DIR: the distribution output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // DIST_NAME: the rendered NameTemplate for the distribution. // DIST_ARTIFACTS: the dist artifacts for the product, where each item is delimited by a colon. // // Each dependent product adds the following set of environment variables that start with "{{ID}}_": // // The following environment variables are defined if the build configuration for the product is non-nil: // {{ID}}_BUILD_DIR: the build output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // {{ID}}_BUILD_NAME: the rendered NameTemplate for the build for this project. // {{ID}}_OS_ARCHS: the OS/Arch combinations for this product, where each item is delimited by a colon. // // The following environment variables are defined if the dist configuration for the product is non-nil: // {{ID}}_DIST_DIR: the distribution output directory for the product ("{{OutputDir}}/{{ID}}/{{Version}}"). // {{ID}}_DIST_NAME: the rendered NameTemplate for the distribution. // {{ID}}_DIST_ARTIFACTS: the dist artifacts for the product, where each item is delimited by a colon. Script string // Dister is the Dister that performs the dist operation for this parameter. Dister Dister }
func (*DisterParam) ToDistOutputInfo ¶
func (p *DisterParam) ToDistOutputInfo(productID ProductID, version string) (DistOutputInfo, error)
type DistersConfig ¶
type DistersConfig map[DistID]DisterConfig
func (*DistersConfig) ToParam ¶
func (cfgs *DistersConfig) ToParam(defaultCfg *DistersConfig, scriptIncludes string, disterFactory DisterFactory) (map[DistID]DisterParam, error)
func (*DistersConfig) UnmarshalYAML ¶
func (cfgs *DistersConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type DockerBuilder ¶
type DockerBuilderConfig ¶
type DockerBuilderConfig struct { // Type is the type of the DockerBuilder. This field must be non-nil and non-empty and resolve to a valid DockerBuilder. Type *string `yaml:"type"` // Config is the YAML configuration content for the DockerBuilder. Config *yaml.MapSlice `yaml:"config"` // DockerfilePath is the path to the Dockerfile that is used to build the Docker image. The path is interpreted // relative to ContextDir. The content of the Dockerfile supports using Go templates. The following template // parameters can be used in the template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project // * {{ProductTaskOutputInfo}}: the ProductTaskOutputInfo struct DockerfilePath *string `yaml:"dockerfile-path"` ContextDir *string `yaml:"context-dir"` // InputProductsDir is the directory in the context dir in which input products are written. InputProductsDir *string `yaml:"input-products-dir"` // InputBuilds specifies the products whose build outputs should be made available to the Docker build task. The // specified products will be hard-linked into the context directory. The referenced products must be this product // or one of its declared dependencies. InputBuilds *[]ProductBuildID `yaml:"input-builds"` // InputDists specifies the products whose dist outputs should be made available to the Docker build task. The // specified dists will be hard-linked into the context directory. The referenced products must be this product // or one of its declared dependencies. InputDists *[]ProductDistID `yaml:"input-dists"` TagTemplates *[]string `yaml:"tag-templates"` }
func (*DockerBuilderConfig) ToParam ¶
func (cfg *DockerBuilderConfig) ToParam(defaultCfg DockerBuilderConfig, dockerBuilderFactory DockerBuilderFactory) (DockerBuilderParam, error)
type DockerBuilderFactory ¶
type DockerBuilderFactory interface {
NewDockerBuilder(typeName string, cfgYMLBytes []byte) (DockerBuilder, error)
}
type DockerBuilderOutputInfo ¶
type DockerBuilderOutputInfo struct { ContextDir string `json:"contextDir"` DockerfilePath string `json:"dockerfilePath"` InputProductsDir string `json:"inputProductsDir"` RenderedTags []string `json:"renderedDockerTags"` InputBuilds map[ProductID]map[OSArchID]struct{} `json:"inputBuilds"` InputDists map[ProductID]map[DistID]struct{} `json:"inputDists"` }
func (*DockerBuilderOutputInfo) InputBuildOSArchs ¶
func (doi *DockerBuilderOutputInfo) InputBuildOSArchs(productID ProductID) []OSArchID
func (*DockerBuilderOutputInfo) InputBuildProductIDs ¶
func (doi *DockerBuilderOutputInfo) InputBuildProductIDs() []ProductID
func (*DockerBuilderOutputInfo) InputDistDistIDs ¶
func (doi *DockerBuilderOutputInfo) InputDistDistIDs(productID ProductID) []DistID
func (*DockerBuilderOutputInfo) InputDistProductIDs ¶
func (doi *DockerBuilderOutputInfo) InputDistProductIDs() []ProductID
type DockerBuilderParam ¶
type DockerBuilderParam struct { // DockerBuilder is the builder used to build the Docker image. DockerBuilder DockerBuilder // DockerfilePath is the path to the Dockerfile that is used to build the Docker image. The path is interpreted // relative to ContextDir. The content of the Dockerfile supports using Go templates. The following template // parameters can be used in the template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project // * {{InputBuildArtifact(productID, osArch string) (string, error)}}: the path to the build artifact for the specified input product // * {{InputDistArtifacts(productID, distID string) ([]string, error)}}: the paths to the dist artifacts for the specified input product // * {{Tags(productID, dockerID string) ([]string, error)}}: the tags for the specified Docker image DockerfilePath string // ContextDir is the Docker context directory for building the Docker image. ContextDir string // Name of directory within ContextDir in which dependencies are linked. InputProductsDir string // InputBuilds stores the ProductBuildIDs for the input builds. The IDs must be unique and in expanded form. InputBuilds []ProductBuildID // InputDists stores the ProductDistIDs for the input dists. The IDs must be unique and in expanded form. InputDists []ProductDistID // TagTemplates contains the templates for the tags that will be used to tat the image generated by this builder. // The tag should be the form that would be provided to the "docker tag" command -- for example, // "fedora/httpd:version1.0" or "myregistryhost:5000/fedora/httpd:version1.0". // // The tag templates are rendered using Go templates. The following template parameters can be used in the template: // * {{Product}}: the name of the product // * {{Version}}: the version of the project // * {{Repository}}: the Docker repository TagTemplates []string }
func (*DockerBuilderParam) ToDockerBuilderOutputInfo ¶
func (p *DockerBuilderParam) ToDockerBuilderOutputInfo(productID ProductID, version, repository string) (DockerBuilderOutputInfo, error)
type DockerBuildersConfig ¶
type DockerBuildersConfig map[DockerID]DockerBuilderConfig
func (*DockerBuildersConfig) ToParam ¶
func (cfgs *DockerBuildersConfig) ToParam(defaultCfg *DockerBuildersConfig, dockerBuilderFactory DockerBuilderFactory) (map[DockerID]DockerBuilderParam, error)
type DockerConfig ¶
type DockerConfig struct { // Repository is the repository that is made available to the tag and Dockerfile templates. Repository *string `yaml:"repository"` // DockerBuilderParams contains the Docker params for this distribution. DockerBuildersConfig *DockerBuildersConfig `yaml:"docker-builders"` }
func (*DockerConfig) ToParam ¶
func (cfg *DockerConfig) ToParam(defaultCfg DockerConfig, dockerBuilderFactory DockerBuilderFactory) (DockerParam, error)
type DockerOutputInfos ¶
type DockerOutputInfos struct { DockerIDs []DockerID `json:"dockerIds"` Repository string `json:"repository"` DockerBuilderOutputInfos map[DockerID]DockerBuilderOutputInfo `json:"dockerBuilderOutputInfos"` }
type DockerParam ¶
type DockerParam struct { // Repository is the Docker repository. This value is made available to TagTemplates as {{Repository}}. Repository string // DockerBuilderParams contains the Docker params for this distribution. DockerBuilderParams map[DockerID]DockerBuilderParam }
func (*DockerParam) ToDockerOutputInfos ¶
func (p *DockerParam) ToDockerOutputInfos(productID ProductID, version string) (DockerOutputInfos, error)
type FlagType ¶
type FlagType int
FlagType represents the type of a flag (string, boolean, etc.). Currently only string flags are supported.
type ProcessFunc ¶
type ProcessFunc func(f func(projectInfo ProjectInfo, productParam ProductParam, stdout io.Writer) error) BuildFunc
type ProductBuildID ¶
type ProductBuildID string
ProductBuildID identifies a product or a specific build for a product. A ProductBuildID is one of the following:
- {{ProductID}} (e.g. "foo"), which specifies that all OS/Archs for the product should be built
- {{ProductID}}.{{OSArch}} (e.g. "foo.darwin-amd64"), which specifies that the specified OS/Arch for the specified product should be built
func NewProductBuildID ¶
func NewProductBuildID(productID ProductID, osArch osarch.OSArch) ProductBuildID
func ToProductBuildIDs ¶
func ToProductBuildIDs(in []string) []ProductBuildID
type ProductConfig ¶
type ProductConfig struct { // Build specifies the build configuration for the product. Build *BuildConfig `yaml:"build"` // Run specifies the run configuration for the product. Run *RunConfig `yaml:"run"` // Dist specifies the dist configuration for the product. Dist *DistConfig `yaml:"dist"` // Publish specifies the dist configuration for the product. Publish *PublishConfig `yaml:"publish"` // Docker specifies the Docker configuration for the product. Docker *DockerConfig `yaml:"docker"` // Dependencies specifies the first-level dependencies of this product. Stores the IDs of the products. Dependencies *[]ProductID `yaml:"dependencies"` }
ProductConfig represents user-specified configuration on how to build a specific product.
func (*ProductConfig) ToParam ¶
func (cfg *ProductConfig) ToParam(productID ProductID, scriptIncludes string, defaultCfg ProductConfig, disterFactory DisterFactory, dockerBuilderFactory DockerBuilderFactory) (ProductParam, error)
type ProductDistID ¶
type ProductDistID string
ProductDistID identifies a product or a specific dist for a product. A ProductDistID is one of the following:
- {{ProductID}} (e.g. "foo"), which specifies that all dists for the product should be built
- {{ProductID}}.{{DistID}} (e.g. "foo.os-arch-bin"), which specifies that the specified DistID for the specified product should be built
func NewProductDistID ¶
func NewProductDistID(productID ProductID, distID DistID) ProductDistID
func ToProductDistIDs ¶
func ToProductDistIDs(in []string) []ProductDistID
func (ProductDistID) Parse ¶
func (id ProductDistID) Parse() (ProductID, DistID)
type ProductDockerID ¶
type ProductDockerID string
ProductDockerID identifies a product or a specific Docker builder for a product. A ProductDockerID is one of the following:
- {{ProductID}} (e.g. "foo"), which specifies that all Docker images for the product should be built
- {{ProductID}}.{{DockerID}} (e.g. "foo.prod-docker"), which specifies that the specified DockerID for the specified product should be built
func NewProductDockerID ¶
func NewProductDockerID(productID ProductID, dockerID DockerID) ProductDockerID
func ToProductDockerIDs ¶
func ToProductDockerIDs(in []string) []ProductDockerID
func (ProductDockerID) Parse ¶
func (id ProductDockerID) Parse() (ProductID, DockerID)
type ProductErrors ¶
func (*ProductErrors) Error ¶
func (e *ProductErrors) Error() string
type ProductID ¶
type ProductID string
func ToProductIDs ¶
func TopoSortProductParams ¶
func TopoSortProductParams(projectParam ProjectParam, allProducts map[ProductID]struct{}) (map[ProductID]ProductParam, []ProductID, error)
type ProductOutputInfo ¶
type ProductOutputInfo struct { ID ProductID `json:"productId"` BuildOutputInfo *BuildOutputInfo `json:"buildOutputInfo"` DistOutputInfos *DistOutputInfos `json:"distOutputInfos"` PublishOutputInfo *PublishOutputInfo `json:"publishOutputInfo"` DockerOutputInfos *DockerOutputInfos `json:"dockerOutputInfos"` }
type ProductParam ¶
type ProductParam struct { // ID is the unique identifier for this product. Its value comes from the key for the product in the Products map in // the configuration. ID ProductID // Build specifies the build configuration for the product. Build *BuildParam // Run specifies the run configuration for the product. Run *RunParam // Dist specifies the dist configuration for the product. Dist *DistParam // Publish specifies the publish configuration for the product. Publish *PublishParam // Docker specifies the Docker configuration for the product. Docker *DockerParam // FirstLevelDependencies stores the IDs of the products that are declared as dependencies of this product. FirstLevelDependencies []ProductID // AllDependencies stores all of the dependent products of this product. It is a result of expanding all of the // dependencies in FirstLevelDependencies. AllDependencies map[ProductID]ProductParam }
func ProductParamsForBuildProductArgs ¶
func ProductParamsForBuildProductArgs(inputProducts map[ProductID]ProductParam, productBuildIDs ...ProductBuildID) ([]ProductParam, error)
ProductParamsForBuildProductArgs returns the ProductParams from the provided inputProducts for the specified ProductBuildIDs. The ProductParam values in the returned slice will reflect the items specified by the build IDs. For example, if the project defines a product "foo" with OS-Archs "darwin-amd64" and "linux-amd64" and the productBuildID is "foo.darwin-amd64", the returned ProductParam will only contain "darwin-amd64" in the build configuration. Returns an error if any of the productBuildID values cannot be resolved to a configuration in the provided inputProducts.
func ProductParamsForDistProductArgs ¶
func ProductParamsForDistProductArgs(inputProducts map[ProductID]ProductParam, productDistIDs ...ProductDistID) ([]ProductParam, error)
ProductParamsForDistProductArgs returns the ProductParams from the provided inputProducts for the specified productDistIDs. The ProductParam values in the returned slice will reflect the items specified by the dister IDs. For example, if the project defines a product "foo" with DistParams "os-arch-bin" and "manual" and the productDistID is "foo.os-arch-bin", the returned ProductParam will only contain "os-arch-bin" in the dist configuration. Returns an error if any of the productDistID values cannot be resolved to a configuration in the provided inputProducts.
func ProductParamsForDockerProductArgs ¶
func ProductParamsForDockerProductArgs(inputProducts map[ProductID]ProductParam, productDockerIDs ...ProductDockerID) ([]ProductParam, error)
ProductParamsForDockerProductArgs returns the ProductParams from the provided inputProducts for the specified productDockerIDs. The ProductParam values in the returned slice will reflect the items specified by the DockerIDs. For example, if the project defines a product "foo" with DockerBuilderParams "docker-prod" and "docker-dev" and the productDockerID is "foo.docker-prod", the returned ProductParam will only contain "docker-prod" in the Docker configuration. Returns an error if any of the productDockerID values cannot be resolved to a configuration in the provided project.
func ProductParamsForProductArgs ¶
func ProductParamsForProductArgs(inputProducts map[ProductID]ProductParam, productIDs ...ProductID) ([]ProductParam, error)
ProductParamsForProductArgs returns the ProductParams from the provided inputProducts for the specified ProductIDs.
Returns an error if any of the ProductID values cannot be resolved to a configuration in the provided inputProducts.
func (*ProductParam) AllDependenciesSortedIDs ¶
func (p *ProductParam) AllDependenciesSortedIDs() []ProductID
func (*ProductParam) AllProductParams ¶
func (p *ProductParam) AllProductParams() []ProductParam
func (*ProductParam) ToProductOutputInfo ¶
func (p *ProductParam) ToProductOutputInfo(version string) (ProductOutputInfo, error)
type ProductTaskOutputInfo ¶
type ProductTaskOutputInfo struct { Project ProjectInfo `json:"project"` Product ProductOutputInfo `json:"product"` Deps map[ProductID]ProductOutputInfo `json:"deps"` }
func ToProductTaskOutputInfo ¶
func ToProductTaskOutputInfo(projectInfo ProjectInfo, productParam ProductParam) (ProductTaskOutputInfo, error)
func (*ProductTaskOutputInfo) AllProductOutputInfos ¶
func (p *ProductTaskOutputInfo) AllProductOutputInfos() []ProductOutputInfo
func (*ProductTaskOutputInfo) AllProductOutputInfosMap ¶
func (p *ProductTaskOutputInfo) AllProductOutputInfosMap() map[ProductID]ProductOutputInfo
func (*ProductTaskOutputInfo) POM ¶
func (p *ProductTaskOutputInfo) POM(groupID string) (string, string, error)
func (*ProductTaskOutputInfo) ProductBuildArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductBuildArtifactPaths() map[osarch.OSArch]string
func (*ProductTaskOutputInfo) ProductBuildOutputDir ¶
func (p *ProductTaskOutputInfo) ProductBuildOutputDir() string
func (*ProductTaskOutputInfo) ProductDistArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDistArtifactPaths() map[DistID][]string
func (*ProductTaskOutputInfo) ProductDistOutputDir ¶
func (p *ProductTaskOutputInfo) ProductDistOutputDir(distID DistID) string
func (*ProductTaskOutputInfo) ProductDistWorkDirs ¶
func (p *ProductTaskOutputInfo) ProductDistWorkDirs() map[DistID]string
func (*ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDistWorkDirsAndArtifactPaths() map[DistID][]string
func (*ProductTaskOutputInfo) ProductDockerBuildArtifactPaths ¶
func (*ProductTaskOutputInfo) ProductDockerDistArtifactPaths ¶
func (p *ProductTaskOutputInfo) ProductDockerDistArtifactPaths() map[DockerID]map[ProductID]map[DistID][]string
type ProjectConfig ¶
type ProjectConfig struct { // Products maps product names to configurations. Products map[ProductID]ProductConfig `yaml:"products"` // ProductDefaults specifies the default values that should be used for unspecified values in the products map. If a // field in a top-level key in a "ProductConfig" value in the "Products" map is nil and the corresponding value in // ProductDefaults is non-nil, the value in ProductDefaults is used. ProductDefaults ProductConfig `yaml:"product-defaults"` // ScriptIncludes specifies a string that is appended to every script that is written out. Can be used to define // functions or constants for all scripts. ScriptIncludes string `yaml:"script-includes"` // VersionFunc is a shell script that specifies how the "version" string is generated for a project. If specified, // the content of the string is written to a temporary file and executed with the project directory as the working // directory. The first line of the output is used as the version for the project (and if the output is blank, // "unspecified" is used). If VersionFunc is blank, the output of the git.ProjectVersion function is used. VersionScript string `yaml:"version-script"` // Exclude matches the paths to exclude when determining the projects to build. Exclude matcher.NamesPathsCfg `yaml:"exclude"` }
func LoadConfig ¶
func LoadConfig(cfgBytes []byte) (ProjectConfig, error)
func LoadConfigFromFile ¶
func LoadConfigFromFile(cfgFile string) (ProjectConfig, error)
func (*ProjectConfig) ToParam ¶
func (cfg *ProjectConfig) ToParam(projectDir string, disterFactory DisterFactory, defaultDisterCfg DisterConfig, dockerBuilderFactory DockerBuilderFactory) (ProjectParam, error)
type ProjectInfo ¶
type ProjectParam ¶
type ProjectParam struct { // Products contains the parameters for the defined products. Products map[ProductID]ProductParam // ScriptIncludes specifies a string that is appended to every script that is written out. Can be used to define // functions or constants for all scripts. ScriptIncludes string // VersionFunc is a shell script that specifies how the "version" string is generated for a project. If specified, // the content of the string is written to a temporary file and executed with the project directory as the working // directory. The first line of the output is used as the version for the project (and if the output is blank, // "unspecified" is used). If VersionFunc is blank, the output of the git.ProjectVersion function is used. VersionScript string // Exclude is a matcher that matches any directories that should be ignored as main files. Only relevant if products // are not specified. Exclude matcher.Matcher }
func (*ProjectParam) ProjectInfo ¶
func (p *ProjectParam) ProjectInfo(projectDir string) (ProjectInfo, error)
type PublishConfig ¶
type PublishConfig struct { // GroupID is the product-specific configuration equivalent to the global GroupID configuration. GroupID *string `yaml:"group-id"` // PublishInfo contains extra configuration for the publish operation. The key is the type of publish and the value // is the configuration for that publish operation type. PublishInfo *map[PublishID]yaml.MapSlice `yaml:"info"` }
func (*PublishConfig) ToParam ¶
func (cfg *PublishConfig) ToParam(defaultCfg PublishConfig) (PublishParam, error)
type PublishOutputInfo ¶
type PublishOutputInfo struct {
GroupID string `json:"groupId"`
}
type PublishParam ¶
type PublishParam struct { // GroupID is the Maven group ID used for the publish operation. GroupID string // PublishInfo contains extra configuration for the publish operation. The key is the type of publish and the value // is the raw YAML configuration for that publish operation type. PublishInfo map[PublishID][]byte }
func (*PublishParam) ToPublishOutputInfo ¶
func (p *PublishParam) ToPublishOutputInfo() PublishOutputInfo
type Publisher ¶
type Publisher interface { // TypeName returns the type of this publisher. TypeName() (string, error) // Flags returns the flags provided by this Publisher. Flags() ([]PublisherFlag, error) // RunPublish runs the publish task. When this function is called, the distribution artifacts for the product should // already exist. If dryRun is true, then the task should print the operations that would occur without actually // executing them. RunPublish(productTaskOutputInfo ProductTaskOutputInfo, cfgYML []byte, flagVals map[PublisherFlagName]interface{}, dryRun bool, stdout io.Writer) error }
type PublisherFlag ¶
type PublisherFlag struct { Name PublisherFlagName Description string Type FlagType }
func (PublisherFlag) AddFlag ¶
func (f PublisherFlag) AddFlag(fset *pflag.FlagSet) (interface{}, error)
AddFlag adds the flag represented by PublisherFlag to the provided pflag.FlagSet. Returns the pointer to the value that can be used to retrieve the value.
func (PublisherFlag) GetFlagValue ¶
func (f PublisherFlag) GetFlagValue(fset *pflag.FlagSet) (interface{}, error)
func (PublisherFlag) ToFlagArgs ¶
func (f PublisherFlag) ToFlagArgs(flagVal interface{}) ([]string, error)
ToFlagArgs takes the input parameter (which should be the value returned by calling AddFlag for the receiver) and returns a string slice that reconstructs the flag arguments for the given flag.
type PublisherFlagName ¶
type PublisherFlagName string
type RunConfig ¶
type RunConfig struct { // Args contain the arguments provided to the product when invoked using the "run" task. Args *[]string `yaml:"args"` }
func (*RunConfig) ToParam ¶
ToParam returns the RunParam represented by the receiver *RunConfig and the provided default RunConfig. If a config value is specified (non-nil) in the receiver config, it is used. If a config value is not specified in the receiver config but is specified in the default config, the default config value is used. If a value is not specified in either configuration, the program-specified default value (if any) is used.
type RunParam ¶
type RunParam struct { // Args contain the arguments provided to the product when invoked using the "run" task. Args []string }
type TemplateFunction ¶
func GroupIDTemplateFunction ¶
func GroupIDTemplateFunction(groupID string) TemplateFunction
func ProductTemplateFunction ¶
func ProductTemplateFunction(productID ProductID) TemplateFunction
func RepositoryTemplateFunction ¶
func RepositoryTemplateFunction(repository string) TemplateFunction
func TemplateValueFunction ¶
func TemplateValueFunction(key string, val interface{}) TemplateFunction
func VersionTemplateFunction ¶
func VersionTemplateFunction(version string) TemplateFunction