Skip to content

Commit

Permalink
Package Cobalt for Android
Browse files Browse the repository at this point in the history
The layout here is very provisional
based on what worked before commit 38a06fe.

Issue: 365150653
Reviewed-on: youtube/cobalt#4786
  • Loading branch information
dahlstrom-g committed Jan 30, 2025
1 parent 5e27148 commit d9aa791
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
33 changes: 33 additions & 0 deletions cobalt/build/android/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3
"""Packages Cobalt for Android."""

import argparse
import os
import shutil
import tempfile


def main():
parser = argparse.ArgumentParser()
parser.add_argument('--name', required=True, help='of archive and base dir')
parser.add_argument('out_dir', help='generated by GN and built by Ninja')
parser.add_argument('package_dir', help='where to place the archive')
args = parser.parse_args()
package(args.out_dir, args.package_dir, args.name)


def package(out_dir, package_dir, name):
with tempfile.TemporaryDirectory() as tmp_dir:
base_dir = os.path.join(tmp_dir, name)
os.makedirs(base_dir)

shutil.copy2(os.path.join(out_dir, 'apks/Cobalt.apk'), base_dir)
shutil.copytree(
os.path.join(out_dir, 'content'),
os.path.join(base_dir, 'cobalt_package', 'content'))

shutil.make_archive(os.path.join(package_dir, name), 'zip', tmp_dir)


if __name__ == '__main__':
main()
3 changes: 2 additions & 1 deletion cobalt/devinfra/kokoro/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ run_package_release_pipeline () {

# Create release package.
if [[ "${PLATFORM}" =~ "android" ]]; then
cp "${out_dir}/apks/Cobalt.apk" "${package_dir}"
python3 "${WORKSPACE_COBALT}/cobalt/build/android/package.py" \
--name=cobalt-android "${out_dir}" "${package_dir}"
elif [[ "${PLATFORM}" =~ "evergreen" ]]; then
local bootloader_out_dir=
if [ -n "${BOOTLOADER:-}" ]; then
Expand Down

0 comments on commit d9aa791

Please sign in to comment.