Commit graph

10 commits

Author SHA1 Message Date
Colin Cross
3e8e74f276 Move blueprint/* up a directory
Make integrating with go tools easier by putting the blueprint package
files in the top level directory of the git project instead of in a
subdirectory called blueprint.

Change-Id: I35c144c5fe7ddf34e478d0c47c50b2f6c92c2a03
2015-01-23 14:23:27 -08:00
Colin Cross
e4cfdf93a9 Optimize parseNinjaString
The closures in parseNinjaString seem to confuse go's escape
analysis, causing it to allocate a new stateFunc object on the
heap for every character in the string.  Convert the state
functions to normal functions, and pass a pointer to a state
object to provide access to the variables that were in the
closure.

The range iteration on the input string was iterating over
UTF-8 runes, when all of the rune comparisons for state
changes only look at ASCII bytes.  Switch to iterating
over bytes, stringState will pass through multi-byte
characters in strings untouched.

Together this reduces the time spent in parseNinjaString by
>50%, and the overall execution time by >20%.

Change-Id: I4c926b52b883d51e2f12a1673d03fcc2cfe83445
2015-01-23 13:41:49 -08:00
Christian Zander
6e2b232d79 Make Ninja string evaluation more robust
ninjaString's Eval() does not currently check if all of the variables
referenced by the Ninja string being evaluated are present in the
map provided by the caller.  This commit adds such a check.

Change-Id: I15cf3c44cc1eedaf6f93a9533b8cdcbffd74992c
2015-01-23 13:41:49 -08:00
Jamie Gennis
df935ac324 Make Context.AllTargets() evaluate variables.
Change-Id: Iaa7e134cb5cb9fd1491a2508a7953fb4cbc53d1e
2015-01-23 13:41:48 -08:00
Jamie Gennis
30d8a3a2ed Fix a string parsing bug
Change-Id: I70faa1c06f19f70455a6d8f7db1da37203e21797
2015-01-23 13:41:47 -08:00
Jamie Gennis
6736ec30da Add the offending character to the bad-ninja-name error message.
Change-Id: I93260a064aece41c53afcecad73c037eb87e5aea
2015-01-23 13:41:47 -08:00
Jamie Gennis
2fb2095caa Stop determining package names from the call stack.
This change replaces the automatic caller package divination with a
PackageContext object that must be explicitly passed in by callers.

Change-Id: I139be29ecf75a7cf8488b3958dee5e44363acc22
2015-01-23 13:41:46 -08:00
Jamie Gennis
48aed8cee0 Add more Build/Rule/Pool params validation.
This change adds two new kinds of checks to params validation.  First, all
BuildParams must have one or more outputs.  Second, any Pool or Rule referenced
must be visible within the Blueprint scope of the caller (e.g. if it's defined
in another Go package then an Import call must have been made).  If either of
these conditions are violated it will result in a panic.

Change-Id: Ibacb42513882d914c94eade23ef17269db5e8730
2014-06-18 12:57:56 -07:00
Jamie Gennis
04f106f23a Don't export the EOF constant.
Change-Id: I6f8578d0a6c62bdb1e384d5e512937d9489387b7
2014-06-12 19:41:57 -07:00
Jamie Gennis
1bc967ed43 Initial Blueprint commit.
Blueprint is a build system component that reads Blueprints files defining
modules to be built, and generates a Ninja build manifest that can be used to
perform all the build actions.  It does not dictate or implement much build
policy itself, but rather provides a framework to ease the process of defining
build logic in Go.

The "blueprint" and "blueprint/parser" Go packages contain the functionality
for reading Blueprint files and invoking build logic functions defined in other
Go packages.

The "blueprint/bootstrap" Go package contains just enough build logic to build
a binary that includes Blueprint and any pure-Go (i.e. no cgo) build logic
defined in external Go packages.  This can be used to create a minimal Ninja
file that's capable of bootstrapping a Blueprint-based build system from
source.

The "blueprint/bootstrap/minibp" Go package contains code for a minimal binary
that includes the build logic defined in the "blueprint/bootstrap" package.
This binary can then create the Ninja file for the bootstrapping process.

Change-Id: I8d8390042372a72d225785cda738525001b009f1
2014-06-04 14:23:32 -07:00