#!/bin/bash
[% c("var/set_default_env") -%]
distdir=[% dest_dir %]/[% c('filename') %]

mkdir -p $distdir

[% IF c("var/android_single_arch") -%]
  mv $rootdir/[% c('input_files_by_name/tor-expert-bundle') %]/tor-expert-bundle-[% c("arch") %].aar $distdir/tor-expert-bundle.aar
[% ELSE -%]
  mkdir aar
  cd aar

  # We take for granted that we can take the manifests from any of the bundles
  # without having to change it.
  [% FOREACH arch = ['armv7', 'aarch64', 'x86_64'] -%]
    unzip -o $rootdir/[% c('input_files_by_name/tor-expert-bundle-' _ arch) %]/tor-expert-bundle-[% arch %].aar
  [% END -%]
  [% c('zip', {
      zip_src => [ '*' ],
      zip_args => '$distdir/tor-expert-bundle.aar'
    }) %]
[% END -%]
