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
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp
index b13731f..1be4ea8 100644
--- a/tools/aapt2/Android.bp
+++ b/tools/aapt2/Android.bp
@@ -56,7 +56,7 @@
"libziparchive",
"libpng",
"libbase",
- "libprotobuf-cpp-lite",
+ "libprotobuf-cpp-full",
"libz",
"libbuildversion",
],
diff --git a/tools/aapt2/Configuration.proto b/tools/aapt2/Configuration.proto
index fc636a4..8a4644c 100644
--- a/tools/aapt2/Configuration.proto
+++ b/tools/aapt2/Configuration.proto
@@ -19,7 +19,6 @@
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.
diff --git a/tools/aapt2/Resources.proto b/tools/aapt2/Resources.proto
index b2fc084..da0dc79 100644
--- a/tools/aapt2/Resources.proto
+++ b/tools/aapt2/Resources.proto
@@ -21,7 +21,6 @@
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 {
diff --git a/tools/aapt2/ResourcesInternal.proto b/tools/aapt2/ResourcesInternal.proto
index 520b242..b0ed3da3 100644
--- a/tools/aapt2/ResourcesInternal.proto
+++ b/tools/aapt2/ResourcesInternal.proto
@@ -22,7 +22,6 @@
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.
diff --git a/tools/aapt2/io/Util.cpp b/tools/aapt2/io/Util.cpp
index ce6d9352..bb925c9 100644
--- a/tools/aapt2/io/Util.cpp
+++ b/tools/aapt2/io/Util.cpp
@@ -58,7 +58,7 @@
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();
diff --git a/tools/aapt2/io/Util.h b/tools/aapt2/io/Util.h
index 5f978a8..5cb8206 100644
--- a/tools/aapt2/io/Util.h
+++ b/tools/aapt2/io/Util.h
@@ -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 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 @@
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: