[tor-commits] [tor-browser-build/master] Bug 28470: Add fetch gradle dependency script to common project

gk at torproject.org gk at torproject.org
Fri Nov 16 11:14:44 UTC 2018


commit 873289e271fb88c47e1c5738b66a37b723e74ee2
Author: sisbell <shane.isbell at gmail.com>
Date:   Fri Nov 16 11:12:30 2018 +0000

    Bug 28470: Add fetch gradle dependency script to common project
    
    The script got written by boklm.
---
 projects/common/fetch-gradle-dependencies          | 19 ++++++++++++++
 .../how-to-create-gradle-dependencies-list.txt     | 30 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/projects/common/fetch-gradle-dependencies b/projects/common/fetch-gradle-dependencies
new file mode 100644
index 0000000..0acd38a
--- /dev/null
+++ b/projects/common/fetch-gradle-dependencies
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+# Bug 28117: setting LC_ALL=C is causing wget to fail downloading some URLs
+unset LC_ALL
+cd "[% dest_dir %]"
+m2dir="$(mktemp -d)"
+[% USE artifacts = datafile(c('basedir') _ '/projects/' _ project _ '/gradle-dependencies-list.txt', delim = '|') %]
+[% FOREACH artifact = artifacts %]
+    artifact_path=$(echo "[% artifact.url %]" | sed 's|^https://[^/]\+/||')
+    artifact_filename=$(basename "$artifact_path")
+    artifact_dirname=$(dirname "$artifact_path")
+    [% GET c("urlget", { filename => 'downloaded_file', URL => artifact.url}); %]
+    echo "[% artifact.sha256sum %]  downloaded_file" | sha256sum -c
+    mkdir -p "$m2dir/$artifact_dirname"
+    mv -f downloaded_file "$m2dir/$artifact_dirname/$artifact_filename"
+[% END -%]
+echo "Finished downloading gradle dependencies"
+mkdir -p "[% dest_dir %]"
+mv -f "$m2dir" "[% dest_dir %]/gradle-dependencies-[% c("var/gradle_dependencies_version") %]"
diff --git a/projects/common/how-to-create-gradle-dependencies-list.txt b/projects/common/how-to-create-gradle-dependencies-list.txt
new file mode 100644
index 0000000..ef816d0
--- /dev/null
+++ b/projects/common/how-to-create-gradle-dependencies-list.txt
@@ -0,0 +1,30 @@
+### Updating Gradle Dependencies
+If additional Android dependencies are required by the project's build, then
+the Gradle build will fail due to missing dependencies. To find out what the
+missing dependencies are, comment out the following line in the project's build
+file:
+
+   export GRADLE_MAVEN_REPOSITORIES="file://$rootdir/[% c('input_files_by_name/gradle-dependencies') %]"
+
+and rerun the build.
+
+Dependent artifacts will show up as downloads in the logs. You can pull out
+these dependencies into a list with the following command (replacing
+"firefox-android-armv7.log" with the build log file name of the actual project):
+
+`cat logs/firefox-android-armv7.log | grep "Download http" | sed "s/^.*Download //g" > download-urls.txt`
+
+You will then need to add the new dependency URLs and SHA-256 values into the
+projects/$project/gradle-dependencies-list.txt file. The format of this file is
+pipe delimited
+   sha256sum | url
+
+Finally, in the project's config file increment the
+var/gradle_dependencies_version and make sure to restore the project's build
+file back to original.
+
+It may also be the case that you wish to clean up old versions of the artifacts.
+For this you will need to run the build with a
+gradle-dependencies-list.txt file containing only the headers. Make sure to also
+comment the GRADLE_MAVEN_REPOSITORIES line from the project's build file. You
+can now proceed to reconstruct the list as given above.



More information about the tor-commits mailing list