builders

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2018 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BowerBuilder

type BowerBuilder struct {
	NodeCmd     string
	NodeVersion string

	BowerCmd     string
	BowerVersion string
}

BowerBuilder implements Builder for Bower

func (*BowerBuilder) Analyze

func (builder *BowerBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze reads dependency manifests at `$PROJECT/**/bower_components/*/.bower.json`

func (*BowerBuilder) Build

func (builder *BowerBuilder) Build(m module.Module, force bool) error

Build runs `bower install --production` and cleans with `rm -rf bower_components`

func (*BowerBuilder) DiscoverModules

func (builder *BowerBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules finds any bower.json modules not in node_modules or bower_components folders

func (*BowerBuilder) Initialize

func (builder *BowerBuilder) Initialize() error

Initialize collects metadata on Node and Bower binaries

func (*BowerBuilder) IsBuilt

func (builder *BowerBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks for the existence of `$PROJECT/bower_components`

func (*BowerBuilder) IsModule

func (builder *BowerBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type BowerComponent

type BowerComponent struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

BowerComponent implements Dependency for BowerBuilder

func (BowerComponent) Fetcher

func (m BowerComponent) Fetcher() string

Fetcher always returns bower for BowerComponent

func (BowerComponent) Package

func (m BowerComponent) Package() string

Package returns the package name for BowerComponent

func (BowerComponent) Revision

func (m BowerComponent) Revision() string

Revision returns the version for BowerComponent

type Builder

type Builder interface {
	// Initialize gathers build environment information and does build setup.
	Initialize() error
	// Build runs a best-effort attempt at building the module.
	Build(m module.Module, force bool) error
	// Analyze returns the dependencies of a module.
	Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

	// IsBuilt checks whether a module has been built.
	IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

	// IsModule takes a string like and returns whether it matches to elect this Builder.
	IsModule(configKey string) (bool, error)
	// DiscoverModules finds what modules are available for analysis in a given directory.
	DiscoverModules(dir string) ([]config.ModuleConfig, error)
}

A Builder is an implementation of functionality for different build systems.

func New

func New(moduleType config.ModuleType) Builder

New instantiates a Builder given a ModuleType

type ComposerBuilder

type ComposerBuilder struct {
	PHPCmd     string
	PHPVersion string

	ComposerCmd     string
	ComposerVersion string
}

ComposerBuilder implements Builder for Composer (composer.json) builds

func (*ComposerBuilder) Analyze

func (builder *ComposerBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze parses the output of `composer show -f json --no-ansi`

func (*ComposerBuilder) Build

func (builder *ComposerBuilder) Build(m module.Module, force bool) error

Build runs `composer install --prefer-dist --no-dev` and cleans with `rm -rf vendor`

func (*ComposerBuilder) DiscoverModules

func (builder *ComposerBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules finds composer.json modules not a /vendor/ folder

func (*ComposerBuilder) Initialize

func (builder *ComposerBuilder) Initialize() error

Initialize collects metadata on PHP and Composer binaries

func (*ComposerBuilder) IsBuilt

func (builder *ComposerBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks whether `composer show --no-ansi` produces output

func (*ComposerBuilder) IsModule

func (builder *ComposerBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type ComposerPackage

type ComposerPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ComposerPackage implements Dependency for Composer

func (ComposerPackage) Fetcher

func (m ComposerPackage) Fetcher() string

Fetcher always returns comp for ComposerPackage

func (ComposerPackage) Package

func (m ComposerPackage) Package() string

Package returns the package spec for ComposerPackage

func (ComposerPackage) Revision

func (m ComposerPackage) Revision() string

Revision returns the version spec for ComposerPackage

type GoBuilder

type GoBuilder struct {
	GoCmd     string
	GoVersion string

	// dep
	DepCmd     string
	DepVersion string

	// glide
	GlideCmd     string
	GlideVersion string

	// godep
	GodepCmd     string
	GodepVersion string

	// govendor
	GovendorCmd     string
	GovendorVersion string

	// vndr
	VndrCmd     string
	VndrVersion string

	// gdm
	GdmCmd     string
	GdmVersion string
}

GoBuilder implements Builder for Golang projects

func (*GoBuilder) Analyze

func (builder *GoBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze traces imports and then looks up revisions in lockfiles

func (*GoBuilder) Build

func (builder *GoBuilder) Build(m module.Module, force bool) error

Build contextually runs a build tool

func (*GoBuilder) DiscoverModules

func (builder *GoBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules walks subdirectories for a Go file with `package main`.

func (*GoBuilder) Initialize

func (builder *GoBuilder) Initialize() error

Initialize collects metadata on Go, Dep, Glide, Godep, Govendor, and Vndr binaries.

func (*GoBuilder) IsBuilt

func (builder *GoBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks whether imports are traceable and lockfiles are available

func (*GoBuilder) IsModule

func (builder *GoBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type GoPkg

type GoPkg struct {
	ImportPath string `json:"name"`
	Version    string `json:"version"` // This is actually the Git revision, but `.Revision()` is already taken by Dependency.
	// contains filtered or unexported fields
}

GoPkg implements Dependency for Golang projects.

func (GoPkg) Fetcher

func (g GoPkg) Fetcher() string

Fetcher returns "go".

func (GoPkg) Package

func (g GoPkg) Package() string

Package returns the package's import path.

func (GoPkg) Revision

func (g GoPkg) Revision() string

Revision returns the package's resolved Git revision.

type GradleBuilder added in v0.4.1

type GradleBuilder struct {
	GradleCmd     string
	GradleVersion string
}

GradleBuilder implements Builder for build.gradle builds

func (*GradleBuilder) Analyze added in v0.4.1

func (builder *GradleBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze parses the output of `gradle -q app:dependencies`

func (*GradleBuilder) Build added in v0.4.1

func (builder *GradleBuilder) Build(m module.Module, force bool) error

Build is not implemented

func (*GradleBuilder) DiscoverModules added in v0.4.1

func (builder *GradleBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules finds either a root build.gradle file in the specified dir

func (*GradleBuilder) Initialize added in v0.4.1

func (builder *GradleBuilder) Initialize() error

Initialize collects metadata on Java and Maven binaries

func (*GradleBuilder) IsBuilt added in v0.4.1

func (builder *GradleBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt is not implemented

func (*GradleBuilder) IsModule added in v0.4.1

func (builder *GradleBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type MavenArtifact

type MavenArtifact struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

MavenArtifact implements Dependency for Maven builds

func (MavenArtifact) Fetcher

func (m MavenArtifact) Fetcher() string

Fetcher always returns mvn for MavenArtifact

func (MavenArtifact) Package

func (m MavenArtifact) Package() string

Package returns the package spec for MavenArtifact

func (MavenArtifact) Revision

func (m MavenArtifact) Revision() string

Revision returns the version spec for MavenArtifact

type MavenBuilder

type MavenBuilder struct {
	JavaCmd     string
	JavaVersion string

	MvnCmd     string
	MvnVersion string
}

MavenBuilder implements Builder for Apache Maven (*.pom.xml) builds

func (*MavenBuilder) Analyze

func (builder *MavenBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze parses the output of `mvn dependency:list`

func (*MavenBuilder) Build

func (builder *MavenBuilder) Build(m module.Module, force bool) error

Build runs `mvn install -DskipTests -Drat.skip=trucould not removee` and cleans with `mvn clean`

func (*MavenBuilder) DiscoverModules

func (builder *MavenBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules finds either a root pom.xml file or all pom.xmls in the specified dir

func (*MavenBuilder) Initialize

func (builder *MavenBuilder) Initialize() error

Initialize collects metadata on Java and Maven binaries

func (*MavenBuilder) IsBuilt

func (builder *MavenBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks whether `mvn dependency:list` produces output.

func (*MavenBuilder) IsModule

func (builder *MavenBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type NodeJSBuilder

type NodeJSBuilder struct {
	NodeCmd     string
	NodeVersion string

	NPMCmd     string
	NPMVersion string

	YarnCmd     string
	YarnVersion string
}

NodeJSBuilder implements Builder for Nodejs. These properties are public for the sake of serialization.

func (*NodeJSBuilder) Analyze

func (builder *NodeJSBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze reads dependency manifests at `$PROJECT/**/node_modules/*/package.json`

func (*NodeJSBuilder) Build

func (builder *NodeJSBuilder) Build(m module.Module, force bool) error

Build runs either `yarn install --production --frozen-lockfile` or `npm install --production` and cleans with `rm -rf node_modules`

func (*NodeJSBuilder) DiscoverModules

func (builder *NodeJSBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules builds ModuleConfigs for any package.jsons that are not contained in a node_modules dir

func (*NodeJSBuilder) Initialize

func (builder *NodeJSBuilder) Initialize() error

Initialize collects metadata on Node, NPM, and Yarn binaries

func (*NodeJSBuilder) IsBuilt

func (builder *NodeJSBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks for the existence of `$PROJECT/node_modules`

func (*NodeJSBuilder) IsModule

func (builder *NodeJSBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type NodeModule

type NodeModule struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

NodeModule implements Dependency for NodeJSBuilder.

func (NodeModule) Fetcher

func (m NodeModule) Fetcher() string

Fetcher always returns npm for NodeModule. TODO: Support git and other dependency sources.

func (NodeModule) Package

func (m NodeModule) Package() string

Package returns the package name for NodeModule

func (NodeModule) Revision

func (m NodeModule) Revision() string

Revision returns the version for NodeModule

type POMFile

type POMFile struct {
	XMLName     xml.Name `xml:"project"`
	ArtifactID  string   `xml:"artifactId"`
	GroupID     string   `xml:"groupId"`
	Version     string   `xml:"version"`
	Description string   `xml:"description"`
	Name        string   `xml:"name"`
	URL         string   `xml:"url"`
}

POMFile represents the schema of a common pom.xml file

type RubyBuilder

type RubyBuilder struct {
	BundlerCmd     string
	BundlerVersion string

	GemCmd     string
	GemVersion string

	RubyCmd     string
	RubyVersion string
}

RubyBuilder implements Builder for Bundler (Gemfile) builds

func (*RubyBuilder) Analyze

func (builder *RubyBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze parses the output of `bundler list`

func (*RubyBuilder) Build

func (builder *RubyBuilder) Build(m module.Module, force bool) error

Build runs `bundler install --deployment --frozen` and cleans with `rm Gemfile.lock`

func (*RubyBuilder) DiscoverModules

func (builder *RubyBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules returns ModuleConfigs that match Gemfiles in the directory

func (*RubyBuilder) Initialize

func (builder *RubyBuilder) Initialize() error

Initialize collects metadata on Ruby, Gem, and Bundler binaries

func (*RubyBuilder) IsBuilt

func (builder *RubyBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks whether `bundler check` exits with an error

func (*RubyBuilder) IsModule

func (builder *RubyBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type RubyGem

type RubyGem struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

RubyGem implements Dependency for Bundler and RubyGems.

func (RubyGem) Fetcher

func (m RubyGem) Fetcher() string

Fetcher always returns gem for RubyGem

func (RubyGem) Package

func (m RubyGem) Package() string

Package returns the package spec for RubyGem

func (RubyGem) Revision

func (m RubyGem) Revision() string

Revision returns the version spec for RubyGem

type SBTBuilder

type SBTBuilder struct {
	SBTCmd     string
	SBTVersion string

	JavaCmd     string
	JavaVersion string
}

SBTBuilder implements build context for SBT builds

func (*SBTBuilder) Analyze

func (builder *SBTBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze parses the output of `sbt -no-colors dependencyList`

func (*SBTBuilder) Build

func (builder *SBTBuilder) Build(m module.Module, force bool) error

Build runs `sbt compile` and cleans with `sbt clean`

func (*SBTBuilder) DiscoverModules

func (builder *SBTBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules returns a root build.sbt if found, and build configs for all sub-projects otherwise

func (*SBTBuilder) Initialize

func (builder *SBTBuilder) Initialize() error

Initialize collects metadata on Java and SBT binaries

func (*SBTBuilder) IsBuilt

func (builder *SBTBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt checks whether dependencies are ready for scanning.

func (*SBTBuilder) IsModule

func (builder *SBTBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

type SBTLibrary

type SBTLibrary struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

SBTLibrary implements Dependency for SBT library dependencies

func (SBTLibrary) Fetcher

func (m SBTLibrary) Fetcher() string

Fetcher always returns mvn for SBTLibrary

func (SBTLibrary) Package

func (m SBTLibrary) Package() string

Package returns the package spec for SBTLibrary

func (SBTLibrary) Revision

func (m SBTLibrary) Revision() string

Revision returns the version spec for SBTLibrary

type VendoredArchiveBuilder

type VendoredArchiveBuilder struct {
	RpmCmd     string
	RpmVersion string
}

VendoredArchiveBuilder implements Builder for projects that have archive-formatted rawDependencies encapsulating another supported build system

func (*VendoredArchiveBuilder) Analyze

func (builder *VendoredArchiveBuilder) Analyze(m module.Module, allowUnresolved bool) ([]module.Dependency, error)

Analyze scans for archives and inspects them

func (*VendoredArchiveBuilder) Build

func (builder *VendoredArchiveBuilder) Build(m module.Module, force bool) error

Build does nothing for VendoredArchives

func (*VendoredArchiveBuilder) DiscoverModules

func (builder *VendoredArchiveBuilder) DiscoverModules(dir string) ([]config.ModuleConfig, error)

DiscoverModules is not implemented for VendoredArchiveBuilder, instead it must be explicitly configured

func (*VendoredArchiveBuilder) Initialize

func (builder *VendoredArchiveBuilder) Initialize() error

Initialize gathers environment context.

func (*VendoredArchiveBuilder) IsBuilt

func (builder *VendoredArchiveBuilder) IsBuilt(m module.Module, allowUnresolved bool) (bool, error)

IsBuilt always returns true assuming vendored deps are already included

func (*VendoredArchiveBuilder) IsModule

func (builder *VendoredArchiveBuilder) IsModule(target string) (bool, error)

IsModule is not implemented

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL