[tor-commits] [tor-browser-build/master] Bug 40172: Simplify gradle's project support for mutliple versions

sysrqb at torproject.org sysrqb at torproject.org
Tue Mar 16 21:50:16 UTC 2021


commit df9fb9628f45f8ed418d7141d57d7ec00a6bed08
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Thu Mar 4 19:12:05 2021 +0100

    Bug 40172: Simplify gradle's project support for mutliple versions
---
 projects/android-components/build    |  3 ---
 projects/android-components/config   |  1 +
 projects/android-toolchain/config    |  8 +++++++-
 projects/application-services/build  |  3 ---
 projects/application-services/config |  6 +-----
 projects/gradle/build                |  2 +-
 projects/gradle/config               | 14 +++++++-------
 7 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/projects/android-components/build b/projects/android-components/build
index 6c62a6c..279525c 100644
--- a/projects/android-components/build
+++ b/projects/android-components/build
@@ -7,9 +7,6 @@ mkdir $distdir/[% project %]
 mkdir /var/tmp/build
 
 tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-# XXX: Not needed once we are done with moving Gradle out of our toolchain
-# project.
-export PATH=$GRADLE_HOME/gradle/bin:$PATH
 
 cat > get-moz-build-date << "EOF"
 [% INCLUDE "get-moz-build-date" %]
diff --git a/projects/android-components/config b/projects/android-components/config
index fbba9bc..b941e12 100644
--- a/projects/android-components/config
+++ b/projects/android-components/config
@@ -17,6 +17,7 @@ var:
   # Switch to make it easier to grab all dependencies during a dry-run.
   # Note: Use the commit before support for new GeckoView interfaces gets added.
   fetch_gradle_dependencies: 0
+  gradle_version: 6.6.1
 
 targets:
   nightly:
diff --git a/projects/android-toolchain/config b/projects/android-toolchain/config
index 5268319..f3214ab 100644
--- a/projects/android-toolchain/config
+++ b/projects/android-toolchain/config
@@ -19,7 +19,13 @@ var:
     export GRADLE_HOME=/var/tmp/dist/[% project %]/gradle
     export ANDROID_HOME=$ANDROID_SDK_HOME
     export GRADLE_USER_HOME=$GRADLE_HOME
-    export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle-[% c("var/gradle564") %]/bin
+    # In the PATH we set $GRADLE_HOME/gradle/bin (not included in
+    # android-toolchain) before $GRADLE_HOME/gradle-[% c("var/gradle564") %]/bin
+    # (which is included in android-toolchain)).
+    #
+    # Project which need a specific gradle version can use the gradle
+    # project and extract it in $GRADLE_HOME/gradle/bin
+    export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$GRADLE_HOME/gradle/bin:$GRADLE_HOME/gradle-[% c("var/gradle564") %]/bin
   google_repo: https://dl.google.com/android/repository
   android_api_level: 29
   android_platform_revision: 04
diff --git a/projects/application-services/build b/projects/application-services/build
index 8cf98a8..24a66f8 100644
--- a/projects/application-services/build
+++ b/projects/application-services/build
@@ -7,9 +7,6 @@ mkdir $distdir
 mkdir /var/tmp/build
 
 tar -C $GRADLE_HOME -xf $rootdir/[% c('input_files_by_name/gradle') %]
-# XXX: Not needed once we are done with moving Gradle out of our toolchain
-# project.
-export PATH=$GRADLE_HOME/gradle/bin:$PATH
 cd /var/tmp/dist
 [% FOREACH arch = ['armv7', 'aarch64', 'x86', 'x86_64'] -%]
   tar -xf $rootdir/[% c('input_files_by_name/nss-' _ arch) %]
diff --git a/projects/application-services/config b/projects/application-services/config
index 4c0d184..11fc5d7 100644
--- a/projects/application-services/config
+++ b/projects/application-services/config
@@ -12,15 +12,11 @@ var:
   gradle_dependencies_version: 4
   # This should be updated when the list of rust dependencies is changed.
   rust_vendor_version: 3
-  # For armv7 we need a different target than the default one we use for
-  # GeckoView. We set this variable so the Rust project in the `input_files`
-  # below can set the correct target when built for use in this project,
-  # querying `origin_project`.
-  application_services: 1
   # Switch to make it easier to grab all dependencies during a dry-run.
   fetch_gradle_dependencies: 0
   # application-services is still stuck on an older glean_parser version.
   glean_parser: 1.28.6
+  gradle_version: 6.5
 
 input_files:
   - project: container-image
diff --git a/projects/gradle/build b/projects/gradle/build
index 06ea3c6..adb5233 100644
--- a/projects/gradle/build
+++ b/projects/gradle/build
@@ -1,7 +1,7 @@
 #!/bin/bash
 [% c("var/set_default_env") -%]
 unzip -qq [% c("input_files_by_name/gradle") %]
-mv [% project %]-[% c("var/gradle_version") %] [% project %]
+mv [% project %]-[% c("version") %] [% project %]
 [% c('tar', {
         tar_src => [ project ],
         tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
diff --git a/projects/gradle/config b/projects/gradle/config
index 4414436..4ad4a16 100644
--- a/projects/gradle/config
+++ b/projects/gradle/config
@@ -1,18 +1,18 @@
 # vim: filetype=yaml sw=2
-filename: '[% project %]-[% c("var/gradle_version") %].tar.gz'
+filename: '[% project %]-[% c("version") %].tar.gz'
+version: '[% pc(c("origin_project"), "var/gradle_version", { error_if_undef => 1 }) %]'
 
 var:
   container:
     use_container: 1
   deps:
     - unzip
-  # XXX: Think about ways to make this more legible, in particular once more
-  # Gradle versions get added.
-  gradle_version: '[% IF pc(c("origin_project"), "var/application_services") %]6.5[% ELSE %]6.6.1[% END %]'
-  gradle_sha256sum: '[% IF pc(c("origin_project"), "var/application_services") %]23e7d37e9bb4f8dabb8a3ea7fdee9dd0428b9b1a71d298aefd65b11dccea220f[% ELSE %]7873ed5287f47ca03549ab8dcb6dc877ac7f0e3d7b1eb12685161d10080910ac[% END %]'
+  gradle_sha256sum:
+    6.5: 23e7d37e9bb4f8dabb8a3ea7fdee9dd0428b9b1a71d298aefd65b11dccea220f
+    6.6.1: 7873ed5287f47ca03549ab8dcb6dc877ac7f0e3d7b1eb12685161d10080910ac
 
 input_files:
   - project: container-image
-  - URL: https://services.gradle.org/distributions/gradle-[% c("var/gradle_version") %]-bin.zip
+  - URL: https://services.gradle.org/distributions/gradle-[% c("version") %]-bin.zip
     name: gradle
-    sha256sum: '[% c("var/gradle_sha256sum") %]'
+    sha256sum: '[% c("var/gradle_sha256sum/" _ c("version"), { error_if_undef => 1 }) %]'





More information about the tor-commits mailing list