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

Side by Side Diff: build/android/gyp/create_flutter_jar.py

Issue 2392643003: Removes files from //build that we don't need (Closed)
Patch Set: Created 4 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
« no previous file with comments | « build/android/gyp/create_dist_jar.py ('k') | build/android/gyp/create_java_binary_script.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Create a JAR incorporating all the components required to build a Flutter app lication"""
8
9 import optparse
10 import os
11 import sys
12 import zipfile
13
14 from util import build_utils
15
16 def main(args):
17 args = build_utils.ExpandFileArgs(args)
18 parser = optparse.OptionParser()
19 build_utils.AddDepfileOption(parser)
20 parser.add_option('--output', help='Path to output jar.')
21 parser.add_option('--dist_jar', help='Flutter shell Java code jar.')
22 parser.add_option('--native_lib', action='append', help='Native code library.' )
23 parser.add_option('--android_abi', help='Native code ABI.')
24 parser.add_option('--asset_dir', help='Path to assets.')
25 options, _ = parser.parse_args(args)
26 build_utils.CheckOptions(options, parser, [
27 'output', 'dist_jar', 'native_lib', 'android_abi', 'asset_dir'
28 ])
29
30 input_deps = []
31
32 with zipfile.ZipFile(options.output, 'w', zipfile.ZIP_DEFLATED) as out_zip:
33 input_deps.append(options.dist_jar)
34 with zipfile.ZipFile(options.dist_jar, 'r') as dist_zip:
35 for dist_file in dist_zip.infolist():
36 if dist_file.filename.endswith('.class'):
37 out_zip.writestr(dist_file.filename, dist_zip.read(dist_file.filename) )
38
39 for native_lib in options.native_lib:
40 input_deps.append(native_lib)
41 out_zip.write(native_lib,
42 'lib/%s/%s' % (options.android_abi, os.path.basename(native_ lib)))
43
44 for asset_file in os.listdir(options.asset_dir):
45 input_deps.append(asset_file)
46 out_zip.write(os.path.join(options.asset_dir, asset_file),
47 'assets/%s' % asset_file)
48
49 if options.depfile:
50 build_utils.WriteDepfile(
51 options.depfile,
52 input_deps + build_utils.GetPythonDependencies())
53
54
55 if __name__ == '__main__':
56 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « build/android/gyp/create_dist_jar.py ('k') | build/android/gyp/create_java_binary_script.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698