Commit Graph

33 Commits

Author SHA1 Message Date
Patrick Rohr
04f194e075 gn2bp: remove unused toolchain property
This has been replaced by target.arch.

Test: //components/cronet/android:cronet
Change-Id: If0193d549fbe50ab9b5197e186e41ffff3ca6e09
2022-11-15 22:50:22 -08:00
Patrick Rohr
c8f41cd4eb gn2bp: fix host and device support properties
With proper arch support, we now have all the information to do this
properly.

Test: //components/cronet/android:cronet
Change-Id: Iab86261a6a4d775ba5f3b12b2487b7c27096580d
2022-11-15 22:49:29 -08:00
Patrick Rohr
4eff210a9f gn2bp: use proper target annotation
Test: //components/cronet/android:cronet
Change-Id: I72bbbec7d49c82d1581769a4968764dd3234ceda
2022-11-15 22:21:52 -08:00
Patrick Rohr
d938d53f01 gn2bp: toolchain propery is always present
No need to default to anything.

Test: //components/cronet/android:cronet
Change-Id: I93ea5173c4d9059c4c824347a380542eeda97292
2022-11-15 22:17:08 -08:00
Patrick Rohr
53dcd10ef0 gn2bp: collect sources for each architecture
Test: //components/cronet/android:cronet
Change-Id: I980677f326e82b2f164908611b95db3350d040a1
2022-11-15 21:58:24 -08:00
Patrick Rohr
70913563ee gn2bp: add code that collects common sources
Once sources will be added to a Target.Arch, common sources need to be
collected from the arch-dependent object. This is done via finalize()
method, which is called once on every Target. Finalize collects the
intersection of all sources and subtracts it from the arch dependent
sources.

Test: //components/cronet/android:cronet
Change-Id: If2d0d04ff6c8df0efb541a322bcf2febcf79bb55
2022-11-15 21:49:28 -08:00
Patrick Rohr
81a4ac30db gn2bp: get arch from toolchain
Default all non-android toolchains to the host toolchain. Some limited
host support may be required. Let's see.

Test: //components/cronet/android:cronet
Change-Id: I3bc7a0d5da0c9558bda83583a0a7f90b1a5a2597
2022-11-15 14:43:21 -08:00
Patrick Rohr
7f4631e236 gn2bp: remove toolchain label from dependencies
This probably won't have any effect, but just in case.

Test: //components/cronet/android:cronet
Change-Id: I1e956ab5add346764f4f479d7ef7da85e3f560c4
2022-11-15 14:35:03 -08:00
Patrick Rohr
02ad51f54a gn2bp: add arch to Target
arch set will consist of Arch object that contain arch-dependent
properties (sources, flags, etc.).

Test: //components/cronet/android:cronet
Change-Id: Ic5b62063d3c5ea07435c676eb11923defdf4e577
2022-11-15 14:33:36 -08:00
Patrick Rohr
7705bdb443 gn2bp: use name without toolchain for Targets
This change does affect the Android.bp.swp for targets that currently
exist in multiple toolchain variations. Only the first one is parsed.

Test: //components/cronet/android:cronet
Change-Id: I77501b1b195a91a61e29566d540ecc7dfadeea75
2022-11-15 13:26:30 -08:00
Patrick Rohr
770cf68919 gn2bp: remove unused third_party deps handling
This was not useful for the cronet build, as we have not remapped
third_party deps into //gn (unlike perfetto).

We probably do want something similar for builtin_deps (like pass
builtin_deps into the GnParser constructor) to prevent static_library
dependencies to circumvent replaced dependencies via builtin_deps.

Test: //components/cronet/android:cronet
Change-Id: I77ed99eb14618a478281b9be025cf9d384066ddb
2022-11-15 13:18:20 -08:00
Patrick Rohr
0d40da3955 gn2bp: pass gn_target_name into get_proto_target_type
This is to get ready for removing the toolchain from Target names.

Test: //components/cronet/android:cronet
Change-Id: I0d7d6ae286c2e5c493e7bb565a4943be6f4c5b98
2022-11-15 13:08:12 -08:00
Patrick Rohr
564d6be8db gn2bp: pass gn_desc to parse_gn_desc
Eventually, this will lead to support for passing in different gn desc
files.

