Commit graph

1690 commits

Author SHA1 Message Date
Colin Cross
2ef3c79d58 Add variant to dependency cycle errors am: e5ff770c95 am: 54d8f87981
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1689306

Change-Id: I896d8c4d6dfb1b8fedf0fcee78d0f6cfdee41a67
2021-04-29 03:00:26 +00:00
Colin Cross
92f64550cd Speed up finding dependency cycles am: 9793b0a5e0 am: 010f5bbd8d
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1689305

Change-Id: I65385bbe06dc0877fb4d8d01cb8e636804722ce2
2021-04-29 03:00:25 +00:00
Colin Cross
54d8f87981 Add variant to dependency cycle errors am: e5ff770c95
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1689306

Change-Id: I5146b753d84b0df9125c14a0dc617198f7c51852
2021-04-29 00:13:52 +00:00
Colin Cross
010f5bbd8d Speed up finding dependency cycles am: 9793b0a5e0
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1689305

Change-Id: I28b57ccfe40e04e446d8ff4c721752ff1a69aae9
2021-04-29 00:13:51 +00:00
Colin Cross
e5ff770c95 Add variant to dependency cycle errors
Use moduleInfo.String() to print dependency cycle errors so they
contain the variant.

Test: Test_parallelVisit
Change-Id: I2bddaa35c8abb57c42b4c424e861361a8813d588
2021-04-28 09:40:47 -07:00
Colin Cross
9793b0a5e0 Speed up finding dependency cycles
parallelVisit supports mutating the dependency graph while it is being
visited by proceeding until there are no modules with their dependencies
satisfied, and then checking if there are modules that haven't been
visited yet.  If so, it assumes there was a newly introduced dependency
cycle and tries to find it to return as an error.

Finding the dependency cycle could traverse outside of the cycle.
If the dependency cycle occurs near the bottom of the dependency graph,
that traversal could be both long and wide, leading to very long
runtimes.

Memoize traversed modules that were not found to be part of the
dependency cycle to prevent repeated traversals.

Fixes: 186572387
Test: introduce cycle into libc, m nothing
Test: Test_parallelVisit
Change-Id: I38d0749dbedffbe8a39e433d97fbe08486451321
2021-04-28 09:40:47 -07:00
Colin Cross
00e3b274ab Merge "Speed up globs with sharding" am: 9021eef07b am: c12ed83e19
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668808

Change-Id: I19ac2ee09c0f5219b618bd08580ab15bc20083e0
2021-04-20 16:51:28 +00:00
Colin Cross
c12ed83e19 Merge "Speed up globs with sharding" am: 9021eef07b
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668808

Change-Id: Ic86c4034860e607bfce3523a07e94fba69bcccc3
2021-04-20 16:27:29 +00:00
Colin Cross
9021eef07b Merge "Speed up globs with sharding" 2021-04-20 16:16:40 +00:00
Lukács T. Berki
308afcf580 Merge "Remove the extraNinjaFileDeps arg of RunBlueprint." am: d04dcc89f4 am: 412934164e
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1676293

Change-Id: Icc0b38209fb2007a89a9fe3ec67baf843e102f27
2021-04-19 07:32:26 +00:00
Lukács T. Berki
a74c3fc65e Merge "Use the correct build dir." am: 8308aab95e am: 9e791184e5
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1676296

Change-Id: I978937cdc9581255d6e5f14f83d431e5513df377
2021-04-19 07:32:16 +00:00
Lukács T. Berki
412934164e Merge "Remove the extraNinjaFileDeps arg of RunBlueprint." am: d04dcc89f4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1676293

Change-Id: I957eb9766c62a83075c882ec2bb9e2d083c4472e
2021-04-19 07:04:21 +00:00
Lukács T. Berki
9e791184e5 Merge "Use the correct build dir." am: 8308aab95e
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1676296

