mkfile

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PkgDescFile     = "xdev.toml"
	ModDescFile     = "mod.toml"
	SelfPackageName = "self"
	XchainPackage   = "xchain"
)
View Source
const (
	DefaultXROOT = "/opt/xchain"
)
View Source
const (
	MainPackage = "main"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder generate makefile

func NewBuilder

func NewBuilder() *Builder

NewBuilder instance a build

func (*Builder) GenerateCompileCommands

func (b *Builder) GenerateCompileCommands(w io.Writer) error

GenerateCompileCommands generates compile_commands.json to io.Writer

func (*Builder) GenerateMakeFile

func (b *Builder) GenerateMakeFile(w io.Writer) error

GenerateMakeFile generates makefile to w

func (*Builder) OutputPath

func (b *Builder) OutputPath() string

OutputPath returns the output path of output file. Must be called after Parse

func (*Builder) Parse

func (b *Builder) Parse(entry *Package) error

Parse parse the package

func (*Builder) WithCacheDir

func (b *Builder) WithCacheDir(xcache string) *Builder

WithCacheDir set the stage dir

func (*Builder) WithCxxFlags

func (b *Builder) WithCxxFlags(flags []string) *Builder

WithCxxFlags set the CXXFLAGS during compiling cxx file

func (*Builder) WithLDFlags

func (b *Builder) WithLDFlags(flags []string) *Builder

WithLDFlags set the LDFLAGS during linking binary

func (*Builder) WithOutput

func (b *Builder) WithOutput(out string) *Builder

WithOutput set the output of package

type DependencyDesc

type DependencyDesc struct {
	Name    string
	Path    string
	Modules []string
}

DependencyDesc 描述了依赖的package信息

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

Loader 分析package依赖,并确保所有依赖都已经在本地存在

func NewLoader

func NewLoader() *Loader

NewLoader instance Loader

func (*Loader) Load

func (l *Loader) Load(pkgpath string, addons []DependencyDesc) (*Package, error)

Load parse and load all package's dep packages

func (*Loader) WithSearchPath

func (l *Loader) WithSearchPath(paths []string) *Loader

func (*Loader) WithXROOT

func (l *Loader) WithXROOT(xroot string) *Loader

type MakeFileWriter

type MakeFileWriter struct {
	// contains filtered or unexported fields
}

MakeFileWriter write Makefile according to given MakeFile description

func NewMakeFileWriter

func NewMakeFileWriter(w io.Writer) *MakeFileWriter

NewMakeFileWriter instances a new MakeFileWriter

func (*MakeFileWriter) Write

func (m *MakeFileWriter) Write(f *Makefile) error

Write serializes MakeFile description to MakeFile

type Makefile

type Makefile struct {
	Headers []string
	Tails   []string
	Tasks   []Task
}

Makefile represents a Makefile description

type Module

type Module struct {
	// The name of module
	Name string
	// The full path of module
	Path string
}

Module is the basic compile unit

type ModuleDesc

type ModuleDesc struct {
	Dependencies []DependencyDesc
}

ModuleDesc 描述了module的信息

func ParseModuleDesc

func ParseModuleDesc(modpath string) (*ModuleDesc, error)

type Package

type Package struct {
	// The name of package
	Name string
	// The full path of package in local file system
	Path string
	// The modules will be compiled
	Modules []Module
	// The dep packages
	Deps map[string]*Package
}

Package contains modules and deps

type PackgeDesc

type PackgeDesc struct {
	Package struct {
		Name   string
		Author string
	}
	Dependencies []DependencyDesc
}

PackgeDesc 描述了package的信息

func ParsePackageDesc

func ParsePackageDesc(pkgpath string) (*PackgeDesc, error)

type Runner

type Runner struct {
	*log.Logger
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(ccImage string) *Runner

func (*Runner) Make

func (r *Runner) Make(mkfile string) error

func (*Runner) WithCacheDir

func (r *Runner) WithCacheDir(xcache string) *Runner

func (*Runner) WithEntry

func (r *Runner) WithEntry(pkg *Package) *Runner

func (*Runner) WithLogger

func (r *Runner) WithLogger(logger *log.Logger) *Runner

WithLogger set the debug logger

func (*Runner) WithMakeFlags

func (r *Runner) WithMakeFlags(flags []string) *Runner

WithMakeFlags set extra flags passing to make command

func (*Runner) WithOutput

func (r *Runner) WithOutput(out string) *Runner

func (*Runner) WithXROOT

func (r *Runner) WithXROOT(xroot string) *Runner

func (*Runner) WithoutDocker

func (r *Runner) WithoutDocker() *Runner

func (*Runner) WithoutPrecompiledSDK added in v1.0.1

func (r *Runner) WithoutPrecompiledSDK() *Runner

type Task

type Task struct {
	Target  string
	Deps    []string
	Actions []string
}

Task represents a single task description in Makefile

Jump to

Keyboard shortcuts

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