build

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: AGPL-3.0 Imports: 14 Imported by: 0

README

Integration Docs

This file contains implementation-specific details for different language integrations.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Locator

func Locator(d Dependency) string

Locator transforms Dependencies into locator strings

Types

type BowerContext

type BowerContext struct {
	BowerCmd     string
	BowerVersion string
	// contains filtered or unexported fields
}

func (*BowerContext) Build

func (ctx *BowerContext) Build(m *Module, opts map[string]interface{}) error

Build determines and executes a CommonJS build based off available tooling in the environment

func (*BowerContext) Initialize

func (ctx *BowerContext) Initialize(m *Module, opts map[string]interface{})

Initialize collects environment data for CommonJS builds

func (*BowerContext) Verify

func (ctx *BowerContext) Verify(m *Module, opts map[string]interface{}) bool

Verify checks if an install needs to be run

type Build

type Build struct {
	Artifact string        // i.e. dev_server
	Context  *BuildContext `json:",omitempty"` // build context

	Succeeded bool
	Error     error `json:",omitempty"`

	RawDependencies []Dependency `json:"-"`
	Dependencies    []NormalizedDependency
}

Build represents a task that builds a single artifact and generates dependency lists

func (*Build) Run

func (b *Build) Run(m *Module, opts map[string]interface{}) error

Run initializes and executes the build context

type BuildContext

type BuildContext interface {
	Initialize(m *Module, opts map[string]interface{})
	Verify(m *Module, opts map[string]interface{}) bool
	Build(m *Module, opts map[string]interface{}) error
}

BuildContext describes instances that contain metadata and logic to run a build

type CommonJSContext

type CommonJSContext struct {
	NodeCmd     string
	NodeVersion string

	NpmCmd     string
	NpmVersion string

	YarnCmd         string
	YarnVersion     string
	HasYarnLockFile bool
	// contains filtered or unexported fields
}

CommonJSContext implements build context for node_module & package.json builds

func (*CommonJSContext) Build

func (ctx *CommonJSContext) Build(m *Module, opts map[string]interface{}) error

Build determines and executes a CommonJS build based off available tooling in the environment

func (*CommonJSContext) Initialize

func (ctx *CommonJSContext) Initialize(m *Module, opts map[string]interface{})

Initialize collects environment data for CommonJS builds

func (*CommonJSContext) Verify

func (ctx *CommonJSContext) Verify(m *Module, opts map[string]interface{}) bool

Verify checks if an install needs to be run

type CommonJSModule

type CommonJSModule struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	// contains filtered or unexported fields
}

CommonJSModule represents metadata from package.json files

func (CommonJSModule) Fetcher

func (m CommonJSModule) Fetcher() string

Fetcher always returns npm for CommonJSModules

func (CommonJSModule) Package

func (m CommonJSModule) Package() string

Package returns the package spec for CommonJSModules

func (CommonJSModule) Revision

func (m CommonJSModule) Revision() string

Revision returns the version spec for CommonJSModules

type ComposerContext

type ComposerContext struct {
	ComposerCmd     string
	ComposerVersion string

	PhpCmd     string
	PhpVersion string
	// contains filtered or unexported fields
}

ComposerContext implements build context for Composer (composer.json) builds

func (*ComposerContext) Build

func (ctx *ComposerContext) Build(m *Module, opts map[string]interface{}) error

Build runs Bundler and collect dep data

func (*ComposerContext) Initialize

func (ctx *ComposerContext) Initialize(p *Module, opts map[string]interface{})

Initialize collects environment data for Bundler builds

func (*ComposerContext) Verify

func (ctx *ComposerContext) Verify(m *Module, opts map[string]interface{}) bool

Verify checks if the bundler is satisfied and if an install is necessary

type ComposerPackage

type ComposerPackage struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	// contains filtered or unexported fields
}

ComposerPackage represents metadata from Composer files

func (ComposerPackage) Fetcher

func (m ComposerPackage) Fetcher() string

Fetcher always returns npm 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 Dependency

type Dependency interface {

	// locator fields
	Fetcher() string
	Package() string
	Revision() string
}

Dependency represents a code library brought in by running a Build

func Dedupe

func Dedupe(dependencies []Dependency) []Dependency

Dedupe removes duplicates from a []Dependency

type GemContext