Change-Id: I83c05f0ef7e9f0bdb5985546005a953064ee874a
2021-04-19 07:04:05 +00:00
Lukács T. Berki
d04dcc89f4 Merge "Remove the extraNinjaFileDeps arg of RunBlueprint." 2021-04-19 06:46:52 +00:00
Lukács T. Berki
8308aab95e Merge "Use the correct build dir." 2021-04-19 06:46:16 +00:00
Colin Cross
2523698c12 Speed up globs with sharding
There are a few cases that force all globs to be rerun at the beginning
of the build (changes to bpglob or dependencies, second build after a
clean build).  The number of globs has gotten high enough that rerunning
them all can have significant overhead to start bpglob for each one.

Replace the per-glob bpglob invocations with sharded invocations using
1024 hash buckets.

Bug: 159845846
Test: glob_test.go
Test: m nothing && m nothing
Test: build/soong/bootstrap_test.sh
Change-Id: Ife1f7a03c8f6b25d1be01531425d8dc2c76d1ea0
2021-04-15 11:04:11 -07:00
Colin Cross
f995bb2235 Merge "Version bpglob command line arguments" am: 45222ec3ca am: a8444548f3
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1673987

Change-Id: I136354e7217590babf7a6d0b6ed73e1721a9b73c
2021-04-15 17:53:11 +00:00
Colin Cross
a8444548f3 Merge "Version bpglob command line arguments" am: 45222ec3ca
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1673987

Change-Id: I207265e94a6ea9b2dcd3456cbfa54773c8e1d04d
2021-04-15 17:09:12 +00:00
Colin Cross
45222ec3ca Merge "Version bpglob command line arguments" 2021-04-15 16:42:08 +00:00
Lukacs T. Berki
20d39d68df Make Blueprint better callable from Go: am: 98e0efb9a4 am: af5d832934
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1675531

Change-Id: I01df353a3beca3a8af8dc27f9906124d8be49b82
2021-04-15 14:51:12 +00:00
Lukacs T. Berki
af5d832934 Make Blueprint better callable from Go: am: 98e0efb9a4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1675531

Change-Id: Ic1d17a40736c9a7934745db0217cb301c5785487
2021-04-15 13:59:45 +00:00
Lukacs T. Berki
f646afb52f Use the correct build dir.
Args.BuildDir was accidentally hard-wired to "." in one of my previous
changes, and since Blueprint is not really independent of Soong anymore,
it's probably better to fix it in a way that doesn't involve putting
back the almost-but-not-completely redundant "-b" command line argument
to the primary builder invocation.

Test: Presubmits.
Change-Id: I76d064a99be16cd812cb47a6c448fe44b51893dc
2021-04-15 15:46:35 +02:00
Lukacs T. Berki
f4d43ac0d7 Remove the extraNinjaFileDeps arg of RunBlueprint.
The only thing that was done with it was to append it to the list of
dependencies returned, which can just as well be done by the caller.

Test: Presubmits.
Change-Id: Ibedf024de411a5881f19ed0c137a91b0898f1269
2021-04-15 15:05:26 +02:00
Lukacs T. Berki
59186d0207 Make it possible to call the primary builder more than once. am: 78df853e07 am: a098ae38ab
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1675525

Change-Id: I4fdff24ac1bcba1a6318d2b5754fe394b1e92dfd
2021-04-15 12:22:22 +00:00
Lukacs T. Berki
a098ae38ab Make it possible to call the primary builder more than once. am: 78df853e07
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1675525

Change-Id: I9d1649cb218a1f02ffa7b40d855e2d93e2de4170
2021-04-15 11:44:51 +00:00
Colin Cross
7e6f6b7932 Version bpglob command line arguments
bpglob is executed through the rules in build-globs.ninja to determine
whether soong_build needs to rerun.  That means when the arguments
accepted by bpglob change it will be called with the old arguments,
then soong_build will rerun and update build-globs.ninja with the new
arguments.

To avoid having to maintain backwards compatibility with old arguments
across the transition, a version argument is used to detect the
transition in order to stop parsing arguments, touch the output file
and exit immediately.  The version number in
pathtools.BPGlobArgumentVersion should be manually incremented when
the bpglob argument format changes.

If the version argument is not passed then a version mismatch is assumed.

