[tbb-commits] [builders/tor-browser-build] 01/02: Bug 40640: Extract Gradle in the toolchain setup

gitolite role git at cupani.torproject.org
Mon Oct 17 07:15:40 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch main
in repository builders/tor-browser-build.

commit 9f5c55f6c018adbaae97f8f1100d7c22c804c043
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Thu Oct 13 15:19:31 2022 +0200

    Bug 40640: Extract Gradle in the toolchain setup
---
 projects/android-components/build      |  7 ++++---
 projects/android-toolchain/config      | 11 +++++++----
 projects/application-services/build    |  6 ++++--
 projects/fenix/build                   | 13 +++++++------
 projects/geckoview/build               |  7 ++++---
 projects/geckoview/config              |  2 --
 projects/tor-android-service/build     |  6 ++++--
 projects/tor-onion-proxy-library/build |  6 ++++--
 8 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/projects/android-components/build b/projects/android-components/build
index 68c5057..093ee52 100755
--- a/projects/android-components/build
+++ b/projects/android-components/build
@@ -1,13 +1,14 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% pc(c('var/compiler'), 'var/setup', {
+    compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+    gradle_tarfile => c("input_files_by_name/gradle"),
+  }) %]
 distdir=/var/tmp/dist
 builddir=/var/tmp/build/[% project %]
 mkdir $distdir/[% project %]
 mkdir /var/tmp/build
 
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-
 cat > get-moz-build-date << "EOF"
 [% INCLUDE "get-moz-build-date" %]
 EOF
diff --git a/projects/android-toolchain/config b/projects/android-toolchain/config
index a2f34ae..374cf88 100644
--- a/projects/android-toolchain/config
+++ b/projects/android-toolchain/config
@@ -22,10 +22,13 @@ var:
     export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME
     export ANDROID_NDK_API_VERSION=[% c("var/android_ndk_version") %][% c('var/android_ndk_revision') %]
     export NDK_HOST_TAG=linux-x86_64
-    export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
-    export GRADLE_USER_HOME=$GRADLE_HOME
-    export PATH=$PATH:$ANDROID_HOME/build-tools/[% c("var/version_31") %]:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle/bin
-    mkdir -p "$GRADLE_HOME"
+    export PATH=$PATH:$ANDROID_HOME/build-tools/[% c("var/version_31") %]:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
+    [% IF c("gradle_tarfile") -%]
+      tar -C /var/tmp/dist/[% project %] -xf $rootdir/[% c("gradle_tarfile") %]
+      export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
+      export GRADLE_USER_HOME=$GRADLE_HOME
+      export PATH=$PATH:$GRADLE_HOME/bin
+    [% END -%]
   google_repo: https://dl.google.com/android/repository
   android_api_level: 31
   android_platform_revision: 01
diff --git a/projects/application-services/build b/projects/application-services/build
index d4b1098..810e84c 100755
--- a/projects/application-services/build
+++ b/projects/application-services/build
@@ -1,12 +1,14 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% pc(c('var/compiler'), 'var/setup', {
+    compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+    gradle_tarfile => c("input_files_by_name/gradle"),
+  }) %]
 distdir=/var/tmp/dist/[% project %]
 builddir=/var/tmp/build/[% project %]
 mkdir $distdir
 mkdir /var/tmp/build
 
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
 cd /var/tmp/dist
 [% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64', 'linux-x86_64'] -%]
   tar -xf $rootdir/[% c('input_files_by_name/nss-' _ arch) %]
diff --git a/projects/fenix/build b/projects/fenix/build
index 3306e3d..a16b609 100755
--- a/projects/fenix/build
+++ b/projects/fenix/build
@@ -1,13 +1,14 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% pc(c('var/compiler'), 'var/setup', {
+    compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+    gradle_tarfile => c("input_files_by_name/gradle"),
+  }) %]
 distdir=/var/tmp/dist
 builddir=/var/tmp/build/[% project %]
 mkdir -p $distdir/[% project %]
 mkdir -p /var/tmp/build
 
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-
 cat > get-moz-build-date << "EOF"
 [% INCLUDE "get-moz-build-date" %]
 EOF
@@ -48,7 +49,7 @@ sed -i 's/\\"${Config.getGitHash()}\\"/\\"[% c('abbrev') %]\\"/' app/build.gradl
 # XXX We need the build variant in lower case. Do something smarter here.
 v=[% c("variant") %]
 [% IF c("var/fetch_gradle_dependencies") %]
