Commit graph

16 commits

Author SHA1 Message Date
Colin Cross
9ece72b055 Add Validations support to Blueprint
The Android fork of Ninja supports "validations", a node that is
added to the top level of the build graph whenever another node
is in the build graph.  Add support in Blueprint to specify them
on build statements and write them to the ninja.

Test: ninja_writer_test.go
Change-Id: I87cd1281dbd2ed113cc26a265c50d20c65118c91
2020-07-09 14:28:20 -07:00
Colin Cross
2ce594e446 Make ninjaString an interface
There are 8935901 *ninjaString objects generated in an AOSP
aosp_blueline-userdebug build, and 7865180 of those are a literal
string with no ninja variables.
Each of those *ninjaString objects takes a minimum of 48 bytes for
2 slices, plus 8 bytes for the pointer to the ninjaString.  For
the literal string case, one of those slices has a single element,
(costing another 16 bytes for the backing array), and the other
slice is empty, for a total of 72 bytes.

Replace *ninjaString with a ninjaString interface.  This increases
the size of the reference from 8 bytes to 16 bytes, but using
a type alias of a string for the literal string implementation uses
only 16 bytes, saving 40 bytes per literal string or 314 MB.

Test: ninja_strings_test
Change-Id: Ic5fe16ed1f2a244fe6a8ccdf762919634d825cbe
2020-01-29 16:23:40 -08:00
Colin Cross
de7afaaf74 Write ninja file directly to the output file
Writing the ninja file to a byte buffer causes a significant amount
of time to be spent in memmove when growing the byte slice.  Write
the file directly to disk instead.

This also fixes some unhandled error warnings, which become more
likely when doing disk IO instead of byte buffer writes.

Change-Id: I5094e4c45cab4012713037f60c5a4fb00718f92e
2019-01-23 13:26:42 -08:00
Colin Cross
47113641cd Allow rules to specify order-only dependencies
Commands that contain tools that don't affect the build results
may want an order-only dependency on the tool.  Allow rules
to specify order-only dependencies the same way they specify
implicit dependencies.

Test: builds
Change-Id: I3e0f886ae047b0fadf7a5c0dfeb9827d2c5c411d
2017-10-17 13:50:49 -07:00
Colin Cross
7aa318f83d Allow BuildParams to override ninja description
Allow the ninja description variable to be set on build statements
as well as rules.

Change-Id: I6abb2a8ec83a0c662348cc957fa1a307e6c9c6bb
2017-05-09 10:02:54 -07:00
Colin Cross
aa873e1c65 Support deps and depfile properties on build statements
Ninja supports deps and depfile properties specified on build
statements, allow them to be specified in BuildParams.

Change-Id: I46eac5571350426f1419908def21f7d042f8739a
2016-11-22 13:40:45 -08:00
Dan Willemsen
5c43e07937 Support implicit outputs
Added in Ninja 1.7, for outputs that will not show up in $out.
2016-10-31 17:36:49 -07:00
Colin Cross
a028bf49ba Fix gofmt
Change-Id: I27b918b801dec25a85e65f88ab90331382ee1ec3
2016-08-10 16:31:35 -07:00
Dan Willemsen
aeffbf776a Allow wrapping of PackageContext
Turn PackageContext into an interface so that build systems can wrap it
to add more custom helpers.

This does introduce an API change, though it should be fairly simple.
NewPackageContext used to provide an opaque *PackageContext struct, now it
provides a PackageContext interface.

Change-Id: I383c64a303d857ef5e0dec86ad77f791ba4c9639
2015-11-30 17:03:34 -08:00
Dan Willemsen
e6006362da Merge pull request #78 from danw/ruledeps
Add common implicit deps to Rules
2015-11-17 17:59:43 -08:00
colincross
33c55fe809 Merge pull request #74 from dje4g/add-newline-2
Add blank line after build rules, for human readability.
2015-11-17 17:48:59 -08:00
Dan Willemsen
fce63d3c8f Add common implicit deps to Rules
For implicit dependencies that will be common to all users of a Rule,
add a new field 'CommandDeps' to the RuleParam. This is a list of
strings to be prepended to the implicit dependencies in each BuildParam.

This lets us have the dependencies declared next to where they are used,
instead of duplicated in areas that may be far apart.

I looked at passing this information down to ninja too, but it only
saves us a few percent of ninja file, and requires a modification to the
ninja file format.

Change-Id: Ifd910dee1506d4e32a76ed06206f853c4caec622
2015-11-17 17:08:05 -08:00
Doug Evans
9c1cbb4a04 Add blank line after build rules, for human readability. 2015-11-09 11:37:39 -08:00
Doug Evans
fcc6739e34 Support comments in build rules.
Tested: sh tests/test.sh
2015-11-08 12:21:58 -08:00
Colin Cross
8e0c51192a Add license headers and LICENSE file
Change-Id: I6f7c7374093c0745ee4aa677480376a06648b358
2015-01-23 14:23:27 -08:00
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
Renamed from blueprint/ninja_defs.go (Browse further)