Bug: 159845846
Test: build/soong/tests/bootstrap_test.sh
Change-Id: Id6742c7acc51af8d0d224d51e47bddea78e6e363
2021-04-14 09:28:22 -07:00
Lukacs T. Berki
98e0efb9a4 Make Blueprint better callable from Go:
- Make the parsed command line arguments accessible from other packages
- Separate writing the depfile from writing the Ninja file
- Extract a method to compute the name of the file list file for globs

Test: Presubmits.
Change-Id: I4d0daf0f3776a9336da305be0108ebf70a314776
2021-04-14 13:47:52 +02:00
Lukacs T. Berki
78df853e07 Make it possible to call the primary builder more than once.
This is accomplished by plumbing PrimaryBuilderInvocation in from
bootstrap.Args.

The confusing removal of "primaryBuilderExtraFlags" from documentation
generation is because it used to (erroneously) refer to the func defined
in command.go and its removal apparently doesn't break anything. I
suspect that this code path is dead within Android, but we'll need to
wait until May to remove it.

Test: Presubmits.
Change-Id: I8763579b82bd79d5ee0f233edfd48327282e401c
2021-04-14 10:28:54 +02:00
Colin Cross
8b5ccb279e Merge "Make Glob return a GlobResult" am: 5ce0d78363 am: 646545f2e8
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668807

Change-Id: I4101f77d97dfd3e18e0064f2a57e5993696bf88e
2021-04-13 18:24:45 +00:00
Colin Cross
646545f2e8 Merge "Make Glob return a GlobResult" am: 5ce0d78363
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668807

Change-Id: I19d371687f18c9e011f4c1ce29c2574a09d6282a
2021-04-13 17:41:01 +00:00
Colin Cross
5ce0d78363 Merge "Make Glob return a GlobResult" 2021-04-13 17:01:39 +00:00
Lukacs T. Berki
79e63ab23d Move primary builder command line computation. am: 77ef79b7c4 am: ee04d8cc09
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1673050

Change-Id: I0cd9b8943cb91174bb83506412104238b56f475e
2021-04-13 07:35:19 +00:00
Lukacs T. Berki
ee04d8cc09 Move primary builder command line computation. am: 77ef79b7c4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1673050

Change-Id: I81958eb1b4ce674920d019cc497fa52a93acb4f1
2021-04-13 06:53:21 +00:00
Lukacs T. Berki
77ef79b7c4 Move primary builder command line computation.
This makes it possible to invoke the primary builder more than once in a
single Ninja file.

This required adding arguments that were hard-wired in the build.ninja
rule to extraArgs and adding a "set of primary builder invocations"
member to bootstrap.Config . The only command line arguments that remain
hard-wired are those which are expected to be relevant to every
invocation of the primary builder.

As a welcome side effect, I was able to remove a number of random
environment variables that were so far special-cased ($SOONG_DELVE,
$SOONG_DELVE_PATH and $SOONG_OUTDIR). I was also able to move writing
the empty stub ninja glob file to command.go from the bowels of the
Blueprint machinery.

In theory, $TOP and $BUILDER could be removed, too, but this would
require hard-coding the value of $TOP into build.ninja and I don't know
what would break if I did that (it's okay to hard-wired $SOONG_DELVE and
$SOONG_DELVE_PATH because those are only used for debugging and
$SOONG_OUTDIR turned out to be superfluous)

Test: Presubmits.
Change-Id: Idbfd9976c4b270bc3e5a8926c8c760a8534596cf
2021-04-12 14:30:47 +02:00
Colin Cross
bc184384fe Remove unused GlobPatternList function am: 850d3886d4 am: 0bb9608b51
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668806

Change-Id: I9d7435100757e0e8838cde9512ff25cda0a6976b
2021-04-09 17:49:02 +00:00
Colin Cross
0bb9608b51 Remove unused GlobPatternList function am: 850d3886d4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1668806

Change-Id: Ied4730e9239f93567dc4ca65049091d2440b16e4
2021-04-09 17:07:38 +00:00
Colin Cross
67c99255cc Make Glob return a GlobResult
Replace the individual matches and deps return values with a GlobResult
struct.  Use the GlobResult to create the file list file in GlobWithDepFile
(used by bpglob) and in the glob singleton, as the generated files must
match exactly so that soong_build is not rerun.