type GemContext struct {
	GemCmd     string
	GemVersion string

	BundlerCmd     string
	BundlerVersion string
	// contains filtered or unexported fields
}

GemContext implements build context for Bundler (Gemfile and *.gemspec) builds

func (*GemContext) Build

func (ctx *GemContext) Build(m *Module, opts map[string]interface{}) error

Build runs Bundler and collect dep data

func (*GemContext) Initialize

func (ctx *GemContext) Initialize(p *Module, opts map[string]interface{})

Initialize collects environment data for Bundler builds

func (*GemContext) Verify

func (ctx *GemContext) Verify(m *Module, opts map[string]interface{}) bool

Verify checks if the bundler is satisfied and if an install is necessary

type GolangContext

type GolangContext struct {
	GoCmd     string
	GoVersion string

	// dep
	UsingDep   bool
	DepCmd     string
	DepVersion string

	// glide
	UsingGlide   bool
	GlideCmd     string
	GlideVersion string

	// godep
	UsingGodep   bool
	GodepCmd     string
	GodepVersion string

	// govendor
	UsingGovendor   bool
	GovendorCmd     string
	GovendorVersion string

	// vndr
	UsingVndr   bool
	VndrCmd     string
	VndrVersion string
	// contains filtered or unexported fields
}

GolangContext implements BuildContext for Golang projects

func (*GolangContext) Build

func (ctx *GolangContext) Build(m *Module, opts map[string]interface{}) error

Build scans for dependencies, building if necessary.

func (*GolangContext) Initialize

func (ctx *GolangContext) Initialize(m *Module, opts map[string]interface{})

Initialize gathers environment context.

func (*GolangContext) Verify

func (ctx *GolangContext) Verify(m *Module, opts map[string]interface{}) bool

Verify checks whether dependencies are ready for scanning.

type Gopkg

type Gopkg struct {
	ImportPath string
	Version    string // This is actually the Git revision, but `.Revision()` is already taken.
}

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 MavenArtifact

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

MavenArtifact represents metadata from pom.xml files

func (MavenArtifact) Fetcher

func (m MavenArtifact) Fetcher() string

Fetcher always returns npm 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 MavenContext

type MavenContext struct {
	MvnCmd     string
	MvnVersion string

	JavaCmd     string
	JavaVersion string
	// contains filtered or unexported fields
}

MavenContext implements build context for Apache Maven (*pom.xml) builds

func (*MavenContext) Build

func (ctx *MavenContext) Build(m *Module, opts map[string]interface{}) error

Build runs Bundler and collect dep data

func (*MavenContext) Initialize

func (ctx *MavenContext) Initialize(p *Module, opts map[string]interface{})

Initialize collects environment data for Bundler builds

func (*MavenContext) Verify

func (ctx *MavenContext) Verify(p *Module, opts map[string]interface{}) bool

Verify checks if the bundler is satisfied and if an install is necessary

type Module

type Module struct {
	Name     string
	Type     string
	Manifest string           // Required, path to an entry point for the Module _relative_ to repo root. Used for origin paths & ID.
	Dir      string           `json:",omitempty"`
	Data     *json.RawMessage `json:",omitempty"`

	// TODO: add support for multiple builds via []Build
	Build Build `json:",omitempty"`
}

Module represents a unit of buildable code within a codebase Each Module must have a single entry point / manifest where a build can initiate Currently only single build context is supported per module

func (*Module) Analyze

func (m *Module) Analyze(opts map[string]interface{}) error

Analyze runs all builds that have not yet succeeded

func (*Module) NewBuild

func (m *Module) NewBuild(name string) Build

NewBuild creates a Build to a module given the build type

type NormalizedDependency

type NormalizedDependency struct {
	// Location
	Locator string `json:"locator"`

	// Metadata
	Data *json.RawMessage `json:"data,omitempty"`

	// Context
	Depth              int      `json:"depth,omitempty"`
	Parent             string   `json:"parent,omitempty"`
	UnresolvedLocators []string `json:"unresolved_locators,omitempty"`
}

func Normalize

func Normalize(d Dependency) NormalizedDependency

Normalize transforms a Dependency into a serializable struct

type RubyGem

type RubyGem struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	// contains filtered or unexported fields
}

RubyGem represents metadata from Gemfiles

func (RubyGem) Fetcher

func (m RubyGem) Fetcher() string

Fetcher always returns npm 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

Jump to

Keyboard shortcuts

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