Commit graph

2108 commits

Author SHA1 Message Date
Christopher Parsons
df4ad24151 Merge "Support pre-build-action hook in blueprint" 2022-05-20 14:13:49 +00:00
Bob Badour
67a6d702d1 Allow deferred module build action generation.
Provide a means to generate build actions for modules from within the
later singleton context. Allows modules to depend on the metadata for
arbitrary modules without causing dependency cycles.

Care needs to be taken to establish all metadata during the normal
module GenerateBuildAction to avoid synchronization issues and only
use read-only access to modules from the singleton context.

Bug: 213388645

Change-Id: I82ed218926b1d8fbe2edde6d55c4bf40ea0d8618
2022-05-18 17:59:16 -07:00
Chris Parsons
91f638f692 Support pre-build-action hook in blueprint
This allows for a bazel-invocation hook in mixed builds, which allows
for mixed builds to take place in only a single pass, greatly improving
its performance and complexity.

Test: Conjunction with build/soong CL
Change-Id: If89fb56830b4eb06d3263d6ca6da7b285e7ba315
2022-05-10 13:46:40 -04:00
Treehugger Robot
cdbab1ea51 Merge "Add a filelock for in-place case" 2022-05-10 04:06:52 +00:00
Jeongik Cha
28c7996f2c Add a filelock for in-place case
Multiple bpmodify process on the same Android.bp can run in parallel in
the case of aidl-freeze-api.

So, add a file lock for in-place editing case(-w)

Bug: 229413853
Test: run bpmodify in parallel and check result
Change-Id: I5368b0304b59f34fff60025120b38cc5f615ac40
2022-05-10 01:30:08 +00:00
Liz Kammer
c6d80893cb Rename jsonVariationMap to jsonVariations.
Test: m json-module-graph
Change-Id: I99663586ded4c5d7c0f61859292afbcf80a1e526
2022-05-03 12:33:02 +00:00
Treehugger Robot
5208ee885c Merge "Update CreateModule to require a type name" 2022-04-27 16:00:35 +00:00
Liz Kammer
9967d62fad Update CreateModule to require a type name
This makes the LoadHook and TopDownMutatorContext interfaces for
CreateModule the same.

Test: CI
Change-Id: I30122099bdf109cda40f9d81a574dd6fa861f459
2022-04-26 09:15:13 -04:00
Lukacs T. Berki
83a5a308b1 Remove the concept of "early mutator".
It was unused and as such, maintenance cost for no benefit.

Test: Presubmits.
Change-Id: Ifc35c0f55647ef88ed0bfa44bcf709e51a904ea4
2022-04-19 18:12:03 +02:00
Liz Kammer
8097d1a0e6 Change jsonVariationMap to array of struct
This more structured data is easier to query

Test: m json-module-graph & look at the graph
Change-Id: I44ba6a8df12208705f37ee6908ad5391a6f404a1
2022-04-08 13:14:13 -04:00
Treehugger Robot
0d2386c60a Merge "Add event handling to blueprint for metrics" 2022-03-26 00:21:21 +00:00
Chris Parsons
18ebb2318a Add event handling to blueprint for metrics
In conjunction with soong/build changes, this materialized runtime
metrics for various soong_build events.

Test: Manually verified materialized protos for bp2build, mixed builds,
and legacy build.

Change-Id: Ia92403605e3063028dbf6a1ded8449c190b9e63e
2022-03-25 13:15:17 -04:00
Treehugger Robot
310b0cec5d Merge "force LoadHookContext to specify module type" 2022-03-10 23:37:08 +00:00
Sam Delmerico
518966d09e force LoadHookContext to specify module type
Modules created by a LoadHookContext do not currently set a module type
when creating new modules, but it would make analysis of the
module-graph.json much easier if this module type information was available.

Bug: 174879786
Test: m json-module-graph && check that module which previously had a
    blank module type now have the field populated
Change-Id: Ie2fa4244113b6254e6678da9a663d883e2a48a41
2022-03-09 20:50:48 +00:00
jiajia tang
eb27645af9 Fix duplicate typo
Comments typo fix

Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
Change-Id: I89bf5aa5a3a57cda4b1e74195894341f9089e11c
2022-03-08 19:50:09 +08:00
Jeongik Cha
7f6948364f bpmodify: remove-property am: 5860caea33
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1977929

Change-Id: Id817d44f9aa68665e310eb7dc61985e1065bb9e6
2022-02-14 04:06:49 +00:00
Xin Li
17c110c581 Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: Ie32bc2a0d075b1b7cc9fe1247d1f02dc1af67449
Change-Id: I067e17c8207a4d9072bc259496759f954ffd693d
2022-02-11 06:10:32 +00:00
Jeongik Cha
5860caea33 bpmodify: remove-property
`r` option removes only item(s) in a list, so add `remove-property`
option to remove a property itself.

Bug: 146436251
Test: unittest
Change-Id: I0c838d31e72358f094cfb5fa9468dce07018e061
2022-02-11 05:54:33 +00:00
Jooyung Han
34f9c28f0f bpmodify: -add-literal to add a value to the list am: 451dd63611
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1977927

Change-Id: Idcb5633d38c7367e1b8a3bc4cfddebda43f0520a
2022-02-11 00:13:09 +00:00
Jooyung Han
d5be0c1c66 Add newlines around list of structs am: 0cb1064428
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1977926

Change-Id: I293133c1e09aa79807b3554c9a334e900830a985
2022-02-11 00:13:08 +00:00
Jooyung Han
451dd63611 bpmodify: -add-literal to add a value to the list
-a works with only string values. When we need to add numbers, booleans,
or even structs, -add-literal can be used now.

  bpmodify -m foo -property list-of-ints -add-literal 123
  bpmodify -m foo -property list-of-structs \
    -add-literal "{key: \"value\"}"

Bug: 146436251
Test: go test ./bpmodify
Change-Id: I91d23d7bf89491643aa595f5ebccd9410a9cbb09
2022-02-09 11:16:02 +09:00
Jooyung Han
0cb1064428 Add newlines around list of structs
Since a struct(parser.Map) occupies multiple lines, adding newlines
around brackets([]) looks better even the list has only a single value.

  prop: [ {
    name: "foo",
  }],

vs

  prop: [
    {
      name: "foo",
    },
  ],

Bug: n/a
Test: go test ./parser
Change-Id: I1a574aa038a26235848b6c9b5b4f01a0ab2c8c00
2022-02-09 11:10:12 +09:00
Liz Kammer
f3a1b1a85a Add a limit to blueprint filesystem accesses am: 2df87f3cd9
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1975786

Change-Id: Iac0f5009454c8f19f8a94bac501d041793ab8d46
2022-02-08 22:47:59 +00:00
Liz Kammer
2df87f3cd9 Add a limit to blueprint filesystem accesses
Mac builds keep running into too many files open. Restrict access of
filesystem to the current limit.

Test: m nothing
Change-Id: I2365da7c641f7c7f5d948396c6862eb3a0d1d8b9
2022-02-08 15:16:59 -05:00
Treehugger Robot
bbd604b48a Merge "Rename saneSplit --> quickSplit" am: fc56ef6e20
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1974127

Change-Id: I87bacf9d3a7b92ada403a166d3b7e0c914555f92
2022-02-07 21:49:43 +00:00
Treehugger Robot
fc56ef6e20 Merge "Rename saneSplit --> quickSplit" 2022-02-07 21:25:07 +00:00
Liz Kammer
1766f42947 Close file after reading am: 6e7e6a92c7
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1972903

