Commit graph

2100 commits

Author SHA1 Message Date
jgennis
efe578a605 Merge pull request #21 from jgennis/rbase
Adding a builtinPool type
2015-04-16 10:17:16 -07:00
Ken Oslund
4b9a0514cd Adding a builtinPool type
This implements the Pool interface. An instance of a builtinPool
is created for the Console pool.

Change-Id: I03334c25495dc573aef2c0e62415352a0b10d6fd
2015-04-16 13:10:19 -04:00
colincross
adccb7fccb Merge pull request #19 from colincross/performance
Performance improvements
2015-04-15 12:20:36 -07:00
Colin Cross
5bdb4ca1a5 Set GOMAXPROCS to number of CPUs
Apparently Go only allows a single thread to be executing by default,
so the increase in performance seen when concurrency was added to
Blueprint was entirely due to scheduling goroutines while the
executing goroutine was blocked in a syscall.  Whoops.

Set GOMAXPROCS to the number of CPUs.  Reduces wall thime by >2x on
one workload.

Change-Id: Ib5fc7761c09a076fc5a1b7f08f5ccf034304477c
2015-04-15 11:03:17 -07:00
Colin Cross
8c1c6c03f8 Pre-allocate ninjaString slices
Naively pre-allocate ninjaString slices by counting $ characters as
an estimate of how many variables will be needed.  Saves 5% cpu time
on one workload.

Change-Id: Ib3a41df559d728b2db047f6dbbf9eb06d7045303
2015-04-15 11:03:17 -07:00
Colin Cross
7bf6f62130 Replace ReplaceExtension regexp with manual string operations
regexp is overkill for a simple extension replacement, just find
the last '.' and add the new extension after it.  Saves 5% cpu time
on one workload.

Change-Id: Ic299c9ec5132d15bbea2c9c7778c000d6fdf509a
2015-04-15 11:03:06 -07:00
Colin Cross
8ac0a812f1 Optimize ninja_writer
Prebuild a string of all spaces to avoid calling strings.Repeat for
every indented line.  Replace appendWithWrap function with a class
that handles counting bytes on a line as they are written instead of
buffering lines, and avoids extra string concatenations by providing
a function that implicitly adds a space.  Saves 10% wall time on one
workload.

Change-Id: I571d70366ee5db21c40c1c98d0fe92d640efefab
2015-04-15 11:03:06 -07:00
jgennis
75de3e8e1d Merge pull request #20 from colincross/unique
Fix makeUniquePackageNames
2015-04-14 22:44:22 -07:00
jgennis
82a6f6fa87 Merge pull request #18 from colincross/ninjastring
Fix bug in parseNinjaString
2015-04-14 22:32:06 -07:00
jgennis
503b811a8e Merge pull request #17 from jgennis/rbase
Upstreaming some changes
2015-04-14 22:30:00 -07:00
Jamie Gennis
c7988251aa Always update deps after bottom-up mutators run.
This fixes a bug where a split module could be reached by subsequent
mutator passes, but it is no longer in module group's list of modules.

Change-Id: I74c3d849ed2614dcdb6f54a6760122b933bb84c2
2015-04-14 23:35:47 -04:00
Michael Beardsworth
1ec445369f Add support for arbitrary globs in subdirs
Change-Id: I874535483266622213dbcfe3c84875f41a136b9f
2015-04-14 23:34:34 -04:00
Jean-Francois Dupuis
418d5c5278 Add function to return list of globbed file
Change-Id: If501246dc4d7d5b877cc2f871f8786f47c200d00
2015-04-14 23:34:30 -04:00
Christian Zander
c4d07d8fb5 Make WriteDepFile escape spaces and special characters
This commit makes deptools.WriteDepFile() escape spaces and the
following set of special characters in the dependencies it
writes to files used as Ninja depfiles: \, #, *, [, |.  Without this
change, dependencies with paths including any of the above may not
function as intended.

Change-Id: I3560a34de930932422200985fb479515a21d9508
2015-04-14 23:34:24 -04:00
Colin Cross
0d44125b02 Fix makeUniquePackageNames
makeUniquePackageNames never assigned to pkgs, so all packages
were using their short names, even if another package had the
same short name.

