Commit graph

2924 commits

Author SHA1 Message Date
Colin Cross
8530c625b9 Fix OutgoingTransitionContext to match the description of TransitionMutators am: 33bec91aec
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2923530

Change-Id: I8f76a7cdc0694e0f8ea34fb1b17ade729a6cf412
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-24 20:36:25 +00:00
Colin Cross
33bec91aec Fix OutgoingTransitionContext to match the description of TransitionMutators
The description of TransitionMutators says that "the outgoing transition
should not take the properties of the dependency into account, only those
of the module that depends on it. For this reason, the dependency is not
even passed into it as an argument."  However, OutgoingTransitionContext
was returing the dependency from ctx.Module(), not the parent.  This
didn't matter for the only existing TransitionMutator, as it only used
the module to get a constant value.

Test: sanitize_test.go
Change-Id: I1ce5b3144787f57be4d50e95f0c923da9b2b079f
2024-01-22 17:18:40 -08:00
Cole Faust
01b4981fe2 Merge "Remove SymlinkOutputs" into main am: 079c92fb04
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2917003

Change-Id: Icc339be8a89a9ad1bb186f6706c5e6402c7ed755
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-19 19:59:24 +00:00
Cole Faust
079c92fb04 Merge "Remove SymlinkOutputs" into main 2024-01-19 19:38:55 +00:00
Colin Cross
21ed16ee0b Fix data race in a parallel singletons calling VisitAllModules am: e70495ba9a
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2917002

Change-Id: I1ed3c25b4e82337337f311a0eb1b9624d7454daf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-19 00:48:43 +00:00
Colin Cross
c0b0a19454 Move name memoization out of variables am: 6bc984abca
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2917001

Change-Id: I240b9a3db493a0114c53195e99721644586184da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-19 00:48:29 +00:00
Cole Faust
828e6b4f20 Remove SymlinkOutputs
symlink_outputs was added so bazel could run ninja files, but we
abanoned that approach in roboleaf, and then roboleaf was cancelled
entirely. Remove this feature so we're more compatible with upstream
ninja / n2.

Bug: 160568334
Test: Presubmits
Change-Id: Ie3afd084c5574444dddac77cba1866e82ff2ca19
2024-01-18 12:41:16 -08:00
Colin Cross
e70495ba9a Fix data race in a parallel singletons calling VisitAllModules
Force a resort of the module groups before running singletons
so that two singletons running in parallel don't cause a data
race when they trigger a resort in VisitAllModules.

Test: go test -race ./...
Change-Id: Iec041cec08c33c56787aadbde6a1b2b619815142
2024-01-18 12:28:49 -08:00
Colin Cross
6bc984abca Move name memoization out of variables
memoizeFullName was added to variables, rules and pools as an
optimization to prevent recomputing the full name repeatedly,
but the storage of variables, rules and pools are generally global
and not tied to the Context.  When running multiple tests in
parallel there will be multiple Context objects all trying to
update the memoized names on the global variables, causing a data
race.

Package names were previously memoized via a pkgNames map stored
on the Context.  Expand pkgNames to a nameTracker object that
contains maps for packages, variables, rules and pools, and replace
calls to fullName with calls through nameTracker.

Test: context_test.go
Change-Id: I15040b85a6d1dab9ab3cff44f227b22985acee18
2024-01-18 12:28:49 -08:00
Zi Wang
510abfab4f Merge "Remove unnecessary used names before reporting" into main am: 2f0f395cc9 am: 79e4baab88 am: b0cce0bde8
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2810185

Change-Id: Ibb04d7649d3b78d5216034cef3c570e9cf89ae15
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-05 01:25:47 +00:00
Zi Wang
b0cce0bde8 Merge "Remove unnecessary used names before reporting" into main am: 2f0f395cc9 am: 79e4baab88
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2810185

Change-Id: I2357012eec65f3eba246a1aeb4dde17b5728cea8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-05 00:36:23 +00:00
Zi Wang
79e4baab88 Merge "Remove unnecessary used names before reporting" into main am: 2f0f395cc9
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2810185

Change-Id: I2bb7aad8bf50e16c77f26839c9ce55d1baa65459
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-05 00:07:04 +00:00
Zi Wang
2f0f395cc9 Merge "Remove unnecessary used names before reporting" into main 2024-01-04 23:35:05 +00:00
Zi Wang
e5913c17e9 Remove unnecessary used names before reporting
When property a.b.c is not used, (also there is no a.* or a.b.* used)
"a", "a.b" and "a.b.c" are all in unusedNames.
removeUnnecessaryUnusedNames only keeps the last "a.b.c" as the
real unused name.

Test: TestNonExistentPropertyInSoongConfigModule, unpack_test.go and CI