Bug: 159845846
Test: glob_test.go
Change-Id: I2159cc9d85f388073198eac7456e5bf43e813096
2021-04-08 11:03:17 -07:00
Colin Cross
850d3886d4 Remove unused GlobPatternList function
Bug: 159845846
Test: builds
Change-Id: I7c60706ec0c660ab28843d5fc0b223f8a806eb4a
2021-04-08 11:03:17 -07:00
Lukacs T. Berki
9156028edc Add dumping the module graph in JSON format. am: 6f6828235f am: 792b521fb4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1662000

Change-Id: Ie63892b7eb9a2de245a806fa951f2ca3a9275ff1
2021-04-06 08:55:58 +00:00
Lukacs T. Berki
792b521fb4 Add dumping the module graph in JSON format. am: 6f6828235f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1662000

Change-Id: Iccc0c71eb77b34eec8f0bf1aa3a2cffd3947f823
2021-04-06 08:10:26 +00:00
Lukacs T. Berki
6f6828235f Add dumping the module graph in JSON format.
Test: Presubmits + eyeballing the output.
Change-Id: I26688957905f82a5437d90a7a51f7598a321a6e0
2021-04-01 18:38:31 +02:00
Lukacs T. Berki
5e57365143 Replace README.md with an archival announcement. am: f1aff1f954 am: 3fb52d13c4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1655694

Change-Id: Ie47ae3f68e3a158a0c37613602bb320298308be6
2021-03-30 09:01:03 +00:00
Lukacs T. Berki
3fb52d13c4 Replace README.md with an archival announcement. am: f1aff1f954
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1655694

Change-Id: Ie9eaacd2798ae60bdb22bda7ede1a798ae6eb19e
2021-03-30 08:21:59 +00:00
Lukacs T. Berki
f1aff1f954 Replace README.md with an archival announcement.
Test: None, only documentation change.
Change-Id: I3b7bf8fc2ab4fb0ac0d32c10a7c287643e6b89c8
2021-03-29 18:13:57 +02:00
Paul Duffin
21d2987201 Always shard structs if they would exceed maxNameSize even if unfiltered am: 2aa510c27b am: fc2278d1b1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1652285

Change-Id: Id54ea354cfffe2274ab02c2ad7d9e51cf64bce5d
2021-03-26 18:15:22 +00:00
Paul Duffin
fc2278d1b1 Always shard structs if they would exceed maxNameSize even if unfiltered am: 2aa510c27b
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1652285

Change-Id: I6ea431cede51576f8c19cce2f0151549717ea242
2021-03-26 17:34:52 +00:00
Paul Duffin
2aa510c27b Always shard structs if they would exceed maxNameSize even if unfiltered
Previously, a struct (anonymous or named) whose fields all matched the
predicate would not be sharded and would simply be reused. However,
that could break the maxNameSize limitation which could cause problems
for the caller.

This change makes sure that the supplied struct is only reused if it
does not exceed the maxNameSize, and otherwise is sharded.

Bug: 183777071
Test: m nothing
Change-Id: I8af272ec121077a43333e72b67cfd0e493c83362
2021-03-26 09:59:19 +00:00
Lukacs T. Berki
185ed79853 Add an accessor function for the output Ninja file. am: a9ec69433d am: 584023ba01
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1651769

Change-Id: Iad3c2e531c254e9bb33ba4e980494ce65db9d390
2021-03-24 17:01:49 +00:00
Lukacs T. Berki
584023ba01 Add an accessor function for the output Ninja file. am: a9ec69433d
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1651769

Change-Id: I5795be5d93ee2fee4a2415390a8069683180825e
2021-03-24 16:24:48 +00:00
Lukacs T. Berki
a9ec69433d Add an accessor function for the output Ninja file.
Test: Presubmits.
Change-Id: I505dfbbf7f87c6ea6bce71f7ae4ef8ca750d066d
2021-03-24 10:57:13 +01:00