kati

package module
v0.0.0-...-24a0be9 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

README

kati

Build Status

kati is an experimental GNU make clone. The main goal of this tool is to speed-up incremental build of Android.

Currently, kati does not offer a faster build by itself. It instead converts your Makefile to a ninja file.

How to use for Android

Now AOSP has kati and ninja, so all you have to do is

% export USE_NINJA=true

All Android's build commands (m, mmm, mmma, etc.) should just work.

How to use for Android (deprecated way)

Set up kati:

% cd ~/src
% git clone https://github.com/google/kati
% cd kati
% make

Build Android:

% cd <android-directory>
% source build/envsetup.sh
% lunch <your-choice>
% ~/src/kati/m2n --kati_stats  # Use --goma if you are a Googler.
% ./ninja.sh

You need ninja in your $PATH.

More usage examples (deprecated way)

"make clean"
% ./ninja.sh -t clean

Note ./ninja.sh passes all parameters to ninja.

Build a specific target

For example, the following is equivalent to "make cts":

% ./ninja.sh cts

Or, if you know the path you want, you can do:

% ./ninja.sh out/host/linux-x86/bin/adb

Documentation

Overview

Package kati provides GNU make compatible functions, especially to speed up the continuous build of Android.

Index

Constants

This section is empty.

Variables

View Source
var (
	StatsFlag         bool
	PeriodicStatsFlag bool
	EvalStatsFlag     bool

	DryRunFlag bool

	UseFindEmulator  bool
	UseShellBuiltins bool

	IgnoreOptionalInclude string
)

Flags to control kati.

View Source
var (
	// ShellDateTimestamp is an timestamp used for $(shell date).
	ShellDateTimestamp time.Time
)

Functions

func DumpStats

func DumpStats()

DumpStats dumps statistics collected if EvalStatsFlag is set.

func Query

func Query(w io.Writer, q string, g *DepGraph)

Query queries q in g.

func TraceEventStart

func TraceEventStart(f io.WriteCloser)

TraceEventStart starts trace event.

func TraceEventStop

func TraceEventStop()

TraceEventStop stops trace event.

Types

type DepGraph

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

DepGraph represents rules defined in makefiles.

func Load

func Load(req LoadReq) (*DepGraph, error)

Load loads makefile.

func (*DepGraph) Nodes

func (g *DepGraph) Nodes() []*DepNode

Nodes returns all rules.

func (*DepGraph) Vars

func (g *DepGraph) Vars() Vars

Vars returns all variables.

type DepNode

type DepNode struct {
	Output             string
	Cmds               []string
	Deps               []*DepNode
	OrderOnlys         []*DepNode
	Parents            []*DepNode
	HasRule            bool
	IsPhony            bool
	ActualInputs       []string
	TargetSpecificVars Vars
	Filename           string
	Lineno             int
}

DepNode represents a makefile rule for an output.

func (*DepNode) String

func (n *DepNode) String() string

type EvalError

type EvalError struct {
	Filename string
	Lineno   int
	Err      error
}

EvalError is an error in kati evaluation.

func (EvalError) Error

func (e EvalError) Error() string

type Evaluator

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

Evaluator manages makefile evaluation.

func NewEvaluator

func NewEvaluator(vars map[string]Var) *Evaluator

NewEvaluator creates new Evaluator.

func (*Evaluator) EvaluateVar

func (ev *Evaluator) EvaluateVar(name string) (string, error)

EvaluateVar evaluates variable named name. Only for a few special uses such as getting SHELL and handling export/unexport.

func (*Evaluator) LookupVar

func (ev *Evaluator) LookupVar(name string) Var

LookupVar looks up named variable.

func (Evaluator) String

func (p Evaluator) String() string

type Executor

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

Executor manages execution of makefile rules.

func NewExecutor

func NewExecutor(opt *ExecutorOpt) (*Executor, error)

NewExecutor creates new Executor.

func (*Executor) Exec

func (ex *Executor) Exec(g *DepGraph, targets []string) error

Exec executes to build targets, or first target in DepGraph.

type ExecutorOpt

type ExecutorOpt struct {
	NumJobs int
}

ExecutorOpt is an option for Executor.

type LoadReq

type LoadReq struct {
	Makefile         string
	Targets          []string
	CommandLineVars  []string
	EnvironmentVars  []string
	UseCache         bool
	EagerEvalCommand bool
}

LoadReq is a request to load makefile.

func FromCommandLine

func FromCommandLine(cmdline []string) LoadReq

FromCommandLine creates LoadReq from given command line.

type LoadSaver

type LoadSaver interface {
	Loader
	Saver
}

LoadSaver is the interface that groups Load and Save methods.

var GOB LoadSaver

GOB is a gob loader/saver.

var JSON LoadSaver

JSON is a json loader/saver.

type Loader

type Loader interface {
	Load(string) (*DepGraph, error)
}

Loader is the interface that loads DepGraph.

type NinjaGenerator

type NinjaGenerator struct {
	// Args is original arguments to generate the ninja file.
	Args []string
	// Suffix is suffix for generated files.
	Suffix string
	// GomaDir is goma directory.  If empty, goma will not be used.
	GomaDir string
	// DetectAndroidEcho detects echo as description.
	DetectAndroidEcho bool
	// contains filtered or unexported fields
}

NinjaGenerator generates ninja build files from DepGraph.

func (*NinjaGenerator) Save

func (n *NinjaGenerator) Save(g *DepGraph, name string, targets []string) error

Save generates build.ninja from DepGraph.

type Saver

type Saver interface {
	Save(*DepGraph, string, []string) error
}

Saver is the interface that saves DepGraph.

type Value

type Value interface {
	String() string
	Eval(w evalWriter, ev *Evaluator) error
	// contains filtered or unexported methods
}

Value is an interface for value.

type Var

type Var interface {
	Value
	Append(*Evaluator, string) (Var, error)
	AppendVar(*Evaluator, Value) (Var, error)
	Flavor() string
	Origin() string
	IsDefined() bool
}

Var is an interface of make variable.

type Vars

type Vars map[string]Var

Vars is a map for make variables.

func NewVars

func NewVars(vt Vars) Vars

NewVars creates new Vars.

func (Vars) Assign

func (vt Vars) Assign(name string, v Var)

Assign assigns v to name.

func (Vars) Lookup

func (vt Vars) Lookup(name string) Var

Lookup looks up named make variable.

func (Vars) Merge

func (vt Vars) Merge(vt2 Vars)

Merge merges vt2 into vt.

Directories

Path Synopsis
cmd
make-c is simple program to measure time to parse Makefiles in android.
make-c is simple program to measure time to parse Makefiles in android.
gen_testcase_parse_benchmark is a program to generate benchmark tests for parsing testcases.
gen_testcase_parse_benchmark is a program to generate benchmark tests for parsing testcases.

Jump to

Keyboard shortcuts

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