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 3.13 KB
Newer Older
Georg Koppen's avatar
Georg Koppen committed
1 2 3 4 5 6 7 8
#!/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

9 10 11 12
cat > get-moz-build-date << "EOF"
[% INCLUDE "get-moz-build-date" %]
EOF

Georg Koppen's avatar
Georg Koppen committed
13
[% IF !c("var/fetch_gradle_dependencies") %]
14
  [% pc('python', 'var/setup', { python_tarfile => c('input_files_by_name/python') }) %]
Georg Koppen's avatar
Georg Koppen committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  # 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") %]
32 33 34 35 36

# 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
37
[% IF c("var/fetch_gradle_dependencies") %]
38
  $GRADLE_HOME/gradle-6.5.1/bin/gradle --debug --no-daemon app:assemble[% c('variant') %] -x lint
Georg Koppen's avatar
Georg Koppen committed
39
[% ELSE %]
40 41 42 43 44 45
  # Prepare Glean dependencies for offline build
  tar -xjf $rootdir/glean-parser-[% c('var/glean_parser') %].tar.bz2
  # We need to set `LC_ALL` and `LANG` to something that is not ASCII as encoding
  # otherwise `click` barfs. See: https://click.palletsprojects.com/python3/
  export LC_ALL=C.UTF-8
  export LANG=C.UTF-8
Georg Koppen's avatar
Georg Koppen committed
46 47 48 49 50 51
  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

52 53 54 55 56 57 58
  eval $(perl $rootdir/get-moz-build-date [% c("var/copyright_year") %] [% c("var/torbrowser_version") %])
  if [ -z $MOZ_BUILD_DATE ]
  then
    echo "MOZ_BUILD_DATE is not set"
    exit 1
  fi

59 60
  version_name='[% c("var/torbrowser_version") %] ([% c("var/fenix_version") %]-[% c("variant") %])'
  $GRADLE_HOME/gradle-6.5.1/bin/gradle --offline --no-daemon -PversionName="$version_name" -Dmaven.repo.local=$gradle_repo app:assemble[% c('variant') %] -x lint
61 62 63
  # 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
64 65 66 67 68 69 70

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