Skip to content

Commit

Permalink
Support building standalone far packages with autogenerating manigests (
Browse files Browse the repository at this point in the history
flutter#11849)

Also makes package_dir support testonly mode
  • Loading branch information
iskakaushik authored Sep 4, 2019
1 parent c10b6b9 commit a22797b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 18 additions & 4 deletions tools/fuchsia/gen_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import subprocess
import sys

from gather_flutter_runner_artifacts import CreateMetaPackage


# Generates the manifest and returns the file.
def GenerateManifest(package_dir):
Expand Down Expand Up @@ -57,23 +59,35 @@ def main():
parser.add_argument(
'--signing-key', dest='signing_key', action='store', required=True)
parser.add_argument(
'--manifest-file', dest='manifest_file', action='store', required=True)
'--manifest-file', dest='manifest_file', action='store', required=False)
parser.add_argument(
'--far-name', dest='far_name', action='store', required=False)

args = parser.parse_args()

assert os.path.exists(args.pm_bin)
assert os.path.exists(args.package_dir)
assert os.path.exists(args.signing_key)
assert os.path.exists(args.manifest_file)

pkg_dir = args.package_dir
if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')):
CreateMetaPackage(pkg_dir, args.far_name)

manifest_file = None
if args.manifest_file is not None:
assert os.path.exists(args.manifest_file)
manifest_file = args.manifest_file
else:
manifest_file = GenerateManifest(args.package_dir)

pm_command_base = [
args.pm_bin,
'-o',
args.package_dir,
os.path.abspath(os.path.join(pkg_dir, os.pardir)),
'-k',
args.signing_key,
'-m',
args.manifest_file,
manifest_file,
]

# Build the package
Expand Down
2 changes: 2 additions & 0 deletions tools/fuchsia/package_dir.gni
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ template("package_dir") {
assert(defined(invoker.binary), "package must define binary")
assert(defined(invoker.meta_dir), "package must define meta_dir")

pkg_testonly = defined(invoker.testonly) && invoker.testonly
pkg_target_name = target_name
pkg = {
package_version = "0" # placeholder
Expand Down Expand Up @@ -72,5 +73,6 @@ template("package_dir") {
deps = pkg.deps + [ ":$cmx_target" ]
args = [ "--file-list={{response_file_name}}" ]
outputs = copy_outputs
testonly = pkg_testonly
}
}

0 comments on commit a22797b

Please sign in to comment.