Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: build/android/rezip/rezip.cc

Issue 364193003: When building APK for direct loading, check for multiple libraries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check for multiple libraries, fix comment. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/rezip/rezip.cc
diff --git a/build/android/rezip/rezip.cc b/build/android/rezip/rezip.cc
index d839ab308fe479c595fc1d5fc84f8b4786814ee3..ce9bc86c5050fcef5781716eaa2db6a310743223 100644
--- a/build/android/rezip/rezip.cc
+++ b/build/android/rezip/rezip.cc
@@ -262,11 +262,13 @@ static int PageAlignCrazyLibrary(const char* in_filename,
// As only the read side API provides offsets, we check that we added the
// correct amount of padding by reading the zip file we just generated.
-static bool CheckPageAlign(const char* out_zip_filename) {
+// Also enforce that only one library is in the APK.
+static bool CheckPageAlignAndOnlyOneLibrary(const char* out_zip_filename) {
ScopedUnzip scoped_unzip(out_zip_filename);
unzFile in_file = scoped_unzip.OpenOrDie();
int err = 0;
+ int count = 0;
bool checked = false;
while (true) {
char in_filename[kMaxFilenameInZip + 1];
@@ -288,6 +290,18 @@ static bool CheckPageAlign(const char* out_zip_filename) {
in_filename[in_info.size_filename] = '\0';
if (IsCrazyLibraryFilename(in_filename)) {
+ count++;
+ if (count > 1) {
+ LOG(ERROR)
+ << "Found more than one library in " << out_zip_filename << "\n"
+ << "Multiple libraries are not supported for APKs that use "
+ << "'load_library_from_zip_file'.\n"
+ << "See crbug/388223.\n"
+ << "Note, check that your build is clean.\n"
+ << "An unclean build can incorrectly incorporate old "
+ << "libraries in the APK.";
+ return false;
+ }
err = unzOpenCurrentFile(in_file);
if (err != UNZ_OK) {
LOG(ERROR) << "failed to open subfile" << out_zip_filename << " "
@@ -513,7 +527,7 @@ int main(int argc, const char* argv[]) {
inflate_predicate_fun)) {
exit(1);
}
- if (check_page_align && !CheckPageAlign(out_zip_filename)) {
+ if (check_page_align && !CheckPageAlignAndOnlyOneLibrary(out_zip_filename)) {
exit(1);
}
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698