module

package
v0.4.6-1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: MPL-2.0 Imports: 5 Imported by: 51

Documentation

Index

Constants

View Source
const (

	// Bower is the module type for bower.io
	Bower = Type("bower")
	// Composer is the module type for getcomposer.org
	Composer = Type("composer")
	// Maven is the module type for maven.apache.org
	Maven = Type("maven")
	// SBT is the module type for scala-sbt.org
	SBT = Type("sbt")
	// Gradle is the module type for gradle.org
	Gradle = Type("gradle")

	// Ruby is the module type for Bundler (bundler.io)
	Ruby = Type("ruby")
	// Nodejs is the module type for NPM (npmjs.org) and Yarn (yarnpkg.com)
	Nodejs = Type("nodejs")
	// Golang is the module type for dep, glide, godep, govendor, vndr, and manual
	// gopath vendoring
	Golang = Type("golang")

	// VendoredArchives is a module type for archive formats (.tar, .rpm, .zip, etc...)
	VendoredArchives = Type("vendoredarchives")
)

Variables

Types holds the list of all available module types for analysis

Functions

func IsResolved added in v0.4.5

func IsResolved(dep Dependency) bool

Types

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, force bool) error
	// Analyze returns the dependencies of a module.
	Analyze(m Module, allowUnresolved bool) ([]Dependency, error)

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

	// IsModule takes a string module type and returns whether it matches to use this Builder.
	IsModule(key string) (bool, error)
	// DiscoverModules finds what modules are available for analysis in a given directory.
	DiscoverModules(dir string) ([]Config, error)
}

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

type Config added in v0.4.5

type Config struct {
	Name string `yaml:"name"`
	Path string `yaml:"path"`
	Type string `yaml:"type"` // this is later transformed to a module Type
}

Config defines a config for a builder's entry point

type Dependency

type Dependency interface {
	Fetcher() string
	Package() string
	Revision() string
}

Dependency represents a code library brought in by running a Build

type Locator

type Locator string

Locator is a string specifying a particular dependency and revision

func DepLocator added in v0.4.5

func DepLocator(dep Dependency) Locator

func MakeLocator

func MakeLocator(fetcher string, project string, revision string) Locator

MakeLocator creates a locator string given a package and revision

type Module

type Module struct {
	Name string
	Type Type

	// Target is the entry point or manifest path for the build system. The exact
	// meaning is Type-dependent.
	Target string
	// Dir is the absolute path to the module's working directory (the directory
	// you would normally run the build command from).
	Dir string

	// Different modules in a monolith may correspond to different FOSSA projects
	// or revisions.
	// TODO: use these values.
	Project  string
	Revision string

	// A catch-all for builders to add metadata (a la Context.Value).
	Value interface{}
}

A Module is a unit of buildable code within a project.

func New added in v0.4.0

func New(moduleType Type, conf Config) (Module, error)

New instantiates and sets up a Module for a given ModuleType

type Type

type Type string

Type is an enumeration of supported build system types

func Parse added in v0.4.5

func Parse(key string) (Type, error)

Parse returns a module Type given a string

Jump to

Keyboard shortcuts

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