modules

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const Filename = "dagger.json"

Filename is the name of the module config file.

Variables

This section is empty.

Functions

func NormalizeConfigPath

func NormalizeConfigPath(configPath string) string

NormalizeConfigPath appends /dagger.json to the given path if it is not already present.

Types

type Config

type Config struct {
	// The name of the module.
	Name string `json:"name"`

	// The root directory of the module's project, which may be above the module
	// source code.
	Root string `json:"root,omitempty"`

	// Either the name of a built-in SDK ('go', 'python', etc.) OR a module reference pointing to the SDK's module implementation.
	SDK string `json:"sdk,omitempty"`

	// Include only these file globs when loading the module root.
	Include []string `json:"include,omitempty"`

	// Exclude these file globs when loading the module root.
	Exclude []string `json:"exclude,omitempty"`

	// Modules that this module depends on.
	Dependencies []string `json:"dependencies,omitempty"`
}

Config is the module config loaded from dagger.json.

func NewConfig

func NewConfig(name, sdkNameOrRef, rootPath string) *Config

func (*Config) RootAndSubpath

func (cfg *Config) RootAndSubpath(modSourceDir string) (string, string, error)

func (*Config) Use added in v0.9.2

func (cfg *Config) Use(ctx context.Context, dag *dagger.Client, ref *Ref, refs ...string) error

Use adds the given module references to the module's dependencies.

type GitRef

type GitRef struct {
	HTMLURL  string // HTMLURL is the URL a user can use to browse the repo.
	CloneURL string // CloneURL is the URL to clone.
	Commit   string // Commit is the commit to check out.
}

type Ref

type Ref struct {
	Path    string // Path is the provided path for the module.
	Version string // Version is the provided version for the module, if any.

	Local bool    // Local indicates that the module's Path is just a local path.
	Git   *GitRef // Git is the resolved Git information.

	SubPath string // Subdir is the subdirectory within the fetched source.
}

Ref contains all of the information we're able to learn about a provided module ref.

func ResolveModuleDependency

func ResolveModuleDependency(ctx context.Context, dag *dagger.Client, parent *Ref, urlStr string) (*Ref, error)

func ResolveMovingRef

func ResolveMovingRef(ctx context.Context, dag *dagger.Client, modQuery string) (*Ref, error)

func ResolveStableRef

func ResolveStableRef(modQuery string) (*Ref, error)

TODO dedup with ResolveMovingRef

func (*Ref) AsModule

func (ref *Ref) AsModule(ctx context.Context, c *dagger.Client) (*dagger.Module, error)

func (*Ref) Config

func (ref *Ref) Config(ctx context.Context, c *dagger.Client) (*Config, error)

func (*Ref) LocalSourcePath

func (ref *Ref) LocalSourcePath() (string, error)

func (*Ref) String

func (ref *Ref) String() string

func (*Ref) Symbolic

func (ref *Ref) Symbolic() string

Jump to

Keyboard shortcuts

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