Loading tools/aapt2/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_defaults { "libbase", "libbase", "libprotobuf-cpp-lite", "libprotobuf-cpp-lite", "libz", "libz", "libbuildversion", ], ], stl: "libc++_static", stl: "libc++_static", group_static_libs: true, group_static_libs: true, Loading tools/aapt2/Main.cpp +1 −8 Original line number Original line Diff line number Diff line Loading @@ -46,12 +46,6 @@ using ::android::base::StringPrintf; namespace aapt { namespace aapt { // DO NOT UPDATE, this is more of a marketing version. static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "19"; /** Prints the version information of AAPT2. */ /** Prints the version information of AAPT2. */ class VersionCommand : public Command { class VersionCommand : public Command { public: public: Loading @@ -60,8 +54,7 @@ class VersionCommand : public Command { } } int Action(const std::vector<std::string>& /* args */) override { int Action(const std::vector<std::string>& /* args */) override { std::cerr << StringPrintf("Android Asset Packaging Tool (aapt) %s:%s", sMajorVersion, std::cerr << StringPrintf("%s %s", util::GetToolName(), util::GetToolFingerprint().c_str()) sMinorVersion) << std::endl; << std::endl; return 0; return 0; } } Loading tools/aapt2/Resources.proto +9 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,12 @@ message Source { SourcePosition position = 2; SourcePosition position = 2; } } // The name and version fingerprint of a build tool. message ToolFingerprint { string tool = 1; string version = 2; } // Top level message representing a resource table. // Top level message representing a resource table. message ResourceTable { message ResourceTable { // The string pool containing source paths referenced throughout the resource table. This does // The string pool containing source paths referenced throughout the resource table. This does Loading @@ -52,6 +58,9 @@ message ResourceTable { // The <overlayable> declarations within the resource table. // The <overlayable> declarations within the resource table. repeated Overlayable overlayable = 3; repeated Overlayable overlayable = 3; // The version fingerprints of the tools that built the resource table. repeated ToolFingerprint tool_fingerprint = 4; } } // A package ID in the range [0x00, 0xff]. // A package ID in the range [0x00, 0xff]. Loading tools/aapt2/format/proto/ProtoSerialize.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -327,6 +327,9 @@ static void SerializeOverlayableItemToPb(const OverlayableItem& overlayable_item void SerializeTableToPb(const ResourceTable& table, pb::ResourceTable* out_table, void SerializeTableToPb(const ResourceTable& table, pb::ResourceTable* out_table, IDiagnostics* diag) { IDiagnostics* diag) { StringPool source_pool; StringPool source_pool; pb::ToolFingerprint* pb_fingerprint = out_table->add_tool_fingerprint(); pb_fingerprint->set_tool(util::GetToolName()); pb_fingerprint->set_version(util::GetToolFingerprint()); std::vector<Overlayable*> overlayables; std::vector<Overlayable*> overlayables; for (const std::unique_ptr<ResourceTablePackage>& package : table.packages) { for (const std::unique_ptr<ResourceTablePackage>& package : table.packages) { Loading tools/aapt2/util/Util.cpp +21 −1 Original line number Original line Diff line number Diff line Loading @@ -21,13 +21,15 @@ #include <string> #include <string> #include <vector> #include <vector> #include "android-base/stringprintf.h" #include "androidfw/StringPiece.h" #include "androidfw/StringPiece.h" #include "utils/Unicode.h" #include "build/version.h" #include "text/Unicode.h" #include "text/Unicode.h" #include "text/Utf8Iterator.h" #include "text/Utf8Iterator.h" #include "util/BigBuffer.h" #include "util/BigBuffer.h" #include "util/Maybe.h" #include "util/Maybe.h" #include "utils/Unicode.h" using ::aapt::text::Utf8Iterator; using ::aapt::text::Utf8Iterator; using ::android::StringPiece; using ::android::StringPiece; Loading Loading @@ -200,6 +202,24 @@ Maybe<std::string> GetFullyQualifiedClassName(const StringPiece& package, return result; return result; } } const char* GetToolName() { static const char* const sToolName = "Android Asset Packaging Tool (aapt)"; return sToolName; } std::string GetToolFingerprint() { // DO NOT UPDATE, this is more of a marketing version. static const char* const sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* const sMinorVersion = "19"; // The build id of aapt2 binary. static const std::string sBuildId = android::build::GetBuildNumber(); return android::base::StringPrintf("%s.%s-%s", sMajorVersion, sMinorVersion, sBuildId.c_str()); } static size_t ConsumeDigits(const char* start, const char* end) { static size_t ConsumeDigits(const char* start, const char* end) { const char* c = start; const char* c = start; for (; c != end && *c >= '0' && *c <= '9'; c++) { for (; c != end && *c >= '0' && *c <= '9'; c++) { Loading Loading
tools/aapt2/Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,7 @@ cc_defaults { "libbase", "libbase", "libprotobuf-cpp-lite", "libprotobuf-cpp-lite", "libz", "libz", "libbuildversion", ], ], stl: "libc++_static", stl: "libc++_static", group_static_libs: true, group_static_libs: true, Loading
tools/aapt2/Main.cpp +1 −8 Original line number Original line Diff line number Diff line Loading @@ -46,12 +46,6 @@ using ::android::base::StringPrintf; namespace aapt { namespace aapt { // DO NOT UPDATE, this is more of a marketing version. static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "19"; /** Prints the version information of AAPT2. */ /** Prints the version information of AAPT2. */ class VersionCommand : public Command { class VersionCommand : public Command { public: public: Loading @@ -60,8 +54,7 @@ class VersionCommand : public Command { } } int Action(const std::vector<std::string>& /* args */) override { int Action(const std::vector<std::string>& /* args */) override { std::cerr << StringPrintf("Android Asset Packaging Tool (aapt) %s:%s", sMajorVersion, std::cerr << StringPrintf("%s %s", util::GetToolName(), util::GetToolFingerprint().c_str()) sMinorVersion) << std::endl; << std::endl; return 0; return 0; } } Loading
tools/aapt2/Resources.proto +9 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,12 @@ message Source { SourcePosition position = 2; SourcePosition position = 2; } } // The name and version fingerprint of a build tool. message ToolFingerprint { string tool = 1; string version = 2; } // Top level message representing a resource table. // Top level message representing a resource table. message ResourceTable { message ResourceTable { // The string pool containing source paths referenced throughout the resource table. This does // The string pool containing source paths referenced throughout the resource table. This does Loading @@ -52,6 +58,9 @@ message ResourceTable { // The <overlayable> declarations within the resource table. // The <overlayable> declarations within the resource table. repeated Overlayable overlayable = 3; repeated Overlayable overlayable = 3; // The version fingerprints of the tools that built the resource table. repeated ToolFingerprint tool_fingerprint = 4; } } // A package ID in the range [0x00, 0xff]. // A package ID in the range [0x00, 0xff]. Loading
tools/aapt2/format/proto/ProtoSerialize.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -327,6 +327,9 @@ static void SerializeOverlayableItemToPb(const OverlayableItem& overlayable_item void SerializeTableToPb(const ResourceTable& table, pb::ResourceTable* out_table, void SerializeTableToPb(const ResourceTable& table, pb::ResourceTable* out_table, IDiagnostics* diag) { IDiagnostics* diag) { StringPool source_pool; StringPool source_pool; pb::ToolFingerprint* pb_fingerprint = out_table->add_tool_fingerprint(); pb_fingerprint->set_tool(util::GetToolName()); pb_fingerprint->set_version(util::GetToolFingerprint()); std::vector<Overlayable*> overlayables; std::vector<Overlayable*> overlayables; for (const std::unique_ptr<ResourceTablePackage>& package : table.packages) { for (const std::unique_ptr<ResourceTablePackage>& package : table.packages) { Loading
tools/aapt2/util/Util.cpp +21 −1 Original line number Original line Diff line number Diff line Loading @@ -21,13 +21,15 @@ #include <string> #include <string> #include <vector> #include <vector> #include "android-base/stringprintf.h" #include "androidfw/StringPiece.h" #include "androidfw/StringPiece.h" #include "utils/Unicode.h" #include "build/version.h" #include "text/Unicode.h" #include "text/Unicode.h" #include "text/Utf8Iterator.h" #include "text/Utf8Iterator.h" #include "util/BigBuffer.h" #include "util/BigBuffer.h" #include "util/Maybe.h" #include "util/Maybe.h" #include "utils/Unicode.h" using ::aapt::text::Utf8Iterator; using ::aapt::text::Utf8Iterator; using ::android::StringPiece; using ::android::StringPiece; Loading Loading @@ -200,6 +202,24 @@ Maybe<std::string> GetFullyQualifiedClassName(const StringPiece& package, return result; return result; } } const char* GetToolName() { static const char* const sToolName = "Android Asset Packaging Tool (aapt)"; return sToolName; } std::string GetToolFingerprint() { // DO NOT UPDATE, this is more of a marketing version. static const char* const sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* const sMinorVersion = "19"; // The build id of aapt2 binary. static const std::string sBuildId = android::build::GetBuildNumber(); return android::base::StringPrintf("%s.%s-%s", sMajorVersion, sMinorVersion, sBuildId.c_str()); } static size_t ConsumeDigits(const char* start, const char* end) { static size_t ConsumeDigits(const char* start, const char* end) { const char* c = start; const char* c = start; for (; c != end && *c >= '0' && *c <= '9'; c++) { for (; c != end && *c >= '0' && *c <= '9'; c++) { Loading