Commit graph

158 commits

Author SHA1 Message Date
Jingwen Chen
467f8b6c46 Merge "queryview: prefix internal attribute names." 2021-01-25 22:18:32 +00:00
Jingwen Chen
288e2babde queryview: prefix internal attribute names.
There's a module type in internal main that uses the module_deps
property, which clashes with QueryView's module_deps attribute. A fix is
to prefix the attribute as soong_module_deps to avoid the conflict.

While we're at this, rename the other internal attribute names to be
consistent as well.

Test: soong tests

Test: m queryview && bazel query //... --config=queryview

Fixes: 178351366
Change-Id: I84961c8f58c0c0fac1a1c2cbc6bc625499ac895e
2021-01-25 04:46:07 -05:00
Jingwen Chen
4e4756d720 bp2build: rename variables for readability.
Test: go test
Change-Id: I103bbed32844bf7d24c63e7d908630294f7ab20a
2021-01-24 21:13:56 -05:00
Jingwen Chen
316e07c593 bp2build: automatically convert all genrules.
Results of `cquery //bionic/...`: https://paste.googleplex.com/5608885982330880?raw

Note that this CL does not contain the global module name mapping to
fully qualified label lookup mechanism, so while the BUILD targets are
queryable, they are not buildable (yet).

Test: GENERATE_BAZEL_FILES=true m nothing && ./build/bazel/scripts/bp2build-sync.sh write && bazel cquery //bionic/...

Change-Id: I6f2316222723d8b612d9b041ca82a188cd05bac9
2021-01-24 20:51:18 -05:00
Jingwen Chen
32b4ece0c3 bp2build: automatically convert all filegroups.
See build_conversion_test.go for expected outputs.

Test: build_conversion_test.go
Test: GENERATE_BAZEL_FILES=true m nothing &&
./build/bazel/scripts/bp2build-sync.sh write && bazel build
//bionic/libc/tools/...
Test: bazel query //... --config=queryview

Change-Id: I3c54b96c0812f1ea4ab2c95da1bff3d7c5cc4006
2021-01-23 02:26:20 -05:00
Jingwen Chen
7385067640 bp2build: framework for generating BazelTargetModules.
This CL creates the framework necessary for generating
BazelTargetModules from regular Soong Android modules.
BazelTargetModules are code-generated into Bazel targets in BUILD files.

See the follow-up CL for examples of creating filegroup/genrule
BazelTargetModules.

Test: GENERATE_BAZEL_FILES=true m nothing # creates out/soong/bp2build
with no BUILD files, because there are no BazelTargetModules in the
module graph.

Change-Id: I33a96365bd439043b13af6db9e439592e9983188
2021-01-21 22:46:11 -05:00
Jingwen Chen
daa54bcbba Implement code-generation step for bp2build.
Implement bp2build codegen as a discrete step that runs after an
alternatively registered pipeline of mutators, instead of a
presingleton.

bp2build codegen requires a Context that supports VisitAllModules and
PathContext, so this CL also makes a BpToBuildWrapperContext that
conforms to PathContext by adding two method implementations.

Test: GENERATE_BAZEL_FILES=true m nothing && bazel query //... --config=bp2build | wc -l # 31433
Test: m queryview && bazel query //... --config=queryview # 63638

Change-Id: I0dd359746584b228046d2d0ff00895f28f9bdfc3
2021-01-19 11:03:36 -05:00
Liz Kammer
2dd9ca422d Refactor queryview.
Splits queryview into queryview and bp2build. The latter runs as a
presingleton (could be converted to a singleton). This prevents needing
to run soong_ui a subsequent time to build the query. Queryview remains
as a separate step to prevent increasing runtime due to this generation
every time Soong runs.

Currently this is running as a presingleton as this gives a translation
of Android.bp files after only LoadHooks have run, no mutators.

Test: go tests
Test: m queryview && bazel query --config=queryview //...
Change-Id: If2ba28c7ef60fbd41f43bda6623d41c8c7d23a1b
2021-01-07 14:34:00 -05:00