builders

package
v0.6.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2018 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(moduleType module.Type) module.Builder

New instantiates a Builder given a ModuleType

Types

type AntBuilder added in v0.6.1

type AntBuilder struct {
	AntCmd     string
	AntVersion string

	JavaCmd     string
	JavaVersion string
}

AntBuilder implements build context for SBT builds

func (*AntBuilder) Analyze added in v0.6.1

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

Analyze resolves a lib directory and parses the jars inside

func (*AntBuilder) Build added in v0.6.1

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

Build is currently not implemented

func (*AntBuilder) DiscoverModules added in v0.6.1

func (builder *AntBuilder) DiscoverModules(dir string) ([]module.Config, error)

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

func (*AntBuilder) Initialize added in v0.6.1

func (builder *AntBuilder) Initialize() error

Initialize collects metadata on Java and SBT binaries

func (*AntBuilder) IsBuilt added in v0.6.1

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

IsBuilt always returns true for Ant builds

func (*AntBuilder) IsModule added in v0.6.1

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

IsModule is not implemented

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 the output of `bower ls --json` TODO: fall back to old method of reading `bower_components/*/.bower.json`s?

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) ([]module.Config, 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 BowerConfiguration added in v0.5.1

type BowerConfiguration struct {
	Cwd       string `json:"cwd"`
	Directory string `json:"directory"`
	Registry  string `json:"registry"`
}

type CocoapodsBuilder added in v0.6.1

type CocoapodsBuilder struct {
	CocoapodsCmd     string
	CocoapodsVersion string
}

CocoapodsBuilder implements Builder for Cocoapods (podfile & podfile.lock) builds

func (*CocoapodsBuilder) Analyze added in v0.6.1

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

Analyze parses the `podfile.lock` YAML file and analyzes

func (*CocoapodsBuilder) Build added in v0.6.1

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

Build runs `pod install`

func (*CocoapodsBuilder) DiscoverModules added in v0.6.1

func (builder *CocoapodsBuilder) DiscoverModules(dir string) ([]module.Config, error)

DiscoverModules returns ModuleConfigs that match Podfile(.lock) in the directory

func (*CocoapodsBuilder) Initialize added in v0.6.1

func (builder *CocoapodsBuilder) Initialize() error

Initialize collects metadata on Cocoapods

func (*CocoapodsBuilder) IsBuilt added in v0.6.1

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

IsBuilt checks whether `Podfile.lock` exists

func (*CocoapodsBuilder) IsModule added in v0.6.1

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

IsModule is not implemented

type CocoapodsModule added in v0.6.1

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

CocoapodsModule implements Dependency for Cocoapods builds

func (CocoapodsModule) Fetcher added in v0.6.1

func (m CocoapodsModule) Fetcher() string

Fetcher always returns pod for CocoapodsModule

func (CocoapodsModule) Package added in v0.6.1

func (m CocoapodsModule) Package() string

Package returns the package spec for CocoapodsModule

func (CocoapodsModule) Revision added in v0.6.1

func (m CocoapodsModule) Revision() string

Revision returns the version spec for CocoapodsModule

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) ([]module.Config, 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 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) ([]module.Config, 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 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) ([]module.Config, 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 Imported added in v0.6.1

type Imported struct {
	module.Locator
	From module.ImportPath
}

type MavenArtifact

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

MavenArtifact implements Dependency for Maven builds

func (MavenArtifact) Dependencies added in v0.6.1

func (m MavenArtifact) Dependencies() []module.Dependency

Dependencies is not implemented for MavenArtifact

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=true` and cleans with `mvn clean`

func (*MavenBuilder) DiscoverModules

func (builder *MavenBuilder) DiscoverModules(dir string) ([]module.Config, 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 runs and parses `npm ls --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) ([]module.Config, 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 NuGetBuilder added in v0.5.0

type NuGetBuilder struct {
	DotNETCmd     string
	DotNETVersion string
	NuGetCmd      string
	NuGetVersion  string
}

NuGetBuilder implements Builder for Bundler (Gemfile) builds

func (*NuGetBuilder) Analyze added in v0.5.0

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

Analyze parses the output of NuGet lockfiles and falls back to parsing the packages folder

func (*NuGetBuilder) Build added in v0.5.0

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

Build runs `dotnet restore` and falls back to `nuget restore`

func (*NuGetBuilder) DiscoverModules added in v0.5.0

func (builder *NuGetBuilder) DiscoverModules(dir string) ([]module.Config, error)

DiscoverModules returns ModuleConfigs that match `packages.config` in the directory

func (*NuGetBuilder) Initialize added in v0.5.0

func (builder *NuGetBuilder) Initialize() error

Initialize collects metadata on NuGet and NuGet environments

func (*NuGetBuilder) IsBuilt added in v0.5.0

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

IsBuilt checks the existance of a lockfile or a packages directory

func (*NuGetBuilder) IsModule added in v0.5.0

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

IsModule is not implemented

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 PipBuilder added in v0.5.0

type PipBuilder struct {
	PythonCmd     string
	PythonVersion string

	PipCmd     string
	PipVersion string

	Virtualenv string
}

PipBuilder implements Builder for Pip. These properties are public for the sake of serialization.

func (*PipBuilder) Analyze added in v0.5.0

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

Analyze runs `pipdeptree.py` in the current environment

func (*PipBuilder) Build added in v0.5.0

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

Build runs `pip install -r requirements.txt`

func (*PipBuilder) DiscoverModules added in v0.5.0

func (builder *PipBuilder) DiscoverModules(dir string) ([]module.Config, error)

DiscoverModules builds ModuleConfigs for any `requirements.txt` files

func (*PipBuilder) Initialize added in v0.5.0

func (builder *PipBuilder) Initialize() error

Initialize collects metadata on Python and Pip binaries

func (*PipBuilder) IsBuilt added in v0.5.0

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

IsBuilt checks for the existence of `requirements.txt`

func (*PipBuilder) IsModule added in v0.5.0

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

IsModule is not implemented

type PodFileLock added in v0.6.1

type PodFileLock struct {
	Pods            []interface{}                `yaml:"PODS,omitempty"`         // transitive deps + path
	Dependencies    []string                     `yaml:"DEPENDENCIES,omitempty"` // top level deps
	CheckoutOptions map[string]map[string]string `yaml:"CHECKOUT OPTIONS,omitempty"`
}

PodFileLock models Podfile.lock yaml file

Note: we set Pods to `[]interface{}` because Golang doesn't support ADT's.
The PODS section of Podfile.lock is actually [](map[string][]string | string)

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 a `Gemfile.lock`

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) ([]module.Config, 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 `Gemfile.lock` exists

func (*RubyBuilder) IsModule

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

IsModule is not implemented

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 dependencyTree`

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) ([]module.Config, 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 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) ([]module.Config, 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