Index: build/android/gyp/locale_pak_assets.py |
diff --git a/build/android/gyp/locale_pak_assets.py b/build/android/gyp/locale_pak_assets.py |
deleted file mode 100755 |
index b7e7ea269997a0c3b27bb060d623a1126c2e1955..0000000000000000000000000000000000000000 |
--- a/build/android/gyp/locale_pak_assets.py |
+++ /dev/null |
@@ -1,104 +0,0 @@ |
-#!/usr/bin/env python |
-# |
-# Copyright 2016 The Chromium Authors. All rights reserved. |
-# Use of this source code is governed by a BSD-style license that can be |
-# found in the LICENSE file. |
-"""Creates a srcjar for locale pak file paths. |
- |
-Creates a srcjar with a class containing an array of locale pak files so that |
-these assets can be enumerated and extracted as necessary. This is much |
-more efficient than using AssetManager.list(). |
- |
-The generated class implements: |
- //base/android/java/src/org/chromium/base/LocalePakFiles.java |
- |
-Providing access to pak file paths via: |
- public static String[] getFiles() |
-""" |
- |
-import argparse |
-import collections |
-import os |
-import string |
-import sys |
-import zipfile |
- |
-sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir)) |
-from pylib.constants import host_paths |
-from util import build_utils |
- |
-_CLASSNAME = 'LocalePakFiles' |
-_PACKAGE = 'org.chromium.ui' |
-_THIS_FILE = os.path.abspath(__file__) |
- |
- |
-def _CreateLocalePakFilesJava(pakfiles, package, classname, target): |
- """Generate the java file contents for the locale pak file class.""" |
- file_tmpl = string.Template(""" |
-// Copyright 2016 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-// This file is generated by: |
-// ${THIS_FILE} |
-// From target: |
-// ${TARGET} |
- |
-package ${PACKAGE}; |
- |
-import org.chromium.base.annotations.SuppressFBWarnings; |
- |
-public class LocalePakFiles { |
- private static String[] pakFiles = {${PAKFILES}}; |
- |
- @SuppressFBWarnings("MS_EXPOSE_REP") |
- public static String[] getFiles() { |
- return pakFiles; |
- } |
-} |
-""") |
- |
- values = { |
- 'TARGET': target, |
- 'PACKAGE': package, |
- 'CLASSNAME': classname, |
- 'THIS_FILE': os.path.relpath(_THIS_FILE, host_paths.DIR_SOURCE_ROOT), |
- 'PAKFILES': ', '.join('"%s"' % p for p in pakfiles), |
- } |
- |
- return file_tmpl.substitute(values) |
- |
- |
-def _WriteJarOutput(output_path, in_zip_path, data): |
- """Write file data to a srcjar.""" |
- path = os.path.dirname(output_path) |
- if path and not os.path.exists(path): |
- os.makedirs(path) |
- with zipfile.ZipFile(output_path, 'w') as srcjar: |
- build_utils.AddToZipHermetic(srcjar, in_zip_path, data=data) |
- |
- |
-def main(): |
- parser = argparse.ArgumentParser() |
- build_utils.AddDepfileOption(parser) |
- parser.add_argument('--locale-paks', required=True, |
- help='List of pak file paths to be added to srcjar') |
- parser.add_argument('--srcjar', required=True, help='Path to output srcjar') |
- parser.add_argument('--target', required=True, help='Target invoking script') |
- |
- args = parser.parse_args() |
- |
- sources = build_utils.ParseGnList(args.locale_paks) |
- |
- if args.depfile: |
- build_utils.WriteDepfile(args.depfile, args.srcjar) |
- |
- pakfiles = [os.path.basename(s) for s in sources] |
- srcjar_contents = _CreateLocalePakFilesJava( |
- pakfiles, _PACKAGE, _CLASSNAME, args.target) |
- in_zip_path = os.path.join(_PACKAGE.replace('.', '/'), _CLASSNAME + '.java') |
- _WriteJarOutput(args.srcjar, in_zip_path, srcjar_contents) |
- |
- |
-if __name__ == '__main__': |
- sys.exit(main()) |