Remove lite optimization from protos

aapt2 does not require the lite runtime optimization to reduce binary
size. Removing the allows for the protos to be optimized for speed
instead of binary size and grants access to refelctive operations.

Test: aapt2_tests on linux and windows
Change-Id: Ie7ed9df4061e2eb60adbd300eb358d4c3f32c80c
This commit is contained in:
Ryan Mitchell
2019-05-20 16:54:48 -07:00
parent 9c6483c1eb
commit 22ead1c3b0
6 changed files with 7 additions and 10 deletions

View File

@@ -56,7 +56,7 @@ cc_defaults {
"libziparchive",
"libpng",
"libbase",
"libprotobuf-cpp-lite",
"libprotobuf-cpp-full",
"libz",
"libbuildversion",
],

View File

@@ -19,7 +19,6 @@ syntax = "proto3";
package aapt.pb;
option java_package = "com.android.aapt";
option optimize_for = LITE_RUNTIME;
// A description of the requirements a device must have in order for a
// resource to be matched and selected.

View File

@@ -21,7 +21,6 @@ import "frameworks/base/tools/aapt2/Configuration.proto";
package aapt.pb;
option java_package = "com.android.aapt";
option optimize_for = LITE_RUNTIME;
// A string pool that wraps the binary form of the C++ class android::ResStringPool.
message StringPool {

View File

@@ -22,7 +22,6 @@ import "frameworks/base/tools/aapt2/Resources.proto";
package aapt.pb.internal;
option java_package = "android.aapt.pb.internal";
option optimize_for = LITE_RUNTIME;
// The top level message representing an external resource file (layout XML, PNG, etc).
// This is used to represent a compiled file before it is linked. Only useful to aapt2.

View File

@@ -58,7 +58,7 @@ bool CopyFileToArchivePreserveCompression(IAaptContext* context, io::IFile* file
return CopyFileToArchive(context, file, out_path, compression_flags, writer);
}
bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::MessageLite* proto_msg,
bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::Message* proto_msg,
const std::string& out_path, uint32_t compression_flags,
IArchiveWriter* writer) {
TRACE_CALL();

View File

@@ -19,7 +19,7 @@
#include <string>
#include "google/protobuf/message_lite.h"
#include "google/protobuf/message.h"
#include "google/protobuf/io/coded_stream.h"
#include "format/Archive.h"
@@ -39,7 +39,7 @@ bool CopyFileToArchive(IAaptContext* context, IFile* file, const std::string& ou
bool CopyFileToArchivePreserveCompression(IAaptContext* context, IFile* file,
const std::string& out_path, IArchiveWriter* writer);
bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::MessageLite* proto_msg,
bool CopyProtoToArchive(IAaptContext* context, ::google::protobuf::Message* proto_msg,
const std::string& out_path, uint32_t compression_flags,
IArchiveWriter* writer);
@@ -127,13 +127,13 @@ class ProtoInputStreamReader {
public:
explicit ProtoInputStreamReader(io::InputStream* in) : in_(in) { }
/** Deserializes a MessageLite proto from the current position in the input stream.*/
template <typename T> bool ReadMessage(T *message_lite) {
/** Deserializes a Message proto from the current position in the input stream.*/
template <typename T> bool ReadMessage(T *message) {
ZeroCopyInputAdaptor adapter(in_);
google::protobuf::io::CodedInputStream coded_stream(&adapter);
coded_stream.SetTotalBytesLimit(std::numeric_limits<int32_t>::max(),
coded_stream.BytesUntilTotalBytesLimit());
return message_lite->ParseFromCodedStream(&coded_stream);
return message->ParseFromCodedStream(&coded_stream);
}
private: