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

Unified Diff: build/android/gyp/create_flutter_jar.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 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 | « build/android/gyp/create_dist_jar.py ('k') | build/android/gyp/create_java_binary_script.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/create_flutter_jar.py
diff --git a/build/android/gyp/create_flutter_jar.py b/build/android/gyp/create_flutter_jar.py
new file mode 100644
index 0000000000000000000000000000000000000000..c30bae2bd9fecf0aaa748d48372b41e3b3762a81
--- /dev/null
+++ b/build/android/gyp/create_flutter_jar.py
@@ -0,0 +1,56 @@
+#!/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.
+
+"""Create a JAR incorporating all the components required to build a Flutter application"""
+
+import optparse
+import os
+import sys
+import zipfile
+
+from util import build_utils
+
+def main(args):
+ args = build_utils.ExpandFileArgs(args)
+ parser = optparse.OptionParser()
+ build_utils.AddDepfileOption(parser)
+ parser.add_option('--output', help='Path to output jar.')
+ parser.add_option('--dist_jar', help='Flutter shell Java code jar.')
+ parser.add_option('--native_lib', action='append', help='Native code library.')
+ parser.add_option('--android_abi', help='Native code ABI.')
+ parser.add_option('--asset_dir', help='Path to assets.')
+ options, _ = parser.parse_args(args)
+ build_utils.CheckOptions(options, parser, [
+ 'output', 'dist_jar', 'native_lib', 'android_abi', 'asset_dir'
+ ])
+
+ input_deps = []
+
+ with zipfile.ZipFile(options.output, 'w', zipfile.ZIP_DEFLATED) as out_zip:
+ input_deps.append(options.dist_jar)
+ with zipfile.ZipFile(options.dist_jar, 'r') as dist_zip:
+ for dist_file in dist_zip.infolist():
+ if dist_file.filename.endswith('.class'):
+ out_zip.writestr(dist_file.filename, dist_zip.read(dist_file.filename))
+
+ for native_lib in options.native_lib:
+ input_deps.append(native_lib)
+ out_zip.write(native_lib,
+ 'lib/%s/%s' % (options.android_abi, os.path.basename(native_lib)))
+
+ for asset_file in os.listdir(options.asset_dir):
+ input_deps.append(asset_file)
+ out_zip.write(os.path.join(options.asset_dir, asset_file),
+ 'assets/%s' % asset_file)
+
+ if options.depfile:
+ build_utils.WriteDepfile(
+ options.depfile,
+ input_deps + build_utils.GetPythonDependencies())
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
« 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