Commit graph

514 commits

Author SHA1 Message Date
Colin Cross
c1d878159c Fix format issues found by go vet
Test: m checkbuild
Change-Id: I5135e0daecd20abce9a66631f5f55230168613de
2018-02-23 14:05:03 -08:00
Dan Willemsen
759bb61dd5
Merge pull request #196 from danw/ninja_deps
Store build.ninja deps in .ninja_deps
2017-12-18 12:26:58 -08:00
Dan Willemsen
2d9b59bc20 Store build.ninja deps in .ninja_deps
We're already going to load the .ninja_deps file, so we may as well use
it. These are the only two files in our build that don't.

Test: dump the .ninja_deps file, see the dependencies
2017-12-18 09:14:16 -08:00
colincross
7b8405f9c0
Merge pull request #195 from colincross/docs
Give primary builder more control over automated documentation
2017-12-11 19:27:42 -08:00
colincross
ee8fe641e9
Merge pull request #193 from colincross/glob
Limit length of glob result file names
2017-12-11 16:33:22 -08:00
Colin Cross
28b2843b78 Allow primary builder to stop bootstrap early
Allow the primary builder to stop bootstrap between
ResolveDependencies and PrepareBuildActions so that it can
use the build graph to write customized documentation.

Change-Id: I67ee5e6e438a0c2c3ec844c4c453d223971e60a2
2017-12-11 16:31:41 -08:00
Colin Cross
5eb116a46e Move auto-generated docs to main stage
Move the docs to the main stage and make a phony rule to build
them.  This will allow the primaray builder to choose not to
build them so that it can use its own rule instead.

Change-Id: Ib788f74717ccdcd85c2e5b6a581cc744d439341a
2017-12-11 16:31:41 -08:00
Colin Cross
92639f3fbb Refactor bpdoc
Separate the extraction of documentation-related info from writing
it out so that the primary builder can choose to write it out in
a customized format.

Change-Id: If2c91d6f13b8cea2e9e1cca75d8c2d684ad7f6df
2017-12-11 16:31:41 -08:00
Colin Cross
c581620795 Fix import list in singleton_ctx.go
Otherwise my editor keeps fixing it for me.

Change-Id: I2795a26b9a4f0dd7bf20edd146fc28425a60e89c
2017-12-11 16:31:41 -08:00
Colin Cross
741e14ebb9 Limit length of glob result file names
Glob names were appending every excluded file, which could result
in too many / characters for ninja to handle.  Use a hash if the
result contains too many / characters.

Change-Id: I88920f0596df49639a6c2b4f8af47ea8fdc1ee5a
2017-12-08 10:12:42 -08:00
Jeff
7a88d0db4d
Merge pull request #192 from mathjeff/propagate-syntax-errors
Fix propagating syntax errors to the user
2017-12-05 17:03:28 -08:00
Jeff
6b60fcefa3
Merge pull request #182 from mathjeff/microfactory-cmd-err
Update microfactory compile error message to show the command that fa…
2017-12-05 16:37:10 -08:00
Jeff Gaston
a7e408af0a prevent file=nil panic if syntax error in Blueprints
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      'build/blueprint:work^^^' 'build/blueprint:work'
Test: put a syntax error in a file and see that the
      reported error reports the location of the violation

Change-Id: Iaeedb91ea8e816cb8e9ee954f21cd6c6bc4afa48
2017-12-05 16:09:02 -08:00
Jeff Gaston
8fd9578a6a have openAndParse use return values rather than channels
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      'build/blueprint:work^^^' 'build/blueprint:work'

Change-Id: I941dfa76b94178198994a280eb40bcded891eda1
2017-12-05 15:26:57 -08:00
Jeff Gaston
5800d046c1 rename parseOneAsync to openAndParse
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      'build/blueprint:work^^^' 'build/blueprint:work'

Change-Id: I56e08716057c3746b01b7a5e43f0223ee1f940db
2017-12-05 15:26:57 -08:00
Jeff
14978f8f9d
Merge pull request #190 from mathjeff/visit-order
Have handleOneFile(child) wait for handleOneFile(parent).
2017-12-04 17:41:54 -08:00
Jeff Gaston
0e90759bfe Make ninja file deterministic even with dup module names
Bug: 65683273
Test: ./build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm '' ''

Change-Id: I5e45b2309ba4993ba2180b5f9a4785f31e28d503
2017-12-04 17:16:21 -08:00
Jeff Gaston
f23e36690e Disallow bp 'build' includes to reference other dirs
Bug: 65683273
Test: add 'build = ["sub/nope.bp"]' to an Android.bp; notice the error

Change-Id: Ic0f171f283edda074f65a76029e660dfaab2504b
2017-12-04 17:16:21 -08:00
Jeff Gaston
3c8c3346d2 Pass ModulePath to NameInterface
To allow it to validate that the filename equals Android.bp

