ninja

package module
v0.0.0-...-8e52100 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package ninja implements an abstract syntax tree (AST) for ninja build files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(str string) string

Escape escapes special characters like ":" to become "$:". It escapes the following characters: "$", ":", " " (space), "\n".

https://ninja-build.org/manual.html#_lexical_syntax

Types

type Build

type Build struct {
	Rule        string
	Out         []string
	OutImplicit []string
	In          []string
	InImplicit  []string
	InOrderOnly []string
	Pool        string
	Vars        Vars
}

Build reperesents a ninja build block

func (Build) RequiredVersion

func (b Build) RequiredVersion() (v Version)

RequiredVersion returns the ninja version required for the build

func (Build) WriteTo

func (b Build) WriteTo(w io.Writer) (int64, error)

WriteTo writes the build block to w

type Comment

type Comment struct {
	Lines []string
}

Comment represents a ninja file comment

func (Comment) RequiredVersion

func (c Comment) RequiredVersion() Version

RequiredVersion returns Version(0), since comments were always supported

func (Comment) WriteTo

func (c Comment) WriteTo(w io.Writer) (int64, error)

WriteTo writes the comment to w

type Deps

type Deps int

Deps represents the deps variable in rules

https://ninja-build.org/manual.html#ref_headers

const (
	// DepsGCC instructs ninja to use gcc dependency files
	DepsGCC Deps = 1 << iota
	// DepsMSVC instruct ninja to use MSVC dependency files
	DepsMSVC
)

func (Deps) String

func (d Deps) String() string

type File

type File []Node

File represents a ninja build file

func (File) RequiredVersion

func (f File) RequiredVersion() Version

RequiredVersion returns the ninja version for the file

func (File) WriteTo

func (f File) WriteTo(w io.Writer) (int64, error)

WriteTo writes the complete ninja file to w

type Node

type Node interface {
	WriteTo(wr io.Writer) (n int64, err error)
	RequiredVersion() Version
}

Node represents a ninja variable, statement or block

type Pool

type Pool struct {
	Name    string
	Depth   int
	Console bool
}

Pool represents a ninja pool block

func (Pool) RequiredVersion

func (p Pool) RequiredVersion() (v Version)

RequiredVersion returns the ninja version required for the pool

func (Pool) WriteTo

func (p Pool) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the rule block to w

type RequiredVersion

type RequiredVersion struct {
	Version Version
}

RequiredVersion represents the ninja_required_version variable

func (RequiredVersion) RequiredVersion

func (r RequiredVersion) RequiredVersion() Version

RequiredVersion returns the required version

func (RequiredVersion) WriteTo

func (r RequiredVersion) WriteTo(w io.Writer) (int64, error)

WriteTo writes the required version to w

type Rule

type Rule struct {
	Name           string
	Command        string // required
	Deps           Deps
	Depfile        string
	MSVCDepsPrefix string
	Description    string
	Generator      bool
	In             []string
	InNewline      []string
	Out            []string
	Restat         bool
	Rspfile        string
	RspfileContent string
	Vars           Vars
}

Rule represents a ninja rule block

func (Rule) RequiredVersion

func (r Rule) RequiredVersion() (v Version)

RequiredVersion returns the ninja version required for the rule

func (Rule) WriteTo

func (r Rule) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the rule block to w

type Var

type Var struct {
	Key string
	Val interface{}
}

Var represents a ninja variable

func (Var) RequiredVersion

func (v Var) RequiredVersion() Version

RequiredVersion returns Version(0), since variables were always supported

func (Var) WriteTo

func (v Var) WriteTo(w io.Writer) (int64, error)

WriteTo writes the variable to w

type Vars

type Vars []Var

Vars represents multiple variables

func (Vars) RequiredVersion

func (vs Vars) RequiredVersion() Version

RequiredVersion returns Version(0), since variables were always supported

func (Vars) WriteTo

func (vs Vars) WriteTo(w io.Writer) (int64, error)

WriteTo writes all variables to w

type Version

type Version int

Version represents the ninja version requirement

const (
	// Ver1_1 to require ninja 1.1
	Ver1_1 Version = iota + 1
	// Ver1_3 to require ninja 1.3
	Ver1_3
	// Ver1_5 to require ninja 1.5
	Ver1_5
	// Ver1_7 to require ninja 1.7
	Ver1_7
)

func (Version) String

func (v Version) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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