15 Commits

Author SHA1 Message Date
Ryan Mitchell
055e6189f9 Allow protoc-gen-javastream to build statically
protoc-gen-javastream is failing to build for the static_sdk_tools
build target. This is because libprotoc is included as a shared
library in the protoc-gen-javastream target. Link libprotoc statically
to allow for the sdk tools to build.

Bug: 142536936
Test: m -j protoc-gen-javastream BUILD_HOST_static=1
Change-Id: I53e1263c774530f36ff16ab8dada3e0e715e63e0
2019-10-14 10:06:26 -07:00
Colin Cross
45c0d71e77 Convert frameworks/base/cmds/* to Android.bp
See build/soong/README.md for more information.

Also converts the rest of frameworks/base/tools/streaming_proto.

Bug: 122332340
Test: m checkbuild
Change-Id: I87c500c5464fb1722b4b518d89065f5e1ee29a97
Merged-In: Ieb54feb3902bddfd5a571369fbf50161ae646647
2019-03-29 16:35:06 -07:00
Chih-Hung Hsieh
93561ab3b9 Fix/suppress tools google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Remove redundant explicit of copy constructors

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: Ic11c22c59beb7aa32b878a23315b1036ca4e3c6a
2019-01-10 19:52:49 +00:00
Yi Jin
f68e747e05 Remove stream.proto and cpp-streaming-proto generates field name to id
mapping by default

Test: atest incident_helper_test
Change-Id: Iab04973ea78b942e44503fcd6ae60808caf3b9e0
2017-12-18 17:37:50 -08:00
Yi Jin
f77a07df1c Create a new stream option which generates field name to id mapping
recursively for all its submessages.

Also fix the wrong prefix for ro.build.version.XXX in proto.

It is safe to adjust proto number for now since it is not used yet.

Bug: 68774852
Test: atest incident_helper_test
Change-Id: I46e43a407da6efc393eb3c39733aaf25a5cceb13
2017-12-12 13:20:46 -08:00
Chih-Hung Hsieh
548fdbda19 Use -Werror in frameworks/base/tools/streaming_proto
* Remove unused constants.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I43940e8c446bab25b8fa841ec8c17885ab5d88ed
2017-12-05 10:18:23 -08:00
Yi Jin
0dfa752e67 Implement System Properties Section
Bug: 68774852
Test: unit tested and on device tests
Change-Id: I0d4aadf8d4203fe56e35bbfb77e5c532116fd27e
2017-11-14 10:54:24 -08:00
Yi Jin
e2f7f79d02 Implement Cpu Info Section
Support carriage return in Read class, and add a new way to parse lines
which is not able to split purly by delimiters

Bug: 65642861
Test: unit test and on device test
Change-Id: Ib82dd4e458bb7d2fa33462b23fbe11b828325916
2017-11-10 17:34:07 -08:00
Yi Jin
f9ed04b3d9 Remove the extra mapping of field types in ProtoOutputStream
It is very unlikely the protobuf changes the value in descriptor.h,
and if defines an extra mapping, there are several places to maintain:
1. java-stream,
2. cpp-stream,
3. ProtoOutputStream.java
4. ProtoOutputStream.cpp
5. Privacy.h (GetFieldId)
6. StatsLog to generate field id (type << 32 + field number)

Therefore use the current value in descriptor.h seems reasonable unless
they change that, very very unlikely, they probably will just add new
types, and deprect the existing ones like Group.

Test: test output of dumpsys proto
Change-Id: I6e150ab427851dd3b5dd55d3b273deeed7a0963c
2017-11-01 17:49:42 +00:00
Yi Jin
04625ad488 Refactor incident_helper to use protoutil and cppstream plugin.
1. Split the parsers to its own file to prevent all the parsers in one
gaint file.

2. Completely get rid of protobuf-cpp-full in incident_helper, use
ProtoOutputStream and cppstream instead, the incident_helper binary is
reduced from ~500K to ~113K.

3. Write data to protobuf even its values are zero/default, the reason
is for example we have a repeated int32 orders = 1; and people
explicitly append 0 so the total repeated field has 10 values, if zero
is not written to serialized data, this repeated field will only have 9
values which is not what we want at first place. This also aligns with
the default protobuf serialization behavior in incident_helper_test.

4. Use Android.bp for protoutil lib since it is not able to depend on
libs compiled by .mk file, it works the other way.

5. Add a new custom message option for streaming_proto, if specified,
the cppstream will create extra metadata to get field ids by field name.
A Table class is created in incident_helper to use it.

Bug: 67860303
Test: unit tested as well as on device test
Change-Id: I8e136fd15f343a4a623d20910ec64b622b478a3e
2017-10-31 16:54:38 -07:00
Yi Jin
0473f88b9f Create protoc-gen-cppstream tool to auto-generate cpp proto field Ids.
It is very similiar to protoc-gen-javastream, which generates field Ids used
by ProtoOutputStream.cpp to dump protobuf data.

Bug: 65641021
Test: compile the streaming_proto:
      $ mmm -j frameworks/base/tools/streaming_proto/
      and run:
      $ PATH=$PATH:out/host/linux-x86/bin/protoc-gen-cppstream aprotoc
      --cppstream_out=tmp/
      frameworks/base/core/proto/android/service/procstats.proto
      frameworks/base/core/proto/android/util/common.proto

Change-Id: I68becc80b5166455455c5df28cd698601b4a1c1d
2017-10-11 11:04:39 -07:00
Dan Willemsen
d3eac266b0 Convert host tools to Android.bp
See build/soong/README.md for more information.

Test: m libinstrumentation interrupter accessorychat accessorytest bit obbtool pbkdf2gen libsplit-select_tests split-select protoc-gen-javastream validatekeymaps libaapt_tests aapt
Test: mmma frameworks/base
Test: out/host/linux-x86/nativetest64/libaapt_tests/libaapt_tests
Test: out/host/linux-x86/nativetest64/libsplit-select_tests/libsplit-select_tests
Change-Id: I93cf24d4b232353a52d53be8ed85781b8f4a3877
2017-09-09 06:18:48 +00:00
Joe Onorato
b38ac0b15d Give protoc-gen-javastream the ability to output multiple java files.
If there are file-level enums, it still will generate what would have
otherwise been the outer class to hold them, since enums don't get
their own class in the streaming proto scheme.

Make the proto apis not @TestApi for now -- there's too much churn.

Test: make
Change-Id: I01fb7dca935261775efe2573ee009df4d0b07fd0
2016-12-07 13:24:54 -08:00
Joe Onorato
3a5eb29720 Fix bad type codes in streaming proto compiler
Change-Id: I4623f0a726107ec1321cadcaaf83b23353d0728e
Test: make StreamingProtoTest
2016-10-20 11:57:22 -07:00
Joe Onorato
6c9547d8e1 Add android.util.proto package as an @TestApi.
The classes there add a way for the platform to write out
protocol buffers that doesn't require lots of small objects,
generate code, and extra copying.

Includes the plugin for protoc to generate the constants.

Test: proto cts tests

Change-Id: I6385c198cecda9ac6fa533151609e3ace341af01
2016-10-12 16:37:18 -07:00