Commit graph

2545 commits

Author SHA1 Message Date
Steven Moreland
d457f11884 Add name hint to blueprint.
Bug: N/A
Test: updated
Change-Id: Iac9218aa7621dd6223dc26a9f2ebec5d68211328
2023-04-10 20:21:15 +00:00
Treehugger Robot
44baecd513 Merge "Add a stronger wording to don't use ModuleFromName" 2023-04-05 04:03:15 +00:00
Liz Kammer
c9df6d7964 Add a stronger wording to don't use ModuleFromName
Test: n/a
Change-Id: I42de1e46a50a103fca0d6f60a0748f5cc107bac7
2023-04-04 11:56:55 -04:00
Sam Delmerico
48020c8daa improve error handling for SourceRootDirs
Previously, warnings about missing modules were printed directly to
stderr. Instead we can pass these messages along as errors using the
existing pathways.

Bug: 269457150
Test: m nothing
Test: add -external to PRODUCT_SOURCE_ROOT_DIRS and observe missing
  module errors
Change-Id: Ib6624b9edbd103247f7f6e6d4c3030f1959aa56c
2023-03-30 14:19:39 -04:00
Treehugger Robot
82aa0ffb51 Merge "ignore bp files from PRODUCT_SOURCE_ROOT_DIRS" 2023-03-29 17:04:37 +00:00
Sam Delmerico
08bd504b62 ignore bp files from PRODUCT_SOURCE_ROOT_DIRS
Soong analyzes the entire source tree even though not every lunch target
needs to know about every module. For example, OEM sources can be
ignored for cuttlefish products. This functionality allows blueprint to
ignore a list of undesired directories.

Bug: 269457150
Change-Id: Icbbf8f3b66813ad639a7ebd27b1a3ec153cbf269
2023-03-27 14:43:07 -04:00
Jeongik Cha
4589dfd812 Add GetOutputsFromModuleNames in Context
To build ninja hint including output path from module name

Test: m --ninja_weight_source=soong
Bug: 273282046
Change-Id: Ibb94c2c4efef4a6dedc973cbb90625231845d42e
2023-03-23 11:17:11 +09:00
Cole Faust
bef8688e45 Optimize and simplify order-only dep deduplication
This reduces the extract_phonys (now deduplicate_order_only_deps)
event's time from ~1.9s to ~1.5s on aosp-master, and from ~5.3s to ~4.6s
on internal master.

It does so by making keyForPhonyCandidate be based on a hash instead
of joining all the deps together. Having a hash allows us to also use
it as the name of the phony target, which simplifies the code a little.

