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.52 KB
Newer Older
1 2 3 4 5
#!/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 %]
6 7
mkdir $distdir/[% project %]
mkdir /var/tmp/build
8 9

[% IF !c("var/fetch_gradle_dependencies") %]
10
  [% pc('python', 'var/setup', { python_tarfile => c('input_files_by_name/python') }) %]
11
  tar -C $distdir -xf [% c('input_files_by_name/geckoview') %]
12
  gradle_repo=$rootdir/[% c('input_files_by_name/gradle-dependencies') %]
13 14 15 16 17
  # This overwrites the release and beta geckoview .aar files in our
  # gradle-dependencies directory to be sure that only the one we provide is
  # getting used when building beta/release code. XXX: Find a way to make that
  # work for nightly, too.
  find $gradle_repo -type f \( -name geckoview-[^a-z]*.aar -o -name geckoview-beta*.aar \) -exec cp -f $distdir/geckoview/geckoview*.aar {} \;
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
  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 and just copy over the projects that are needed
  # according to the Gradle dependencies list.
  cp -rf $distdir/application-services/maven/org $gradle_repo
[% END %]
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz

cd $builddir-[% c('version') %]
patch -p1 < $rootdir/git.patch
[% IF c("var/fetch_gradle_dependencies") %]
  # XXX: fetching deps for `assembleGeckoBeta -x lint` by using that same target
  # results in some missing dependencies for yet unknown reasons. Thus, we use
  # `assemble` instead for now.
  gradle --debug -no-daemon assemble
[% ELSE %]
36 37 38 39 40 41
  # 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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
  patch -p1 < $rootdir/mavenLocal.patch

  gradle_args="--offline --no-daemon -Dmaven.repo.local=$gradle_repo"

  gradle $gradle_args assembleGeckoBeta -x lint
  gradle $gradle_args publish

  find components -regex '.*[0-9].\(aar\|pom\)' -exec cp --parents {} $distdir \;

  # Package
  cd $distdir
  find components -type d -name maven -exec cp -rf {} [% project %] \;
  [% c('tar', {
        tar_src => [ project ],
        tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
    }) %]
[% END %]