Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions build/android_artifacts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Copies and renames android artifacts."""

import argparse
import os
import shutil
import sys

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!


def cp_files(args):
"""Copies files from source to destination.

It creates the destination folder if it does not exists yet.
"""
for src, dst in args.input_pairs:
os.makedirs(os.path.dirname(dst), exist_ok=True)
shutil.copyfile(src, dst)


def main():
parser = argparse.ArgumentParser()
parser.add_argument('-i', dest='input_pairs', nargs=2, action='append',
help='The input file and its destination.')
cp_files(parser.parse_args())
return 0


if __name__ == '__main__':
sys.exit(main())
45 changes: 45 additions & 0 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,48 @@ group("android") {
deps += [ ":gen_snapshot" ]
}
}

# Renames embedding android artifacts and places them in the final
# expected folder structure.
action("embedding_jars") {
script = "//flutter/build/android_artifacts.py"

deps = [
":flutter_shell_java",
":pom_embedding",
]
sources = [
"$root_out_dir/flutter_embedding_$flutter_runtime_mode.jar",
"$root_out_dir/flutter_embedding_$flutter_runtime_mode.pom",
]
outputs = []
args = []
base_name = "$root_out_dir/zip_archives/flutter_download_io/" +
"flutter_embedding_$flutter_runtime_mode/1.0.0-$engine_version/" +
"flutter_embedding_$flutter_runtime_mode-1.0.0-${engine_version}"
foreach(source, sources) {
extension = get_path_info(source, "extension")
name = get_path_info(source, "name")
if (extension == "jar") {
outputs += [
"${base_name}.jar",
"${base_name}-sources.jar",
]
args += [
"-i",
"${name}.jar",
rebase_path("${base_name}.jar"),
"-i",
"${name}-sources.jar",
rebase_path("${base_name}-sources.jar"),
]
} else {
outputs += [ "${base_name}.${extension}" ]
args += [
"-i",
rebase_path(source),
rebase_path("${base_name}.${extension}"),
]
}
}
}