Commit graph

3001 commits

Author SHA1 Message Date
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
Colin Cross
d732cac5fd Fix TestCloneProperties for go 1.21 am: 50fe8e79e5 am: 21118230c9
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2824190

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

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

Change-Id: If679bf544928acff32a8684bcc58e60108632359
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 18:57:43 +00:00
Colin Cross
50fe8e79e5 Fix TestCloneProperties for go 1.21
Go 1.21 does a better job using the same empty allocation for empty
structs, allow cloned properties to point to the original when it
is an empty struct.

Bug: 309895579
Test: TestCloneProperties
Change-Id: I064f2316a8a8017a109968671ac305dbbe3246af
2023-11-08 22:07:58 -08:00
Treehugger Robot
4bdff04d5d Merge "Remove pre singletons" into main am: 228915b2f1 am: 521b42e95d am: ee70cce141
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: I35b2ea5e98b6560a2484aeefef7900a19b7b585e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 19:32:57 +00:00
Treehugger Robot
0387ee776d Merge "Remove pre singletons" into main am: 228915b2f1 am: 90d740b3cb am: 8e0f2903ef
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: I00f39a9c9c21aeac9ce81ac523f156cbaa1123f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 19:29:53 +00:00
Treehugger Robot
ee70cce141 Merge "Remove pre singletons" into main am: 228915b2f1 am: 521b42e95d
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: I0f64bdb41b53a121b5953c9e4a233c1589bd7778
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:51:42 +00:00
Treehugger Robot
8e0f2903ef Merge "Remove pre singletons" into main am: 228915b2f1 am: 90d740b3cb
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: I4d6dbc985e92690c5be7bdac26983ff06b17d0f9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:48:14 +00:00
Colin Cross
35d8fb38df Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef am: 94bbe04b4c am: db692d156a
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I8f484d9f2e6353322dd2e7388e3c5ae7c01f5505
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:23:17 +00:00
Colin Cross
cc48d2f2dc Use strings instead of simpleNinjaStrings where possible am: 95bec3331c am: 539f19d1a8 am: bc70193eac
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: Ia640a57f3d03f88c844056f0452a34bb8dc381bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:23:08 +00:00
Colin Cross
b83a34f3b7 Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef am: d6b9e69e76 am: 2a50415af1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I84bd55d123781e6df706fadcad48db9e367995ac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:22:47 +00:00
Treehugger Robot
521b42e95d Merge "Remove pre singletons" into main am: 228915b2f1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: Ia68b630f4235af4f328c8c99455c93c623a696cb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:22:30 +00:00
Colin Cross
3f758a7072 Use strings instead of simpleNinjaStrings where possible am: 95bec3331c am: d63498db06 am: fcbf4c6598
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: Ieb0d91cbc76f447f10e307284a53c502578229ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:21:56 +00:00
Treehugger Robot
90d740b3cb Merge "Remove pre singletons" into main am: 228915b2f1
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2814612

Change-Id: I94b057984594b70f513cb314c21924c9a2be0748
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:20:14 +00:00
Colin Cross
db692d156a Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef am: 94bbe04b4c
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I13941f33011d9cdf16b56fb95874d95c7a585aa8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:17:19 +00:00
Colin Cross
bc70193eac Use strings instead of simpleNinjaStrings where possible am: 95bec3331c am: 539f19d1a8
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: I08f337bb8c609e787acacf3fc60da880e2691082
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 18:16:23 +00:00
Treehugger Robot
228915b2f1 Merge "Remove pre singletons" into main 2023-11-02 18:04:52 +00:00
Colin Cross
94bbe04b4c Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I7645618790ff32fe76ff066b7a4173996ebf0ec3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 17:49:09 +00:00
Colin Cross
539f19d1a8 Use strings instead of simpleNinjaStrings where possible am: 95bec3331c
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: I729a500def4b5f8cfe51e8a2461df90a9ea90c80
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 17:48:13 +00:00
Colin Cross
2a50415af1 Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef am: d6b9e69e76
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I21300a6179ecaaaaa7fe20cf9c9eabfcc4be776b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 17:45:42 +00:00
Colin Cross
fcbf4c6598 Use strings instead of simpleNinjaStrings where possible am: 95bec3331c am: d63498db06
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: I22f68996fbe404210cd6aa686641c7e2800def35
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 17:42:53 +00:00
Colin Cross
d6b9e69e76 Optimize NinjaEscapeList to avoid allocating an output slice am: 42b2e906ef
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813841

Change-Id: I1e258e75e48649240fed6b4ff86870b8b5ef73fd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 16:49:03 +00:00
Colin Cross
d63498db06 Use strings instead of simpleNinjaStrings where possible am: 95bec3331c
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2813840

Change-Id: I9be363a22a1551f29d096b32e1ef0ff9a639b217
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 16:48:38 +00:00