Change-Id: I4b7b5e4d4fa5c36ced93d328b254856a3a6896f9
2022-02-07 19:02:40 +00:00
Liz Kammer
6e7e6a92c7 Close file after reading
Test: m nothing
Change-Id: Ib2daa2081d47c52bd3994520d522c5df95973e4a
2022-02-07 10:04:51 -05:00
Liz Kammer
8b162be674 Rename saneSplit --> quickSplit
This better describes its goal and is more inclusive.

Test: go test blueprint pathtools tests
Change-Id: Ia382f1fe65d0b551dc5d92d40ddf3cb356f3204d
2022-02-07 09:41:01 -05:00
Usta Shrestha
545da71ca8 gitignore intelliJ files am: 1b438d6b7e
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1968839

Change-Id: I6fb5fda0ba7e01c049da9b430791db20a4dc9663
2022-02-02 19:55:56 +00:00
Usta Shrestha
1b438d6b7e gitignore intelliJ files
Bug: N/A
Test: N/A
Change-Id: Iff9eabb3915bff566ee62deb339f0cbe89b5c6ef
2022-02-02 11:36:11 -05:00
kgui
6fb018a456 Support writing inputs/outputs of actions of modules into a file from the moduleInfo.actionDefs. am: a78b020089
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1959132

Change-Id: I1fd8c94610b3cf1cd669a5f29d3ef8d277426417
2022-01-28 15:07:45 +00:00
kgui
a78b020089 Support writing inputs/outputs of actions of modules into a file from the moduleInfo.actionDefs.
An example module variant in the module-actions.json:
{
	"Name": "metalava-gradle-plugin-deps",
	"Variations": null,
	"DependencyVariations": null,
	"Deps": [
		{
			"Name": "prebuilts_gradle-plugin_license",
			"Variations": null,
			"DependencyVariations": null,
			"Tag": ""
		}
	],
	"Type": "",
	"Blueprint": "prebuilts/gradle-plugin/Android.bp",
	"Module": {
		"Actions": [
			{
				"Inputs": [
					"prebuilts/gradle-plugin/com/android/tools/lint/lint-api/30.1.0-alpha13/lint-api-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/lint/lint-checks/30.1.0-alpha13/lint-checks-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/lint/lint/30.1.0-alpha13/lint-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/lint/lint-gradle/30.1.0-alpha13/lint-gradle-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/lint/lint-model/30.1.0-alpha13/lint-model-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/common/30.1.0-alpha13/common-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/sdk-common/30.1.0-alpha13/sdk-common-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/sdklib/30.1.0-alpha13/sdklib-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/external/org-jetbrains/uast/30.1.0-alpha13/uast-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/external/com-intellij/intellij-core/30.1.0-alpha13/intellij-core-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/external/com-intellij/kotlin-compiler/30.1.0-alpha13/kotlin-compiler-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/repository/30.1.0-alpha13/repository-30.1.0-alpha13.jar",
					"prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/30.1.0-alpha13/manifest-merger-30.1.0-alpha13.jar"
				],
				"Outputs": [
					"out/soong/.intermediates/prebuilts/gradle-plugin/metalava-gradle-plugin-deps/linux_glibc_common/combined/metalava-gradle-plugin-deps.jar"
				]
			},
			{
				"Inputs": null,
				"Outputs": [
					"out/soong/.intermediates/prebuilts/gradle-plugin/metalava-gradle-plugin-deps/linux_glibc_common/meta_lic"
				]
			}
		]
	}
}

Test: local
Change-Id: Icbb7236507251e257f6773b110ae8a0788eef41e
2022-01-28 14:50:24 +08:00
Treehugger Robot
43eaa934b8 Merge "Add support for maps in blueprint files." am: 00895de89a
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1718095

Change-Id: I56d4b5f7584de110682acaf275eb7a71d243e548
2022-01-27 22:22:44 +00:00
Treehugger Robot
00895de89a Merge "Add support for maps in blueprint files." 2022-01-27 21:36:45 +00:00
Liz Kammer
42cb28f66e Add support for maps in blueprint files.
This limits support to allow-listed property names to prevent
proliferation of map types requiring additional support to migrate.