Test: //components/cronet/android:cronet
Change-Id: I6e1f7ee51f9819969b0bef8da7a1a21abbccabc8
2022-11-15 12:57:57 -08:00
Patrick Rohr
d0077b7e5e gn2bp: separate parsing gn desc from retrieving Target object
To support parsing multiple gn desc files for different architectures,
the process of parsing and retrieving Targets needs to be split in two.

Test: //components/cronet/android:cronet
Change-Id: Ib94cbc18b9b73b17942a71289ef86f69d4e36c5f
2022-11-15 12:54:29 -08:00
Patrick Rohr
a9c1dda118 gn2bp: fix collecting static libs dependencies
There were some flaws in the previous logic. Dependencies need to be
bubbled up for all targets, but only static_libs should be added to
them.

Test: update_results.sh
Change-Id: I98025a8a0720d34bc47a820bf45118c06acd64a0
2022-11-14 19:02:40 -08:00
Patrick Rohr
5de9f2e266 gn2bp: propagate static libs up the tree
Soong explicitly requires to list all static libraries, including static
libraries that are linked by a dependency.

What is interesting is that this change seemed to have introduced new
targets?! Will have to check if that's correct, but at first glance it
seems to make sense.

Test: //components/cronet/android:cronet
Change-Id: I0e6e9a760dd0a4ebc5ce50f5dabc02458ff488a8
2022-11-11 15:36:39 -08:00
Patrick Rohr
67f5312922 gn2bp: move target.type check into _is_java_target
Cleanup -- makes the code more readable.

Test: //components/cronet/android:cronet
Change-Id: I4bb68137ac21f6204143c4fb9c74e57e9db8c5d7
2022-11-09 10:57:40 -08:00
Motomu Utsumi
d7e0e42941 gn2bp: Update --proto_path and --cpp_out arg
--proto_path specify the directory in which to search for imports.
net_quic_proto and metrics_proto have files that import other files.
Get proper --proto_path from the args in the desc.
Also, update --cpp_out to follow --proto_path change.

There are 6 targets which use protoc_wrapper.py in the dependency
from cronet_package_android.
It is confirmed that they could build with this commit.