Bug: None (original cl introducing extractPhonys also didn't have a bug)
Test: go tests
Change-Id: I2ff6e4614f19ccbfe99112ea7ae1ea33cd1df21b
2023-03-16 16:43:55 -07:00
Cole Faust
ef778a12ac Merge "Fix error messages not printing names" am: 2ed895448b
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2477772

Change-Id: I24c36250b68c7b69363d450e1016eac82f2fc3ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-09 00:29:28 +00:00
Cole Faust
2ed895448b Merge "Fix error messages not printing names" 2023-03-08 23:57:31 +00:00
Cole Faust
ff87a5128b Fix error messages not printing names
Bug: 271424349
Test: Presubmits
Change-Id: I8dd6ab7109c29bd8a03fd2f898eebe1a50a28914
2023-03-08 11:53:24 -08:00
Usta Shrestha
80d4d41953 Use phony ninja outputs to reduce file-size am: 2bae13b095
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2449271

Change-Id: Id6d6187eef662ab628c268caa9b26391df075da5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-07 16:30:56 +00:00
Usta Shrestha
2bae13b095 Use phony ninja outputs to reduce file-size
1. scan if any set of order-only deps are repeated
  2. if so extract them as a phony output to be shared

Test: m libc
Bug: NA
Change-Id: I0689111b97bbbd1f3b26650e8ae2e0a4ffb5085e
2023-03-07 01:39:27 -05:00
Kevin Dagostino
0ce4909fd2 Enable parallelCompile since golang is now >= 1.9 am: ad7bcc7b50
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2469723

Change-Id: If58146bc8c54081ee318362f33a79db8cfbd51f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-06 18:00:20 +00:00
Kevin Dagostino
ad7bcc7b50 Enable parallelCompile since golang is now >= 1.9
Test: m nothing
Change-Id: I38cdd83ca9b17263155433abb65fb4f97b5ec70b
2023-03-03 21:57:29 +00:00
Usta Shrestha
35136c7d74 cosmetic: readability am: 4cff07db25
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2449269

Change-Id: I90f60e52e43528e26681278244bccb8667675444
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-02 05:07:10 +00:00
Usta Shrestha
66a29aefa0 Add unit test for EventHandler am: 3e334cfed2
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2458548

Change-Id: I18705ae924814febb401af5e447920ea507bcaf0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-28 19:35:06 +00:00
Usta Shrestha
4cff07db25 cosmetic: readability
Test: run `m nothing`
Bug: NA
Change-Id: Id58635cc949f07e5263ad67b0e78c66d19abba40
2023-02-27 11:41:51 -05:00
Usta Shrestha
3e334cfed2 Add unit test for EventHandler
Test: the added file
Bug: NA
Change-Id: Id50105e84585348ce8540f52407224daeb8eb0d4
2023-02-27 11:41:51 -05:00
Treehugger Robot
a50172080b Merge "cosmetic: use _ for unused args" am: 1821351760
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2449270

Change-Id: I57324caea1736d8b4c6e95c2956caacd5b53f1c7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-23 19:46:21 +00:00
Usta Shrestha
2833cebfa2 cosmetic: readability am: ce85ecb176
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2444579

Change-Id: I4772e567093cace606edcdb6fe486dacbd92ed4b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-23 19:14:04 +00:00
Treehugger Robot
1821351760 Merge "cosmetic: use _ for unused args" 2023-02-23 16:21:18 +00:00
Usta Shrestha
7f3c51ca43 cosmetic: use _ for unused args
Test: run `m nothing`
Bug: NA
Change-Id: Idfdb0d4121244e25847822114a2d12c6bb18ebd1
2023-02-23 02:28:12 +00:00
Usta Shrestha
ce85ecb176 cosmetic: readability
Test: run `m nothing` and `m nothing --empty_ninja_file`
Bug: NA
Change-Id: I6fd81667ea2d636139ae38bc36315f8710b72c25
2023-02-23 02:27:26 +00:00
Sam Delmerico
112f8ce34f apply gofmt am: 26e44b7b78
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2448682

Change-Id: I9627ededb4270842ccc5f205b720c002c30c52a5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-22 15:43:22 +00:00
Sam Delmerico
26e44b7b78 apply gofmt
Change-Id: I2416e246b3d8485a6b7810b998cff2f45f6a0494
2023-02-21 15:11:20 -05:00
Liz Kammer
01fb1d4c41 Add event handler for each mutator am: a988f08000
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2432532

Change-Id: I977d86f07f9d68534e2f1714379e0882d74b8b48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-14 19:53:24 +00:00
Liz Kammer
addb326e69 Add getter for EventHandler so its easier to mock am: 073f69d723
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2434332

Change-Id: I5623fa879897e896ba1762172bd0b1a0dc6addf7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-14 19:51:29 +00:00
Liz Kammer
a988f08000 Add event handler for each mutator
Collect additional metrics for individual mutators in order to
understand impact of individual mutators.

Test: m nothing
Change-Id: Ic3ecb1e79a79dd665c9f60d29f0dfd3732481c2d
2023-02-13 18:02:23 -05:00
Liz Kammer
073f69d723 Add getter for EventHandler so its easier to mock
Test: m nothing
Change-Id: Ied338a25f12404ddc88c3b3cb7d7f2ff9ade3aab
2023-02-13 18:02:22 -05:00
Chris Parsons
33d423ce03 Close ninja file descriptor am: 58a29728ea
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2428033

Change-Id: I47bb7ac1f2628b3aed73491d71ab0415edfe4654
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-09 17:45:29 +00:00
Chris Parsons
58a29728ea Close ninja file descriptor
With this close() missing, especially with large ninja files, soong paid
the runtime cost at arbitrary times during the rest of its execution (or
during process cleanup).

Test: Manual runs of `m nothing` and verifying timing metrics
Change-Id: Ibdfbf7371cfc4c58c485e76f96b8e9b9ad900972
2023-02-08 23:33:56 -05:00
Cole Faust
c03d43564a Show the ninja string that failed to parse in errors am: c5baf11a2d
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2393625

Change-Id: Ie6c2eac046adda1bd4a2a57c33658fdc8c6b01a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-20 00:21:49 +00:00
Cole Faust
c5baf11a2d Show the ninja string that failed to parse in errors
So that it's easier to debug what the problem is.

Test: m nothing
Change-Id: I97e81f98f0365e981d34c6b8bec8528de1b7e514
2023-01-19 14:23:04 -08:00
Treehugger Robot
025144564c Merge changes I516c984b,I2b3354de am: a405cf7f6a am: a82dd5f183
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2364231

Change-Id: I46274bfec11afcdb580f7fb1839862c29130df06
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-21 16:40:18 +00:00
Treehugger Robot
a82dd5f183 Merge changes I516c984b,I2b3354de am: a405cf7f6a
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2364231

Change-Id: I29db8b42c0449ee8b2510ca4d5f549e2665ebeb0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-21 16:06:25 +00:00
Treehugger Robot
a405cf7f6a Merge changes I516c984b,I2b3354de
* changes:
  comment on how glob files are written
  cosmetic: use map[_]struct{}  for set semantics
2022-12-21 15:44:42 +00:00
Usta Shrestha
f0e02237da comment on how glob files are written
Bug: NA
Test: NA
Change-Id: I516c984b62d07ca7f188b2faef1466c5720b3b22
2022-12-21 01:04:19 -05:00
Usta Shrestha
09e0dd2ec9 cosmetic: use map[_]struct{} for set semantics
Bug: NA
Test: `m nothing` then view soong_metrics
Change-Id: I2b3354de3259ffef9ae881d59ac844fb518074f2
2022-12-21 01:01:55 -05:00
Sasha Smundak
08080643bc bootstrap.Args should contain only relevant command line arguments am: 08343b7a89 am: 8ede84e357
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2346817

Change-Id: Idd7a6163ccbdb438e5ffa45ca5a990a190d6dc86
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-17 00:36:58 +00:00
Sasha Smundak
8ede84e357 bootstrap.Args should contain only relevant command line arguments am: 08343b7a89
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2346817

Change-Id: I951417af664c64ab1fdf4b1f41ec3a702a33efc9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-17 00:05:46 +00:00
Sasha Smundak
08343b7a89 bootstrap.Args should contain only relevant command line arguments
Soong/Bazel-specific arguments are now kept in Soong.

Test: treehugger
Change-Id: If37bc6ea60b58173baa981bb5c85bfc90102005c
2022-12-14 10:27:31 -08:00
Spandan Das
e2abe5bfa6 Merge "Conditional inclusion of blueprint modules" am: c3887c2bbb am: 9bc3a984d7
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2296765

Change-Id: If04d9ceaddcbd5c8dc8a28b69241e7c6c9cbb517
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-06 00:50:20 +00:00
Spandan Das
9bc3a984d7 Merge "Conditional inclusion of blueprint modules" am: c3887c2bbb
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2296765

Change-Id: I013db529bab6f374bc1ba5831947464336a571a0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-06 00:18:11 +00:00
Spandan Das
c3887c2bbb Merge "Conditional inclusion of blueprint modules" 2022-12-05 23:50:23 +00:00
MarkDacek
f1423d13cb Add bazel-force-enabled-modules. am: 99f7962b35 am: 2def2db38b
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2322194

Change-Id: I0429639c8191020ccb594e597ddae9c740845514
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02 23:00:02 +00:00
MarkDacek
2def2db38b Add bazel-force-enabled-modules. am: 99f7962b35
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2322194

Change-Id: If3e2893d549129999b077de97816a81aa13c6055
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-02 22:29:42 +00:00
Spandan Das
ed4af01be6 Conditional inclusion of blueprint modules
This introduces a new `blueprint_package_includes` module type. If
present, other blueprint modules in that file will be analyzed
if and only if the requested include tags are met

example syntax:
```
Android.bp
blueprint_packgage_includes {
  match_all: ["tag1", "tag2", ...],
}

other_module1 {...}
other_module2 {...}
```
other_module1 and other_module2 will not be analyzed unless
tag1,tag2, ... are set

This also adds a new object of type `IncludeTags` to the Context object,
which is a container for these string keys.

Test: In build/blueprint, go test ./
Test: TH

Change-Id: I79de0d7da3224a5b2025c27a5137f39d00c7382e
2022-12-02 01:46:28 +00:00
MarkDacek
99f7962b35 Add bazel-force-enabled-modules.
Test: m nothing
Change-Id: I97d8fcb304f0d039fd7bbd3ea3d01966ae25471f
2022-12-01 20:15:33 +00:00
Colin Cross
6e7fcd48f5 Add VariableFuncContext argument to VariableFuncs am: 1b457a5e10 am: 2fde855964
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2286235

Change-Id: I6ba6f89a19b1c94fd34b115e639ddd5f0861b7cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-04 22:44:46 +00:00