build 2.85 KB
Newer Older
sisbell's avatar
sisbell committed
1 2 3 4 5 6
#!/bin/bash
[% c("var/set_default_env") -%]
export PROJECT_PATH=/var/tmp/dist/[% project %]
export SDK_HOME=$PROJECT_PATH/android-sdk-linux
export NDK_HOME=$PROJECT_PATH/android-ndk
export GRADLE_HOME=$PROJECT_PATH/gradle
Georg Koppen's avatar
Georg Koppen committed
7 8
android_release_dir=android-10
android_release_dir_old=android-9
sisbell's avatar
sisbell committed
9

Georg Koppen's avatar
Georg Koppen committed
10
# Make directories
sisbell's avatar
sisbell committed
11 12 13 14 15
mkdir -p $NDK_HOME $SDK_HOME $GRADLE_HOME

# Compiler Archives
unzip -qq [% c("input_files_by_name/android_sdk_tools") %] -d $SDK_HOME
unzip -qq [% c("input_files_by_name/android_ndk_compiler")%] -d $NDK_HOME
Georg Koppen's avatar
Georg Koppen committed
16 17
# GeckoView is still using an older Android NDK, bundle it, too.
unzip -qq [% c("input_files_by_name/android_ndk_compiler_old")%] -d $NDK_HOME
18
unzip -qq [% c("input_files_by_name/gradle564") %] -d $GRADLE_HOME
Georg Koppen's avatar
Georg Koppen committed
19
# GeckoView is still using an older Gradle, bundle it, too.
20
unzip -qq [% c("input_files_by_name/gradle511") %] -d $GRADLE_HOME
Georg Koppen's avatar
Georg Koppen committed
21
# application-services is using a comparatively new Gradle, bundle it, too.
22 23 24
unzip -qq [% c("input_files_by_name/gradle63") %] -d $GRADLE_HOME
# Fenix switched to a fairly recent Gradle, add it as well.
unzip -qq [% c("input_files_by_name/gradle651") %] -d $GRADLE_HOME
sisbell's avatar
sisbell committed
25 26

# NDK Archive
Georg Koppen's avatar
Georg Koppen committed
27 28 29 30 31 32 33 34 35
for version in [% c("var/android_ndk_version") %][% c("var/android_ndk_revision") %] [% c("var/android_ndk_version_old") %]; do
  # Adjust cross compilation prefix for armv7a. Unfortunately, the compiler cross
  # compilation prefix and the one for all the other tools differ. Let's fix that
  # so we only have to take care of one. See: #33557 (comment 2674649).
  cd $NDK_HOME/android-ndk-r$version/toolchains/llvm/prebuilt/linux-x86_64/bin
  for f in `ls arm-linux-androideabi-*`; do
    ln -s $f ${f//arm-linux-androideabi/armv7a-linux-androideabi}
  done
done
sisbell's avatar
sisbell committed
36 37 38

# Tool Archives
cd $SDK_HOME
39
unzip -qq $HOME/[% c("input_files_by_name/build_tools") %] -d $SDK_HOME
Georg Koppen's avatar
Georg Koppen committed
40 41 42
mkdir -p build-tools/[% c("version") %]
mv $android_release_dir/* build-tools/[% c("version") %]

43 44 45
# Apart from GeckoView all other projects do still need build-tools 28.0.3 as
# they are using the Gradle plugin 3.2.1 - 3.6.0 without specifying
# `buildToolsVersion`.
Georg Koppen's avatar
Georg Koppen committed
46 47 48
unzip -qq $HOME/[% c("input_files_by_name/build_tools_old") %] -d $SDK_HOME
mkdir -p build-tools/[% c("version_old") %]
mv $android_release_dir_old/* build-tools/[% c("version_old") %]
sisbell's avatar
sisbell committed
49

50
unzip -qq $HOME/[% c("input_files_by_name/platform") %] -d $SDK_HOME
Georg Koppen's avatar
Georg Koppen committed
51 52 53
mkdir -p platforms/android-[% c("var/android_api_level") %]
mv $android_release_dir/* platforms/android-[% c("var/android_api_level") %]

54
unzip -qq $HOME/[% c("input_files_by_name/platform_tools") %] -d $SDK_HOME
sisbell's avatar
sisbell committed
55

Georg Koppen's avatar
Georg Koppen committed
56 57 58 59 60
# That's a quirk required by GeckoView but let's have it here instead of in the
# project's build script
mkdir emulator
cp tools/emulator emulator/

sisbell's avatar
sisbell committed
61
# Cleanup
Georg Koppen's avatar
Georg Koppen committed
62
rm -fR $android_release_dir $android_release_dir_old
sisbell's avatar
sisbell committed
63 64 65 66 67 68 69

# Archive dist directory
cd /var/tmp/dist
[% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
        }) %]