Change-Id: I5420f7839efd25362d6c5d85265399ce7b29ddb2
2015-04-14 18:02:20 -07:00
Colin Cross
b247893deb Fix misparsed $ after variable name
If a $ sign occurs after a variable name, the ninja string parser
fails to check if it is a $$ or a ${.  Go to the
parseDollarStartState instead of the parseDollarState.

Since it is not yet known if the $ is the beginning of a new
variable (${ or $<alphanumeric>) or a string ($$), an empty string
separator cannot be added to the ninjaString strings list.  Instead,
add functions to push strings or variables onto the ninjaString,
and automatically add the blank separator if two variables are
pushed in a row.

Change-Id: Ia1cae6259b1d7e4f633f61b9eadb2a2028bbd5f0
2015-04-14 16:21:53 -07:00
colincross
e28dbe4d0c Merge pull request #16 from ciarand/patch-1
Indent code block in doc.go
2015-04-11 20:08:01 -07:00
Ciaran Downey
88489409ea Indent code block in doc.go 2015-04-11 09:52:11 -07:00
jgennis
11bcca9098 Merge pull request #15 from colincross/cycle
Fix cycle printing
2015-03-31 15:28:10 -07:00
Colin Cross
0e4607e788 Fix cycle printing
The patch "Fix panic when dependency cycle includes the first
module visited" caused cycles to print incorrectly by initializing
the current module to be the last module in the cycle, when it
should be the first module in the cycle.

Change-Id: Iaf939283a48faa4cc6eeb9b19aed57993575a687
2015-03-24 16:42:56 -07:00
jgennis
91d25f2c55 Merge pull request #12 from jgennis/master
Update import paths to include github
2015-03-23 12:16:48 -07:00
Jamie Gennis
aefb6570ee Add .travis.yml to configure CI 2015-03-21 03:12:46 -04:00
Jamie Gennis
6cafc2cddc Update import paths to include github 2015-03-21 01:03:36 -04:00
jgennis
4dfe36d029 Merge pull request #11 from colincross/bpfmt
bpfmt fixes
2015-03-20 17:44:48 -07:00
jgennis
4063fb386e Merge pull request #10 from colincross/mutator
Add error checking for calling CreateVariations with no variants
2015-03-20 17:39:40 -07:00
Colin Cross
96e5670496 Allow parsing Blueprints files without evaluating
Running bpfmt or bpmodify on a Blueprints file that references
variables defined in a parent Blueprints file causes parse errors
on unknown variables.  Modify the parser to parse in two modes,
parser.Parse and parser.ParseAndEval.  The first parses without
attempting to evaluate variables and expressions, the second
performs a full evaluation.

Change-Id: Ic11948ea77c8e65379d7260591ada15db0e4f5b9
2015-03-20 16:55:32 -07:00
Colin Cross
85398a916a Simplify printer whitespace and newline handling
Trying to handle all the whitespace and newline printing inside
printToken got overly complicated, and resulted in a few bugs in
the layout around comments and indentation that were hard to fix.
Rewrite the whitespace and newline handling to be handled directly
by the object printers, using requestSpace() to ensure whitespace
is inserted and requestNewline() to ensure a newline is inserted.

Also fixes unnecessarily left aligning all comments that contain
indentation, and fixes accidentally unindenting comments that are
the last token in their indented block.

Change-Id: I18707802726107cf0b6ec7de9b542d0ec1d2c0dd
2015-03-20 16:55:32 -07:00
Colin Cross
f4d18a685d Add error checking for calling CreateVariations with no variants
Calling CreateVariations with no variants will corrupt the
modules list with a module with nil logicModule, panic early
with a useful message instead.

Change-Id: Ic5c921efcba70c54efb5bb21a9626b2999376a69
2015-03-18 17:43:15 -07:00
jgennis
bc21793f6c Merge pull request #9 from colincross/createvariations
Document subtle behavior in createVariations
2015-03-16 11:56:07 -07:00
jgennis
f7b78666ba Merge pull request #8 from colincross/splicemodules
Fix a bug in spliceModules and add tests
2015-03-16 11:55:33 -07:00
jgennis
8db1fd58ca Merge pull request #7 from colincross/contributing
Add CONTRIBUTING.md file
2015-03-16 11:54:50 -07:00
Colin Cross
21e078a44a Document subtle behavior in createVariations
createVariations relies on reusing the logicModule for the first
variant in order to replace the original module in the global module
map, which prevents leaving old split modules around in the global
module map.  Add comments to explain the behavior.

Change-Id: Ia06d7fa4bc777e807241996d4e8bf977e641d741
2015-03-16 10:57:54 -07:00
colincross
262fd82632 Merge pull request #6 from norwack/master
Fix typo
2015-03-16 10:47:37 -07:00
Norwack
da78a71a59 Fix same typo in doc.go 2015-03-16 18:31:55 +01:00
Colin Cross
72bd193edf Fix a bug in spliceModules and add tests
spliceModules was carefully reallocating the slice if necessary, and
then throwing away the reallocated slice and writing to the too-short
original slice.  Fix the bug, and add tests that would have caught it.

Change-Id: Ifc13b2025198b270c97097fd7d28cd36e460c98c
2015-03-16 00:13:59 -07:00
Colin Cross
ed5c21b1dc Add CONTRIBUTING.md file
Add file to describe the procedure for submitting patches to
Blueprint.

Change-Id: I9601b5ab47e9d1230c2b3064a590d9eac1478433
2015-03-16 00:12:49 -07:00
Norwack
7fdf32b42f Fix typo 2015-03-15 22:29:02 +01:00
colincross
96555d687e Merge pull request #5 from colincross/earlymutators
Support for early mutators
2015-03-13 19:56:52 -07:00
Colin Cross
f5e34b98ca Split "variant" terminology into "variant" and "variation"
"Variant" has been used to mean two slightly concepts in Blueprint.
The first and most obvious is a variant of a module, meaning a list
of all the ways that on version of a module differs from other
versions of the same modules, for example "arch:arm, link:static".
The other is for the specific way that a version of a module differs,
"arch:arm".

Rename all of uses of "variant" as the second meaning to "variation",
and update the documentation to clarify "variant" vs. "variation".
This modifies the build logic api to convert CreateVariants to
CreateVariations.

Change-Id: I789ef209ae6ddd39ec12e0c032f9f47f86698fe6
2015-03-13 16:02:36 -07:00
Colin Cross
65569e4375 Add early mutators
The mutators that run after dependencies are resolved can be too late
to support build logic that needs to vary the dependencies based on
the mutated axis, for example architecture.  This patch provides an
EarlyMutator interface that can be used to mutate modules before
any dependencies have been resolved.

In order for dependencies to be satisifed in a later pass, all
dependencies of a module must either have an identical variant,
must have a single variant, or must be inserted using
DynamicDependencyModuleContext.AddVariantDependency.

Change-Id: Ic6ae57e98edfd6c8c09a7788983128d3e4e992f0
2015-03-13 13:41:41 -07:00
Colin Cross
ab6d790165 Move build actions into modules
Move actionDefs from moduleGroup to moduleInfo.  This will result
in multiple build.ninja headers for a single Blueprint file module
if it has multiple variants, each one specifying the variant
used to generate the following rules.

Change-Id: I414cd4d3266da8c2e92118b295569627ddf48cdd
2015-03-12 17:36:57 -07:00
Colin Cross
7addea35a1 Iterate through modules directly
Instead of iterating through groups and then iterating through the
group's modules, iterate through the modules directly.  This will
allow circular dependencies between groups as long as the individual
modules don't have circular dependencies.  In order to maintain the
ordering of modules in a group, each module is considered to have
an implicit dependency on any earlier modules in the same group.

Change-Id: Ibce67167c7234db70ede0a6b5c2b43fb8e0bb05d
2015-03-12 17:36:57 -07:00
Colin Cross
e7daa22927 Rework the way variant names are stored
Replace the array of mutator name/variant name pairs with
a map of mutator name to variant name, and store the string
variant name separately.

Change-Id: I181c2fcb05724c8755b90aaf866fdce9ef720b01
2015-03-12 17:36:54 -07:00
Colin Cross
ed342d983c Move values from moduleGroup to moduleInfo
Move most of the contents of moduleGroup into moduleInfo.  This will
eventually reduce moduleGroup to a simple list of variants of the
same module.

Change-Id: I4289eb9953509751d7637558cd6db73373ccdf78
2015-03-12 17:22:18 -07:00
Colin Cross
6134a5c66a Relax module naming restrictions
Forcing module names to be valid ninja names is an unnecessary
restraint on the project build logic.  Allow any string as a
module name, and sanitize and uniquify the module name for use
in module-scoped variables.

Also move the module scope to be per-module instead of per-group
so that modules can use the same local variable name for each variant.

Change-Id: If44cca20712305e2c0b6d6b39daa5eace335c148
2015-03-12 17:22:18 -07:00
jgennis
50fb09375a Merge pull request #4 from colincross/bugfixes
Bugfixes
2015-03-11 16:43:58 -07:00
Colin Cross
10b54db7cc Fix panic when dependency cycle includes the first module visited
The cycle check can panic if the first call to check happens to land
on the first module in a cycle.  Print the cycle instead of panicking.

Change-Id: I6fc1c66dcc37b1eb6b11b9e65343452af3c8538d
2015-03-11 16:09:00 -07:00
Colin Cross
62e681a288 Fix bug when copying slice to itself
If proptools.CopyProperties is passed two values that point same
slice then setting the destination slice to a new slice will
overwrite the source slice, and the properties struct that is both
the source and destination will have an empty slice.  Copy into
the new slice using a new reflect.Value, and then update the
destination.

Change-Id: I1bfcdc51e4278ea7c7ed81dafc928a5471219f05
2015-03-11 16:09:00 -07:00
Colin Cross
969c70342a Fix whitespace in parser/parser.go
Change-Id: I75875cbf60efc9aaf7c2df5709533c2c04b6fba4
2015-03-10 14:42:13 -07:00
jgennis
b96aa8b58f Merge pull request #3 from colincross/features
New features
2015-03-10 13:06:59 -07:00