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

Side by Side Diff: build/android/rezip/rezip.cc

Issue 595933003: Re-invent page aligning libraries in APK file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // rezip is a tool which is used to modify zip files. It reads in a 5 // rezip is a tool which is used to modify zip files. It reads in a
6 // zip file and outputs a new zip file after applying various 6 // zip file and outputs a new zip file after applying various
7 // transforms. The tool is used in the Android Chromium build process 7 // transforms. The tool is used in the Android Chromium build process
8 // to modify an APK file (which are zip files). The main application 8 // to modify an APK file (which are zip files). The main application
9 // of this is to modify the APK so that the shared library is no 9 // of this is to modify the APK so that the shared library is no
10 // longer compressed. Ironically, this saves both transmission and 10 // longer compressed. Ironically, this saves both transmission and
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 InflatePredicateFun inflate_predicate_fun = NULL; 500 InflatePredicateFun inflate_predicate_fun = NULL;
501 AlignFun align_fun = NULL; 501 AlignFun align_fun = NULL;
502 RenameFun rename_fun = NULL; 502 RenameFun rename_fun = NULL;
503 bool check_page_align = false; 503 bool check_page_align = false;
504 if (strcmp("inflatealign", action) == 0) { 504 if (strcmp("inflatealign", action) == 0) {
505 inflate_predicate_fun = &IsCrazyLibraryFilename; 505 inflate_predicate_fun = &IsCrazyLibraryFilename;
506 align_fun = &PageAlignCrazyLibrary; 506 align_fun = &PageAlignCrazyLibrary;
507 check_page_align = true; 507 check_page_align = true;
508 } else if (strcmp("rename", action) == 0) { 508 } else if (strcmp("rename", action) == 0) {
509 rename_fun = &RenameLibraryForCrazyLinker; 509 rename_fun = &RenameLibraryForCrazyLinker;
510 } else if (strcmp("renameinflate", action) == 0) {
511 rename_fun = &RenameLibraryForCrazyLinker;
512 inflate_predicate_fun = &IsLibraryFilename;
rmcilroy 2014/09/29 11:38:32 It looks like this is the only option used by the
Anton 2014/09/29 16:30:17 They are used by the LGPL compliance step of the o
510 } else if (strcmp("dropdescriptors", action) == 0) { 513 } else if (strcmp("dropdescriptors", action) == 0) {
511 // Minizip does not know about data descriptors, so the default 514 // Minizip does not know about data descriptors, so the default
512 // copying action will drop the descriptors. This should be fine 515 // copying action will drop the descriptors. This should be fine
513 // as data descriptors are redundant information. 516 // as data descriptors are redundant information.
514 // Note we need to explicitly drop the descriptors before trying to 517 // Note we need to explicitly drop the descriptors before trying to
515 // do alignment otherwise we will miscalculate the position because 518 // do alignment otherwise we will miscalculate the position because
516 // we don't know about the data descriptors. 519 // we don't know about the data descriptors.
517 } else { 520 } else {
518 LOG(ERROR) << "Usage: <action> should be 'inflatealign', " 521 LOG(ERROR) << "Usage: <action> should be 'inflatealign', "
519 "'dropdescriptors' or 'rename'"; 522 "'dropdescriptors' or 'rename'";
520 exit(1); 523 exit(1);
521 } 524 }
522 525
523 if (!Rezip(in_zip_filename, 526 if (!Rezip(in_zip_filename,
524 out_zip_filename, 527 out_zip_filename,
525 align_fun, 528 align_fun,
526 rename_fun, 529 rename_fun,
527 inflate_predicate_fun)) { 530 inflate_predicate_fun)) {
528 exit(1); 531 exit(1);
529 } 532 }
530 if (check_page_align && !CheckPageAlignAndOnlyOneLibrary(out_zip_filename)) { 533 if (check_page_align && !CheckPageAlignAndOnlyOneLibrary(out_zip_filename)) {
531 exit(1); 534 exit(1);
532 } 535 }
533 return 0; 536 return 0;
534 } 537 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698