Loading tools/aapt2/Android.bp +4 −4 Original line number Diff line number Diff line // // Copyright (C) 2015 The Android Open Source Project // Copyright (C) 2017 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. Loading @@ -19,7 +19,7 @@ toolSources = [ "diff/Diff.cpp", "dump/Dump.cpp", "link/Link.cpp", "strip/Strip.cpp", "optimize/Optimize.cpp", ] cc_defaults { Loading Loading @@ -96,11 +96,11 @@ cc_library_host_static { "link/ProductFilter.cpp", "link/PrivateAttributeMover.cpp", "link/ReferenceLinker.cpp", "link/ResourceDeduper.cpp", "link/TableMerger.cpp", "link/VersionCollapser.cpp", "link/XmlNamespaceRemover.cpp", "link/XmlReferenceLinker.cpp", "optimize/ResourceDeduper.cpp", "optimize/VersionCollapser.cpp", "process/SymbolTable.cpp", "proto/ProtoHelpers.cpp", "proto/TableProtoDeserializer.cpp", Loading tools/aapt2/LoadedApk.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ std::unique_ptr<LoadedApk> LoadedApk::LoadApkFromPath(IAaptContext* context, return util::make_unique<LoadedApk>(source, std::move(apk), std::move(table)); } bool LoadedApk::WriteToArchive(IAaptContext* context, IArchiveWriter* writer) { bool LoadedApk::WriteToArchive(IAaptContext* context, const TableFlattenerOptions& options, IArchiveWriter* writer) { std::set<std::string> referenced_resources; // List the files being referenced in the resource table. for (auto& pkg : table_->packages) { Loading Loading @@ -96,7 +97,7 @@ bool LoadedApk::WriteToArchive(IAaptContext* context, IArchiveWriter* writer) { BigBuffer buffer = BigBuffer(1024); // TODO(adamlesinski): How to determine if there were sparse entries (and if to encode // with sparse entries) b/35389232. TableFlattener flattener({}, &buffer); TableFlattener flattener(options, &buffer); if (!flattener.Consume(context, table_.get())) { return false; } Loading tools/aapt2/LoadedApk.h +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "ResourceTable.h" #include "flatten/Archive.h" #include "flatten/TableFlattener.h" #include "io/ZipArchive.h" #include "unflatten/BinaryResourceParser.h" Loading @@ -45,7 +46,8 @@ class LoadedApk { * Writes the APK on disk at the given path, while also removing the resource * files that are not referenced in the resource table. */ bool WriteToArchive(IAaptContext* context, IArchiveWriter* writer); bool WriteToArchive(IAaptContext* context, const TableFlattenerOptions& options, IArchiveWriter* writer); static std::unique_ptr<LoadedApk> LoadApkFromPath(IAaptContext* context, const android::StringPiece& path); Loading tools/aapt2/Main.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ namespace aapt { static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "8"; static const char* sMinorVersion = "9"; int PrintVersion() { std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "." Loading @@ -37,7 +37,7 @@ extern int Compile(const std::vector<android::StringPiece>& args); extern int Link(const std::vector<android::StringPiece>& args); extern int Dump(const std::vector<android::StringPiece>& args); extern int Diff(const std::vector<android::StringPiece>& args); extern int Strip(const std::vector<android::StringPiece>& args); extern int Optimize(const std::vector<android::StringPiece>& args); } // namespace aapt Loading @@ -60,8 +60,8 @@ int main(int argc, char** argv) { return aapt::Dump(args); } else if (command == "diff") { return aapt::Diff(args); } else if (command == "strip") { return aapt::Strip(args); } else if (command == "optimize") { return aapt::Optimize(args); } else if (command == "version") { return aapt::PrintVersion(); } Loading @@ -70,7 +70,7 @@ int main(int argc, char** argv) { std::cerr << "no command specified\n"; } std::cerr << "\nusage: aapt2 [compile|link|dump|diff|strip|version] ..." std::cerr << "\nusage: aapt2 [compile|link|dump|diff|optimize|version] ..." << std::endl; return 1; } tools/aapt2/link/Link.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ #include "link/ManifestFixer.h" #include "link/ReferenceLinker.h" #include "link/TableMerger.h" #include "optimize/ResourceDeduper.h" #include "optimize/VersionCollapser.h" #include "process/IResourceTableConsumer.h" #include "process/SymbolTable.h" #include "proto/ProtoSerialize.h" Loading Loading
tools/aapt2/Android.bp +4 −4 Original line number Diff line number Diff line // // Copyright (C) 2015 The Android Open Source Project // Copyright (C) 2017 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. Loading @@ -19,7 +19,7 @@ toolSources = [ "diff/Diff.cpp", "dump/Dump.cpp", "link/Link.cpp", "strip/Strip.cpp", "optimize/Optimize.cpp", ] cc_defaults { Loading Loading @@ -96,11 +96,11 @@ cc_library_host_static { "link/ProductFilter.cpp", "link/PrivateAttributeMover.cpp", "link/ReferenceLinker.cpp", "link/ResourceDeduper.cpp", "link/TableMerger.cpp", "link/VersionCollapser.cpp", "link/XmlNamespaceRemover.cpp", "link/XmlReferenceLinker.cpp", "optimize/ResourceDeduper.cpp", "optimize/VersionCollapser.cpp", "process/SymbolTable.cpp", "proto/ProtoHelpers.cpp", "proto/TableProtoDeserializer.cpp", Loading
tools/aapt2/LoadedApk.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,8 @@ std::unique_ptr<LoadedApk> LoadedApk::LoadApkFromPath(IAaptContext* context, return util::make_unique<LoadedApk>(source, std::move(apk), std::move(table)); } bool LoadedApk::WriteToArchive(IAaptContext* context, IArchiveWriter* writer) { bool LoadedApk::WriteToArchive(IAaptContext* context, const TableFlattenerOptions& options, IArchiveWriter* writer) { std::set<std::string> referenced_resources; // List the files being referenced in the resource table. for (auto& pkg : table_->packages) { Loading Loading @@ -96,7 +97,7 @@ bool LoadedApk::WriteToArchive(IAaptContext* context, IArchiveWriter* writer) { BigBuffer buffer = BigBuffer(1024); // TODO(adamlesinski): How to determine if there were sparse entries (and if to encode // with sparse entries) b/35389232. TableFlattener flattener({}, &buffer); TableFlattener flattener(options, &buffer); if (!flattener.Consume(context, table_.get())) { return false; } Loading
tools/aapt2/LoadedApk.h +3 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include "ResourceTable.h" #include "flatten/Archive.h" #include "flatten/TableFlattener.h" #include "io/ZipArchive.h" #include "unflatten/BinaryResourceParser.h" Loading @@ -45,7 +46,8 @@ class LoadedApk { * Writes the APK on disk at the given path, while also removing the resource * files that are not referenced in the resource table. */ bool WriteToArchive(IAaptContext* context, IArchiveWriter* writer); bool WriteToArchive(IAaptContext* context, const TableFlattenerOptions& options, IArchiveWriter* writer); static std::unique_ptr<LoadedApk> LoadApkFromPath(IAaptContext* context, const android::StringPiece& path); Loading
tools/aapt2/Main.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ namespace aapt { static const char* sMajorVersion = "2"; // Update minor version whenever a feature or flag is added. static const char* sMinorVersion = "8"; static const char* sMinorVersion = "9"; int PrintVersion() { std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "." Loading @@ -37,7 +37,7 @@ extern int Compile(const std::vector<android::StringPiece>& args); extern int Link(const std::vector<android::StringPiece>& args); extern int Dump(const std::vector<android::StringPiece>& args); extern int Diff(const std::vector<android::StringPiece>& args); extern int Strip(const std::vector<android::StringPiece>& args); extern int Optimize(const std::vector<android::StringPiece>& args); } // namespace aapt Loading @@ -60,8 +60,8 @@ int main(int argc, char** argv) { return aapt::Dump(args); } else if (command == "diff") { return aapt::Diff(args); } else if (command == "strip") { return aapt::Strip(args); } else if (command == "optimize") { return aapt::Optimize(args); } else if (command == "version") { return aapt::PrintVersion(); } Loading @@ -70,7 +70,7 @@ int main(int argc, char** argv) { std::cerr << "no command specified\n"; } std::cerr << "\nusage: aapt2 [compile|link|dump|diff|strip|version] ..." std::cerr << "\nusage: aapt2 [compile|link|dump|diff|optimize|version] ..." << std::endl; return 1; }
tools/aapt2/link/Link.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ #include "link/ManifestFixer.h" #include "link/ReferenceLinker.h" #include "link/TableMerger.h" #include "optimize/ResourceDeduper.h" #include "optimize/VersionCollapser.h" #include "process/IResourceTableConsumer.h" #include "process/SymbolTable.h" #include "proto/ProtoSerialize.h" Loading