Test: go test blueprint tests
Test: m nothing && diff build.ninja & Android-aosp_arm.mk -- no changes
Change-Id: Id12637462f19ac5de1b562f63507de989a51600d
2022-01-26 12:18:31 -05:00
Usta Shrestha
2f2ec92037 Blueprint to support multiline (Go style raw) strings am: 53bc344a81
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1953722

Change-Id: Ic18586a2d5e82328d844ea443ccb5521d30132a3
2022-01-20 21:08:00 +00:00
Usta Shrestha
53bc344a81 Blueprint to support multiline (Go style raw) strings
Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: I9a7ffafe6a3992bf05180a032f4b277cbecb7dc6
2022-01-19 22:58:01 +00:00
Usta Shrestha
2cacef74be use iota for "enum" am: 62823dcf01
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1953567

Change-Id: Ibef4900bcc72a4a19b9b0d44fca4af851d3caafa
2022-01-19 01:13:36 +00:00
Usta Shrestha
25c221eb36 Typos and missing parameter names use in doc comment am: ee7a5d7a16
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1953566

Change-Id: I9758390452c035df9ceebbf75ec2cf254a68d278
2022-01-18 23:34:35 +00:00
Usta Shrestha
62823dcf01 use iota for "enum"
Test: m nothing
Bug: N/A
Change-Id: I9d59796cbf1dc3dc8e1e9fc536b50c1dea3a5f61
2022-01-18 16:51:12 -05:00
Usta Shrestha
ee7a5d7a16 Typos and missing parameter names use in doc comment
Test: N/A
Bug: N/A
Change-Id: I01331365925decef22502da02a23ed4ce610da98
2022-01-18 16:46:30 -05:00
Liz Kammer
f6962bb758 Merge "Add proptools helper functions." am: c643dd96cd am: 50484248d4 am: 974ef396f3
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1944344

Change-Id: I118befba9a73b1feac1f5c592120c8c981b8a41e
2022-01-12 14:05:44 +00:00
Liz Kammer
974ef396f3 Merge "Add proptools helper functions." am: c643dd96cd am: 50484248d4
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1944344

Change-Id: I5d36cf706813440ef9f6ed99c04ee505f93fa328
2022-01-12 13:54:30 +00:00
Liz Kammer
50484248d4 Merge "Add proptools helper functions." am: c643dd96cd
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1944344

Change-Id: I4a2c91445378bef8d85df99330c9dba963258275
2022-01-12 13:42:27 +00:00
Liz Kammer
c643dd96cd Merge "Add proptools helper functions." 2022-01-12 13:23:33 +00:00
Liz Kammer
5319d07308 Add proptools helper functions.
Test: existing blueprint tests
Change-Id: Ie32bc2a0d075b1b7cc9fe1247d1f02dc1af67449
2022-01-11 10:21:05 -05:00
kgui
1ef2a6ecfe Add JSON data related struct and function into context. am: 20f19a5d9b am: d7fda94073 am: 5d6e46e687
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1942213

Change-Id: I41c304f46ce6be200bcdb69bf7a696f1978c057b
2022-01-11 04:37:36 +00:00
kgui
5d6e46e687 Add JSON data related struct and function into context. am: 20f19a5d9b am: d7fda94073
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1942213

Change-Id: Ic84d2c4c1c6c40aba8d1342f36694e9063c88bec
2022-01-11 04:14:23 +00:00
kgui
d7fda94073 Add JSON data related struct and function into context. am: 20f19a5d9b
Original change: https://android-review.googlesource.com/c/platform/build/blueprint/+/1942213

Change-Id: I823dfb5bb38234512ed96831dfaf1e7fff91e4e8
2022-01-11 03:43:05 +00:00