Bug: 171232169
Change-Id: I861fa6933e558b07694ee5ff40ef549117d115ff
2024-01-04 12:24:39 -08:00
Cole Faust
1ad5037f43 Merge "Add implicit inputs to primary builder actions" into main am: 6733423618 am: fa7e35cab5 am: 7a0266716d
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2893438

Change-Id: Icad92b0b11c1aabf20c7924c0ba628d081fa54a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-03 07:52:35 +00:00
Cole Faust
7a0266716d Merge "Add implicit inputs to primary builder actions" into main am: 6733423618 am: fa7e35cab5
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2893438

Change-Id: Iee2656fb666f0e938c9d2617a511d092726ddf17
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-03 07:19:25 +00:00
Cole Faust
fa7e35cab5 Merge "Add implicit inputs to primary builder actions" into main am: 6733423618
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2893438

Change-Id: If3cfb7ffe612b2c577f554561edb788ddcf01abd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-03 06:45:56 +00:00
Cole Faust
6733423618 Merge "Add implicit inputs to primary builder actions" into main 2024-01-03 06:14:23 +00:00
Cole Faust
ef75beb068 Add implicit inputs to primary builder actions
This is needed so primary builder actions can directly depend on their
glob result files.

Bug: 318434287
Test: rm -rf out && m nothing && m nothing
Change-Id: I5c67ee53c9f18f81c79c0fe13b3338eacaccdbc0
2024-01-02 16:58:49 -08:00
Treehugger Robot
9593d9cd8c Merge "Optimize returning the zero value from provider APIs" into main am: 321aad0a8c am: 162690bb2a am: fb95058b94
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876680

Change-Id: I6221dadb2f0e563f15b3210fb87a6c9148c9bfba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-02 21:47:04 +00:00
Treehugger Robot
fb95058b94 Merge "Optimize returning the zero value from provider APIs" into main am: 321aad0a8c am: 162690bb2a
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876680

Change-Id: Ibacede1bbe35ab746ed15b05dfbbabcba658a18a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-02 21:13:33 +00:00
Treehugger Robot
162690bb2a Merge "Optimize returning the zero value from provider APIs" into main am: 321aad0a8c
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876680

Change-Id: Id31bed194ece3f9448b9169d6800f99d2eff6e74
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-01-02 20:43:05 +00:00
Treehugger Robot
321aad0a8c Merge "Optimize returning the zero value from provider APIs" into main 2024-01-02 20:17:29 +00:00
Treehugger Robot
b5ac633123 Merge "Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin" into main am: e1d71ae428 am: 083f69bbcd am: e489b79327
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2878400

Change-Id: I0bdb17529a93aa46464a3005481ae98ef52e33db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 20:43:20 +00:00
Colin Cross
7c52ee2c54 Use generics for providers API am: ed49204e85 am: ab36164bd4 am: 9aad788ad9
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876679

Change-Id: Id41a9c4d970a6e3a7b96cdd9f830d423c9223181
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 20:42:51 +00:00
Treehugger Robot
e489b79327 Merge "Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin" into main am: e1d71ae428 am: 083f69bbcd
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2878400

Change-Id: I621764dea2d42d1a45aadc0b4abd0ac5f6d52708
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 20:26:15 +00:00
Treehugger Robot
083f69bbcd Merge "Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin" into main am: e1d71ae428
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2878400

Change-Id: Iec29daefb5abdf1ed561a6ba566cbdc936b681de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 20:11:53 +00:00
Colin Cross
9aad788ad9 Use generics for providers API am: ed49204e85 am: ab36164bd4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876679

Change-Id: If06b6b773da5ccf6fc5b43fbd2a181123e20ae32
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 20:11:10 +00:00
Treehugger Robot
e1d71ae428 Merge "Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin" into main 2023-12-18 19:50:44 +00:00
Colin Cross
ab36164bd4 Use generics for providers API am: ed49204e85
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2876679

Change-Id: Ib794718d3f2717becdb9d058cef1385c2242caa8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-18 19:32:25 +00:00
Colin Cross
0bb75189da Fix TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces on darwin
TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces
use "echo -n", which fails on darwin.  These tests weren't running on
darwin because they were only run in Soong, which always limits to
only short tests.  The test are now run in aosp-build-tools, which
doesn't limit to short tests.

Remove the unsupported -n argument from echo and trim the added newline
instead.

Test: TestExternalShellEscaping and TestExternalShellEscapeIncludingSpaces
Change-Id: I3d8ff1c0db0af386e1dc13cb6c2dabe561c1c89e
2023-12-15 16:30:59 -08:00
Colin Cross
8514b5c26d Optimize returning the zero value from provider APIs
Now that nothing calls *Context.*Provider directly, make the blueprint
methods return a nil any interface instead of the zero value that was
constructed via reflection.  The type-safe wrappers will return a
zero value that can be constructed without any reflection or copying.