Bug: 65683273
Test: m -j nothing # which runs tests
Change-Id: I171dddd102590df558053b615d39c75c00b6ac6e
2017-12-04 17:16:21 -08:00
Jeff Gaston
656870fbca Have handleOneFile(child) wait for handleOneFile(parent).
Bug: 65683273
Test: m -j nothing # which runs unit tests

Change-Id: I850e78ebcdbee68637f66d81fc127f19dd28508a
2017-12-04 17:16:21 -08:00
Jeff
94c2179666
Merge pull request #189 from mathjeff/namespaces
Extract module naming into an interface
2017-11-29 12:49:06 -08:00
Jeff Gaston
d70bf75491 Extract module naming into an interface
in facilitate moving name resolution to Soong

Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm \
      'build/blueprint:work^' 'build/blueprint:work'
      # and see that the only changes were:
      # 1. adding the name_interface.go file
      # 2. changing some line numbers

Change-Id: Ifa7603cca59b3b3d592f2f146fdafe57012bd4b9
2017-11-29 12:01:09 -08:00
colincross
90d258833a
Merge pull request #188 from colincross/match
Export pathtools.Match
2017-11-22 13:07:33 -08:00
Colin Cross
f9c2e8cc43 Export pathtools.Match
Export pathtools.Match so that tools that operate on file lists
(like zip listings) can use the same glob format.

Test: m checkbuild
Change-Id: Ic4b90139c381c57551836590da3ea54826b0227a
2017-11-22 12:51:59 -08:00
Jeff
fb52eb9a1a
Merge pull request #187 from mathjeff/android-bp-tests
Support files named Android.bp in tests
2017-11-21 12:21:31 -08:00
Jeff Gaston
9f63090a4c Support files named Android.bp in tests
Bug: 65683273
Test: m -j nothing # which runs unit tests

Change-Id: I00862cd9673719424a2b18e347c7f9fe84be2857
2017-11-20 17:03:49 -08:00
colincross
7ab9124b27
Merge pull request #183 from colincross/presingleton
Add presingletons
2017-11-07 14:50:05 -08:00
Colin Cross
5f03f11c0a Add presingletons
PreSingletons use the same interface as Singletons, but run after
parsing all the blueprint files but before running any mutators
or GenerateBuildActions.  They can be used to perform global setup,
including generating rules, that may be referenced by later
mutator or generate passes.

Test: m checkbuild
Change-Id: I4b93425a724e739f5b8843262efb8804b3bf3531
2017-11-07 13:31:33 -08:00
Jeff
f393902342
Merge pull request #168 from mathjeff/file-list
File list
2017-11-06 15:06:15 -08:00
Nan-Zhang
e55004478f
Merge pull request #181 from Nan-Zhang/support-integer
Support parsing int64 number in Blueprint file
2017-11-06 10:02:57 -08:00
Dan Willemsen
c09771a5e9
Merge pull request #169 from danw/buildtags
Make microfactory support go build tags
2017-11-03 14:34:49 -07:00
Nan Zhang
f586544ab7 Support parsing int64 in Blueprint file.
Support int64 number instead of int to be more fixed to bit size so
that the underlying arch won't affect overflow cases. Besides,
refection: func (v Value) Int() int64 always cast to int64 no matter the
input is int, int16, int32. Currently we always treat "-" as negative
sign to bind to next value, and "+" as plus operator to add operands
together.
So we allow:
a = 5 + -4 + 5 or a = -4 + 5
But we don't allow:
a = +5 + 4 + -4 since we don't treat "+" as a positive sign, otherwise,
a = 5 + +5 would exist which looks pretty weird. In the future, we may
want fully support number calculator logic eg, "+"/"-" can be
positive/negative sign or operator, and "(" and ")" will be considered
to group expressions with a higher precedence.

int & uint properties within struct keeps unchanged, which is only
allowed when tagged with 'blueprint:mutated'. We only allow *int64
property instead of int64 property within struct since it does't make
sense to do prepending or appending to int64.

Change-Id: I565e046dbd268af3538aee148cd7300037e56523
2017-11-02 22:10:47 -07:00
Jeff Gaston
4334d39a22 Update microfactory compile error message to show the command that failed
Easier to debug than "Failed to compile: main: exit status 2"

Bug: 68770962
Test: sed -i 's/build.FindSources/files := build.FindSources/' build/soong/cmd/soong_ui/main.go \
      && m -j nothing

