Commit graph

2986 commits

Author SHA1 Message Date
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
Cole Faust
41cbc49a25 Remove pre singletons
They're no longer used.

Test: m nothing --no-skip-soong-tests
Change-Id: I6481381a2ac6bca4211c88173dd4275261123e86
2023-11-01 15:26:17 -07:00
Colin Cross
42b2e906ef Optimize NinjaEscapeList to avoid allocating an output slice
NinjaEscapeList is called on every input or output of a rule, and
most of the time does not escape anything.  Optimize it by returning
the input slice when nothing was escaped.  This avoids 1.336 GB of
allocations in my AOSP aosp_cf_x86_64_phone-userdebug build.

Test: TestNinjaEscapeList
Change-Id: I33b9e7b77b33d10401d1ec3546caa6794c567b16
2023-11-01 15:15:16 -07:00
Colin Cross
95bec3331c Use strings instead of simpleNinjaStrings where possible
Storing every string without ninja variable references through
simpleNinjaString costs 24 bytes and a heap allocation.  16 bytes
is used for the ninjaString.str string, 8 bytes for the
ninjaString.variables *[]variableReference.  An additional 8 bytes
is used for the resulting pointer into the heap.

The vast majority of calls to simpleNinjaString originate in
blueprint.parseBuildParams, which converts all of the parameters
passed to ctx.Build into ninjaStrings.  All together this was
allocating 1.575 GB of *ninjaString objects.

Add a parseNinjaOrSimpleStrings function that converts input strings
into ninjaStrings if they have ninja variable references, but also
returns a slice of plain strings for input strings without any ninja
variable references.  That still results in 1.39 GB of allocations just
for the output string slice, so also add an optimization that reuses
the input string slice as the output slice if all of the strings had
no variable references.

Plumb the resulting strings through everywhere that the []*ninjaStrings
were used.

This reduces the total memory allocations inside
blueprint.parseBuildParams in my AOSP aosp_cf_x86_64_phone-userdebug
build from 3.337 GB to 1.786 GB.

Test: ninja_strings_test.go
Change-Id: I51bc138a2a6b1cc7383c7df0a483ccb067ffa02b
2023-11-01 15:15:15 -07:00
Colin Cross
db5957eac4 Remove unnecessary locking in fs am: 098c09334f am: 7cc3f1cf7f am: 73b332c5bf
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: Iee511ef1158ea052ba326615159c7d5a02e3921b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 19:49:53 +00:00
Colin Cross
b4b6f100ef Remove unnecessary locking in fs am: 098c09334f am: f55930a589 am: a26f03dbfe
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: Ie74a53b24bf3618470bd98e8138524342c5f129c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 19:48:57 +00:00
Colin Cross
73b332c5bf Remove unnecessary locking in fs am: 098c09334f am: 7cc3f1cf7f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: Iec109b7142640cbda9ac82969a7ddf839a01838e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 19:11:09 +00:00
Colin Cross
a26f03dbfe Remove unnecessary locking in fs am: 098c09334f am: f55930a589
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: I6887c52049648455079a59fac70a413c6289ad93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 19:08:40 +00:00
Colin Cross
7cc3f1cf7f Remove unnecessary locking in fs am: 098c09334f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: I4a6552dcbfae58f59d6eabd8de33d38c1af72bec
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 18:23:51 +00:00
Colin Cross
f55930a589 Remove unnecessary locking in fs am: 098c09334f
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2806056

Change-Id: I6703d363e4127f7fde773bf77793f7b531c4d731
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 18:21:45 +00:00
Colin Cross
098c09334f Remove unnecessary locking in fs
osFs.acquire and osFs.release are surprisingly expensive, using a
combined 345.7s of runtime in an AOSP aosp_cf_x86_64_phone-userdebug
build.  They are used to ensure we don't use too many simultaneous
open files, but many of the functions they are called from don't
actually open a file.  Remove them from all the stat-based functions
(Exists, IsDir, IsSymlink, Lstat, Stat), and from ReadLink.  After
this change the time spent in acquire and release is effectively
zero.

Test: SOONG_PROFILE_CPU=/tmp/cpu.pprof m nothing
Change-Id: Ie5e22e33c61794354821f05ab79ceb4efc3b276c
2023-10-31 20:24:35 +00:00
Colin Cross
d93518de07 Always generate rules for blueprint tests am: 0065131f50 am: 3d0b9f3337 am: a01937a3fd
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2802154

Change-Id: I8e8e899715af9fc4230dae34a269acf3f9582ceb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 23:32:13 +00:00
Colin Cross
48b5cc4fd6 Always generate rules for blueprint tests am: 0065131f50 am: 6cfb101d57 am: 44ace8cd76
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2802154

Change-Id: Idc694e49a07132ec9722f68f9b7cd07267c06540
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 23:31:52 +00:00
Colin Cross
a01937a3fd Always generate rules for blueprint tests am: 0065131f50 am: 3d0b9f3337
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2802154

Change-Id: I502a274833b8f1f8275b3550d53dfb07b376d301
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 23:02:09 +00:00
Colin Cross
44ace8cd76 Always generate rules for blueprint tests am: 0065131f50 am: 6cfb101d57
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2802154

Change-Id: Ib36ff445392e5c045901a3efac8efaf7a5ef03f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 23:00:10 +00:00
Colin Cross
3d0b9f3337 Always generate rules for blueprint tests am: 0065131f50
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/2802154

Change-Id: I2263cb65eb81eb0976326aad3c8724f34896b0e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-24 22:40:45 +00:00