Bug: 316410648
Test: provider_test.go
Change-Id: I0abde5bacab9964a83f03c1644b51295a6c34d0b
2023-12-14 16:59:19 -08:00
Colin Cross
ed49204e85 Use generics for providers API
Using generics for the providers API allows a type to be associated
with a ProviderKey, resulting in a type-safe API without that doesn't
require runtime type assertions by every caller.

Unfortunately, Go does not allow generic types in methods, only in
functions [1].  This prevents a type-safe API on ModuleContext, and
requires moving the API to be functions that take a ModuleContext as
a parameter.

[1] https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#no-parameterized-methods)

Bug: 316410648
Test: provider_test.go
Change-Id: Ide91de9f2a2a7d075b05e287c7cc86b395db0edb
2023-12-14 16:59:16 -08:00
Aditya Choudhary
69d51d17b7 Create src file provider in build/blueprint am: a992d06f60 am: 1f847607f0 am: 897e67760c
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: Iccf16477ba933fe66d8e09cf0f3a745b9b26d033
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 09:30:23 +00:00
Aditya Choudhary
41510606d9 Create src file provider in build/blueprint am: a992d06f60 am: 516ef4f48e am: a0377a7bc9
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: Ifade029b6389d97b1acce4845352df20c08da51a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 09:29:53 +00:00
Aditya Choudhary
897e67760c Create src file provider in build/blueprint am: a992d06f60 am: 1f847607f0
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: I0e2e10cbf5766d20caf53a2b35512459e0d56c77
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:59:40 +00:00
Aditya Choudhary
a0377a7bc9 Create src file provider in build/blueprint am: a992d06f60 am: 516ef4f48e
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: I30043fba7655e449da27811a4fdb008a2f31bb02
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:57:54 +00:00
Aditya Choudhary
1f847607f0 Create src file provider in build/blueprint am: a992d06f60
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: I8ca8ead4c7237559f6c906d16e6be276ed0c83e2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:11:25 +00:00
Aditya Choudhary
516ef4f48e Create src file provider in build/blueprint am: a992d06f60
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854653

Change-Id: Idf8f6435270d1afbaef6759d99be34b843975235
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 08:11:01 +00:00
Jooyung Han
9570d1bbed Add a new util to clear a property am: 02d2b9e4cc am: 8a5f9be346 am: 399fc2867f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I333018b002664f7711965b2516c8231450477855
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 07:43:21 +00:00
Aditya Choudhary
a992d06f60 Create src file provider in build/blueprint
Change-Id: I7091effe7791c1f3ea57e775b37cd72f4ee13d03
2023-12-05 07:14:29 +00:00
Jooyung Han
399fc2867f Add a new util to clear a property am: 02d2b9e4cc am: 8a5f9be346
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I91c441f3d0ba34dfb34c0092a10d8725f0a6c476
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 07:08:21 +00:00
Jooyung Han
14dfa4b796 Add a new util to clear a property am: 02d2b9e4cc am: da4c2df54f am: 034a888f31
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I03d06ab134fc891e0632065f64e384d42537d3a6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 06:54:49 +00:00
Jooyung Han
8a5f9be346 Add a new util to clear a property am: 02d2b9e4cc
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I27d02317d5d2fccffb7aa9defe1eef974dbc5f94
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 06:19:59 +00:00
Jooyung Han
034a888f31 Add a new util to clear a property am: 02d2b9e4cc am: da4c2df54f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I100b21657995d7475b2c9fc5eeb2c65d65ccd883
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 06:05:22 +00:00
Jooyung Han
da4c2df54f Add a new util to clear a property am: 02d2b9e4cc
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2854407

Change-Id: I5151b8df9fc158ff8ff0ca3dcc70bf4c43d7fd73
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-05 05:57:01 +00:00
Jooyung Han
02d2b9e4cc Add a new util to clear a property
proptools.Clear(ptr) clears a property with its zero value.

Bug: 313806237
Test: m blueprint_tests
Change-Id: Ib78f9f88a9b0a8b04e1ab6c5e545b55ba4269e5d
2023-12-04 11:01:23 +09:00
Colin Cross
bfed90c5c5 Fix TestCloneProperties for go 1.21 am: 50fe8e79e5 am: 6ed8e962c4 am: 4c935d4772
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2824190

Change-Id: I7374ed0017dab36a9d4b0dcc1a541509eb836d80
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 20:59:22 +00:00
Colin Cross
f335282227 Fix TestCloneProperties for go 1.21 am: 50fe8e79e5 am: 21118230c9 am: d732cac5fd
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2824190

Change-Id: Ibaa23df8fb71b06d2edd03adf30d539158802375
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 20:49:34 +00:00
Colin Cross
4c935d4772 Fix TestCloneProperties for go 1.21 am: 50fe8e79e5 am: 6ed8e962c4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2824190

Change-Id: I3b9ad5722e6280012b24975fb2d00129626b52d4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 19:33:01 +00:00