Пример #1
0
func PhonyBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Actions.AtLeast(1).Dependencies.Exactly(0).Targets.Exactly(1).Verify(definition); err != nil {
		return nil, err
	}
	return &PhonyTarget{
		id:      buildkit.ID(),
		command: strings.Join(definition.Actions, "\n"),
	}, nil
}
Пример #2
0
func ServiceBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Actions.Exactly(1).Dependencies.AtLeast(0).Verify(definition); err != nil {
		return nil, err
	}
	return &ServiceTarget{
		id:      buildkit.ID(),
		deps:    append(definition.Targets, definition.Dependencies...),
		command: strings.Join(definition.Actions, "\n"),
	}, nil
}
Пример #3
0
func LessBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Targets.Exactly(1).Dependencies.Exactly(1).Verify(definition); err != nil {
		return nil, err
	}
	return &LessTarget{
		id:     buildkit.ID(),
		dest:   definition.Targets[0],
		source: definition.Dependencies[0],
	}, nil
}
Пример #4
0
// PackageBuilder is a factory for building and installing Go packages.
//
// eg.
//
// 		package <pkg> [<pkg> ...]
func PackageBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Dependencies.Exactly(0).Verify(definition); err != nil {
		return nil, err
	}
	// TODO(alec): Correctly set "dest" to output archive.
	return &BuildTarget{
		id:   buildkit.ID(),
		name: "go.package",
		pkgs: definition.Targets,
	}, nil
}
Пример #5
0
func BinaryBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Dependencies.Exactly(1).Verify(definition); err != nil {
		return nil, err
	}
	return &BuildTarget{
		id:   buildkit.ID(),
		name: "go.binary",
		dest: definition.Targets[0],
		pkgs: definition.Dependencies,
	}, nil
}
Пример #6
0
func GenerateBuilder(definition *config.Target) (buildkit.Target, error) {
	if err := config.Constrain().Targets.AtLeast(2).Verify(definition); err != nil {
		return nil, err
	}
	return Generate(definition.Targets[0], definition.Targets[1:], definition.Dependencies)
}