Change-Id: If78a4fa1c3999e7c658dce072c05d7d3e23b8683
2017-11-02 13:56:32 -07:00
Jeff Gaston
4fc22f66c2 Make test_tree_tests.sh slightly easier to read
Bug: 64363847
Test: ./tests/test_tree_tests.sh
Change-Id: I40c1bcebf176bf4d70d4bc6339f419881013e0a6
2017-10-30 15:00:19 -07:00
Jeff Gaston
3802ba9f18 No longer follow subdirs in Android.bp files
because there some symlinks named Android.bp that point to
files named Android.bp that contain <subdir> entries that
are supposed to be interpreted relative to the original
symlink. It's more convenient to just skip following subdirs.

Bug: 64363847
Test: make -j
Change-Id: Ib15f1d1c7d511191fd841b1a29ceed559dd6cdbb
2017-10-30 15:00:19 -07:00
Jeff Gaston
c3e2844dfe Support for a custom list of Blueprints files to parse
Bug: 64363847
Test: BLUEPRINT_LIST_FILE=out/.module_paths/Android.bp.list minibp

Change-Id: Id7f8cb1ab3a6684b3f8265d77bb32413957f1c93
2017-10-30 15:00:19 -07:00
Jeff Gaston
cb42130440 Make a copy of Blueprint in tests
because the Finder doesn't follow symlinks
Bug: 64363847
Test: tests/test_tree_tests.sh

Change-Id: I2e4115b6d833e5bfcaa1e20bb9c8e1d827e3f43f
2017-10-30 15:00:19 -07:00
Jeff Gaston
a12f22fb69 Move parseOne for readability
Bug: 64363847
Test: m -j
Change-Id: Ie3e973dadbff139def127b0bb05c57bafb79165b
2017-10-30 15:00:19 -07:00
Jeff Gaston
5f763d0511 Clarify context.go somewhat
in preparation to support parsing a predefined list of Blueprints files

Bug: 64363847
Test: m -j
Change-Id: I98cc98dc17ecaf69b95272d32cd83adbdb0e8c5b
2017-10-30 15:00:19 -07:00
colincross
eb6192cf66
Merge pull request #180 from colincross/createmodule
Set fields in CreateModule to match current module
2017-10-27 22:36:05 -07:00
Colin Cross
1fa1a14853 Set fields in CreateModule to match current module
When a mutator calls CreateModule, set the blueprints file and line
number to the values of the module that the mutator was visiting.

Change-Id: I4526f14a744be944e42582bc46f11a9a7b502f03
2017-10-27 16:32:15 -07:00
colincross
c63f1fd784 Merge pull request #179 from colincross/fmt
Finish switching blueprint back to the original Blueprints format
2017-10-19 15:42:22 -07:00
Colin Cross
4a0fe087b1 Finish switching blueprint back to the original Blueprints format
An ill-fated experiment with using a format that was closer to
Bazel left Blueprint preferring the original style, but documenting
and using the new style.  Update the documentation and run bpfmt -w.

Test: builds
Change-Id: I3fb70c8fa50c332da01cf5912b179c60d1638814
2017-10-19 15:33:11 -07:00
Jeff
5029114553 Merge pull request #157 from mathjeff/dedup-utils
Utils to support removing duplicate shared_libs
2017-10-19 13:41:50 -07:00
Jeff
e2b2ab6005 Merge pull request #175 from mathjeff/bpfmt-stdout
Have bpfmt show usage when run without any arguments
2017-10-19 13:40:49 -07:00
Dan Willemsen
2f769ef470 Merge pull request #178 from danw/microfactory_locking
Add file locking to microfactory
2017-10-18 16:37:39 -07:00
Jeff Gaston
2ca94325bf Have bpfmt show usage when run without any arguments
This is partially in hopes of making it generally easier to use, and
partially in hopes of specifically making it less tempting to do

bpfmt Android.bp > Android.bp

which actually would just erase the contents of Android.bp

Test: bpfmt Android.bp 2>&1 | grep usage && echo ok
Bug: 67326589
Change-Id: I41c23aca6214f27dbdf55e5931f9392c318e82ed
2017-10-18 15:11:19 -07:00
Jeff Gaston
6cd6ebc768 Refactor in preparation to detect when stdout is the input file
Test: bpfmt -d Android.bp
Bug: 67326589

Change-Id: I5cd57a784848f70c7a1306161c40faa8e79cd44e
2017-10-18 15:11:18 -07:00
Dan Willemsen
987ed9ba29 Add file locking to microfactory
To prevent against multiple instances attempting to rebuild the same
executable, add a file lock to Build().

The trace file may not be consistent in this case, but everything that
reads it should be able to handle a corrupted trace file.

Test: `while true; do <microfactory-enabled executable>; done` in
parallel, and modify the code to microfactory (echo "//"
>>microfactory.go)
Change-Id: I30cb22bb9c790c57c507354127d4a5f82526a489
2017-10-18 15:11:03 -07:00
colincross
5fa3f89f2c Merge pull request #177 from colincross/docs
Fix property documentation bugs
2017-10-17 21:58:53 -07:00