Test: m cronet_aml_net_isolation_info_proto_gen
      (//net:isolation_info_proto)
Test: m cronet_aml_net_net_nqe_proto_gen
      (//net:net_nqe_proto)
Test: m cronet_aml_net_third_party_quiche_net_quic_test_tools_proto_gen
      (//net/third_party/quiche:net_quic_test_tools_proto)
Test: m cronet_aml_net_cert_root_store_proto_full_gen
      (//net/cert:root_store_proto_full)
Test: m cronet_aml_net_third_party_quiche_net_quic_proto_gen
      (//net/third_party/quiche:net_quic_proto)
Test: m cronet_aml_third_party_metrics_proto_metrics_proto_gen
      (//third_party/metrics_proto:metrics_proto)
Change-Id: Id19e956eb0eb3fb402f8aaa9eb94734b731c74fd
2022-11-08 19:58:49 +09:00
Patrick Rohr
c5980783c6 gn2bp: fix proto parsing
GnUtils and gen_android_bp already have support for proto targets.
It looks pretty generic and quite a bit more evolved than what we have
done so far.

Test: //net:net
Change-Id: I1ca0d004650b4dc5e09fae4a0f4159699b4de96b
2022-11-07 19:10:53 -08:00
Patrick Rohr
b27587ec54 gn2bp: collect java sources
The current plan is to write a lightweight wrapper around Cronet that
serves as the Android API surface. If that holds true, we might get away
with putting all .java sources in a single jar. Otherwise, the API will
have to be put in a separate source jar.

Test: //net:net
Change-Id: I2bef893ebdf0a4390dfb634e715c60ccd94dc1fb
2022-11-04 14:57:24 -07:00
Patrick Rohr
3624f95078 gn2bp: be explicit about dropping java_group dependencies
This is a no-op that makes the code more readable.

Test: //net:net
Change-Id: I8c026cd2f7cd3d676223d4c05a49376140791e21
2022-11-04 14:30:18 -07:00
Patrick Rohr
af92fa6088 gn2bp: mark java targets as java_group
According to the docs, java target names are (somewhat) guaranteed to end in
_java. There are some other variations that are allowlisted, though it
is currently unclear if those need to be supported for our purposes.

Test: //net:net
Change-Id: I0647dac6a078790e23509d437628aed0d8d62f77
2022-11-04 14:29:48 -07:00
Motomu Utsumi
b42a71c549 gn2bp: Removed meaningless lines
Test: ./update_result.sh
Change-Id: I12a07ba3593929a1d7666a3230b62bb8a5aeff53
2022-10-31 16:51:15 +09:00
Patrick Rohr
c20887d2db gn2bp: fix response_file_contents parsing
Test: //base:base
Change-Id: I6a90f684d31a83323580001822b0cc3745497baa
2022-10-28 13:04:11 -07:00
Patrick Rohr
7aa98f9cdb gn2bp: gn_utils should not touch action args
gn_utils does not have enough information to fix the args, so it should
not touch them.

Test: //base:base
Change-Id: Id813a255fcf3694448eae2bb51637b10fc8a0297
2022-10-28 11:18:04 -07:00
Patrick Rohr
09716f5c7e gn2bp: store response_file_contents for action targets
These will be piped into a script, so it is important that both single
and double quotes are properly escaped.

Test: //base:base
Change-Id: I0123e09a698418f222f51b0326608d4e97374928
2022-10-27 14:45:54 -07:00
Patrick Rohr
da778a00ca gn2bp: add basic parser support for copy and action_foreach rules
*Very* basic GnParser support for copy and action_foreach targets.
Copy rules are not very common, for cronet package only two are invoked:

- //components/cronet/android:cronet_package_copy_native_lib
- //third_party/icu:icudata

(I am using a heavily pruned version of cronet_package, it is possible
that the upstreamed version includes more such rules).

Test: parse //components/cronet:cronet_package
Change-Id: I47cd077b7f6261085d8006596df165f27a83a1d8
2022-10-26 11:53:44 -07:00
Patrick Rohr
26af1e76b2 gn2bp: allow targets to depend on chromium's libc++ and libunwind
We need to determine if this should be replaced by Android's version of
those libraries.

This can be done via "stl" property on dependent targets (we would
additionally have to configure the version).

Test: n/a
Change-Id: Ibd54cc0b58086ec77d5eee40708f28b237d70c3f
2022-10-26 11:52:44 -07:00
Motomu Utsumi
b26c337590 gn2bp: Remove unuded code
Test: ./gen_android_bp --desc gn.json --output Android.bp \
'//third_party/zlib:zlib'

Change-Id: Icd3891c605e6b519b4eb7ca9a14563c825c5750d
2022-10-26 19:59:02 +09:00
Motomu Utsumi
73e0322897 gn2bp: Remove unused ODRChecker
Test: ./gen_android_bp --desc gn.json --output Android.bp \
'//third_party/zlib:zlib'

Change-Id: I3f27e552e4134a22e32cf64822bab08958340bbd
2022-10-26 19:57:40 +09:00
Patrick Rohr
c6331c81e7 gn2bp: support '//' in label_to_path
Test: ./gen_android_bp --desc gn.json --output Android.bp \
'//third_party/zlib:zlib'

Change-Id: I65eb857440cb67a7774c120f619cbec86c10d73d
2022-10-25 11:36:57 -07:00
Patrick Rohr
23f2619342 gn2bp: delete compat.py
gn2bp does not need to support python2.

Test: none
Change-Id: I00223ec3e53bf629342380eadf5f867c333863f6
2022-10-25 09:45:22 -07:00
Patrick Rohr
92d7412616 gn2bp: add copy of perfetto project gn to bp tooling
This will serve as a starting point to generate Android.bp files for
cronet.

Test: n/a
Change-Id: Ia5ccad48f705fd48cff212dbedbfb61b6e385468
2022-10-25 15:52:22 +00:00