Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim Android release packages to required files #4847

Merged
merged 1 commit into from
Feb 5, 2025
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
30 changes: 27 additions & 3 deletions cobalt/build/android/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,33 @@


def lay_out(out_dir, base_dir):
shutil.copytree(out_dir, base_dir, dirs_exist_ok=True)
shutil.rmtree(os.path.join(base_dir, 'lib.unstripped'))
shutil.rmtree(os.path.join(base_dir, 'thinlto-cache'))
directories = [
'content/data',
'gen/cobalt/android/cobalt_apk/generated_java/input_srcjars/androidx/appcompat',
'gen/cobalt/android/cobalt_apk/generated_java/input_srcjars/androidx/core',
'gen/cobalt/android/cobalt_apk/generated_java/input_srcjars/androidx/fragment',
'gen/cobalt/android/cobalt_apk/generated_java/input_srcjars/gen/base_module',
'gen/cobalt/android/cobalt_apk/generated_java/input_srcjars/org/chromium',
'lib.java',
]

files = [
'content_shell.pak',
'icudtl.dat',
'obj/cobalt/android/cobalt_java_resources.resources.zip',
'obj/components/metrics/metrics_java.javac.jar',
'obj/content/shell/android/content_shell_java_resources.resources.zip',
'obj/third_party/android_deps/chromium_play_services_availability_java.javac.jar',
]

for directory in directories:
shutil.copytree(
os.path.join(out_dir, directory),
os.path.join(base_dir, directory),
dirs_exist_ok=True)

for file in files:
packaging.copy(os.path.join(out_dir, file), os.path.join(base_dir, file))


if __name__ == '__main__':
Expand Down
5 changes: 5 additions & 0 deletions cobalt/build/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import tempfile


def copy(src_file_path, dst_file_path):
os.makedirs(os.path.dirname(dst_file_path), exist_ok=True)
shutil.copy2(src_file_path, dst_file_path)


def run(lay_out):
parser = argparse.ArgumentParser()
parser.add_argument('--name', required=True, help='of archive and base dir')
Expand Down
Loading