-  $GRADLE_HOME/gradle/bin/gradle --debug --no-daemon app:assemble[% c('variant') %] \
+  $GRADLE_HOME/bin/gradle --debug --no-daemon app:assemble[% c('variant') %] \
     app:assembleAndroidTest -x lint -PtestBuildType=${v,} -PdisableOptimization \
     > gradle.log 2>&1 \
     || ( cat gradle.log; exit 1 )
@@ -85,8 +86,8 @@ v=[% c("variant") %]
   version_name='[% c("var/fenix_version") %]-[% c("variant") %] ([% c("var/torbrowser_version") %])'
   # We need -PdisableOptimization for building tests. See:
   # https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/issues/40259#note_2732325
-  $GRADLE_HOME/gradle/bin/gradle --offline --no-daemon -PversionName="$version_name" -Dmaven.repo.local=$gradle_repo app:assemble[% c('variant') %] -x lint -PtestBuildType=${v,}
-  $GRADLE_HOME/gradle/bin/gradle --offline --no-daemon -PversionName="$version_name" -Dmaven.repo.local=$gradle_repo app:assembleAndroidTest -x lint -PtestBuildType=${v,} -PdisableOptimization
+  $GRADLE_HOME/bin/gradle --offline --no-daemon -PversionName="$version_name" -Dmaven.repo.local=$gradle_repo app:assemble[% c('variant') %] -x lint -PtestBuildType=${v,}
+  $GRADLE_HOME/bin/gradle --offline --no-daemon -PversionName="$version_name" -Dmaven.repo.local=$gradle_repo app:assembleAndroidTest -x lint -PtestBuildType=${v,} -PdisableOptimization
   cp app/build/outputs/apk/${v,}/*.apk $distdir/[% project %]
   cp app/build/outputs/apk/androidTest/${v,}/app-${v,}-androidTest.apk $distdir/[% project %]
 
diff --git a/projects/geckoview/build b/projects/geckoview/build
index df8ef7c..5d2b26a 100755
--- a/projects/geckoview/build
+++ b/projects/geckoview/build
@@ -1,12 +1,13 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+[% pc(c('var/compiler'), 'var/setup', {
+        compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+        gradle_tarfile => c("input_files_by_name/gradle"),
+    }) %]
 distdir=/var/tmp/dist
 mkdir -p /var/tmp/build
 mkdir -p $distdir/[% project %]
 
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-
 # We need to have the get-moz-build-date script available in the container
 # but we can't include it via input_files as it is a script shared between
 # projects.
diff --git a/projects/geckoview/config b/projects/geckoview/config
index a1c6244..8aec9be 100644
--- a/projects/geckoview/config
+++ b/projects/geckoview/config
@@ -41,8 +41,6 @@ steps:
       mkdir -p /var/tmp/build
       mkdir -p $distdir/[% project %]
 
-      tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-
       cat > get-moz-build-date << "EOF"
       [% INCLUDE "get-moz-build-date" %]
       EOF
diff --git a/projects/tor-android-service/build b/projects/tor-android-service/build
index 4bdab9c..f59f0e5 100644
--- a/projects/tor-android-service/build
+++ b/projects/tor-android-service/build
@@ -9,8 +9,10 @@ cp -r $gradle_repo/maven2/* $gradle_repo
 
 mkdir -p /var/tmp/build $output_dir
 
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
+[% pc(c('var/compiler'), 'var/setup', {
+    compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+    gradle_tarfile => c("input_files_by_name/gradle"),
+  }) %]
 tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
 unzip -d $rootdir $rootdir/[% c('input_files_by_name/jetifier') %]
 
diff --git a/projects/tor-onion-proxy-library/build b/projects/tor-onion-proxy-library/build
index 5916fd5..c13c556 100644
--- a/projects/tor-onion-proxy-library/build
+++ b/projects/tor-onion-proxy-library/build
@@ -11,8 +11,10 @@ cp -r $gradle_repo/maven2/* $gradle_repo
 
 mkdir -p /var/tmp/build $output_dir
 
-[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
-tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
+[% pc(c('var/compiler'), 'var/setup', {
+    compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')),
+    gradle_tarfile => c("input_files_by_name/gradle"),
+  }) %]
 tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
 
 # Patch projects

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list