GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

build 2.27 KB
Newer Older
Georg Koppen's avatar
Georg Koppen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash
[% c("var/set_default_env") -%]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
distdir=/var/tmp/dist
builddir=/var/tmp/build/[% project %]
mkdir -p $distdir/[% project %]
mkdir -p /var/tmp/build

[% IF !c("var/fetch_gradle_dependencies") %]
  # XXX: Make this more generic and not only for geckoview-beta.
  geckoview_version=$(find . -type f -name geckoview-beta-*.aar | cut -d \- -f 6 | cut -d \. -f 1-3)
  gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
  cp -r $gradle_repo/dl/android/maven2/* $gradle_repo
  cp -r $gradle_repo/maven2/* $gradle_repo
  cp -r $gradle_repo/m2/* $gradle_repo
  tar -C $distdir -xf [% c('input_files_by_name/application-services') %]
  # XXX: We could be smarter (both for a-s and a-c) and just copy over the
  # projects that are needed according to the Gradle dependencies list.
  cp -rf $distdir/application-services/maven/org $gradle_repo
  tar -C $distdir -xf [% c('input_files_by_name/android-components') %]
  cp -rf $distdir/android-components/maven/org $gradle_repo
  tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
[% END %]
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz

cd $builddir-[% c("version") %]
27 28 29 30 31

# Move Android library dependencies so they will be included in the apk during the build
cp $rootdir/[% c('input_files_by_name/topl') %]/* app/
cp $rootdir/[% c('input_files_by_name/tor-android-service') %]/* app/

Georg Koppen's avatar
Georg Koppen committed
32
[% IF c("var/fetch_gradle_dependencies") %]
33
  gradle --debug --no-daemon app:assemble[% c('variant') %] -x lint
Georg Koppen's avatar
Georg Koppen committed
34 35 36 37 38 39 40
[% ELSE %]
  patch -p1 < $rootdir/mavenLocal.patch

  # Make sure our GeckoView dependency is used. XXX: Make this more generic and
  # not only for geckoview-beta.
  cp -f $distdir/geckoview/*.aar $gradle_repo/org/mozilla/geckoview/geckoview-beta/$geckoview_version/geckoview-beta-$geckoview_version.aar

41 42 43 44
  gradle --offline --no-daemon -Dmaven.repo.local=$gradle_repo app:assemble[% c('variant') %] -x lint
  # XXX We need the build variant in lower case. Do something smarter here.
  v=[% c("variant") %]
  cp app/build/outputs/apk/${v,}/*.apk $distdir/[% project %]
Georg Koppen's avatar
Georg Koppen committed
45 46 47 48 49 50 51

  cd $distdir
  [% c('tar', {
          tar_src => [ project ],
          tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
      }) %]
[% END %]