From 8a89606c755a45f71b26a83009f3c5518640b1e6 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Mar 2020 11:20:12 +0100 Subject: [PATCH 1/2] Pin Android Components version. --- buildSrc/src/main/java/AndroidComponents.kt | 7 +++++++ buildSrc/src/main/java/Dependencies.kt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 buildSrc/src/main/java/AndroidComponents.kt diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt new file mode 100644 index 000000000..b67e6d4e4 --- /dev/null +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +object AndroidComponents { + const val VERSION = "35.0.20200303130104" +} diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index bda1195e3..53f62e121 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -16,7 +16,7 @@ private object Versions { const val android_gradle_plugin = "3.4.1" - const val mozilla_android_components = "+" // Always use the latest snapshot + const val mozilla_android_components = AndroidComponents.VERSION const val thirdparty_sentry = "1.7.10" From fbbd8135800259f2d7afc18300b55c7a983f02dd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 4 Mar 2020 11:20:24 +0100 Subject: [PATCH 2/2] Add script for updating Android Components version. --- .../taskcluster/update_android_components.sh | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 automation/taskcluster/update_android_components.sh diff --git a/automation/taskcluster/update_android_components.sh b/automation/taskcluster/update_android_components.sh new file mode 100755 index 000000000..0352a3ba9 --- /dev/null +++ b/automation/taskcluster/update_android_components.sh @@ -0,0 +1,56 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# If a command fails then do not proceed and fail this script too. +set -ex + +# Install dependencies (TODO: Move to Docker image) +apt-get install -y brew +brew install hub + +BRANCH="ac-update" +USER="MickeyMoz" +EMAIL="sebastian@mozilla.com" +REPO="reference-browser" + +git config --global user.email $EMAIL +git config --global user.name $USER + +# Fetching latest version +LATEST_VERSION=`curl https://nightly.maven.mozilla.org/maven2/org/mozilla/components/browser-engine-gecko-nightly/maven-metadata.xml | sed -ne '/latest/{s/.*\(.*\)<\/latest>.*/\1/p;q;}'` + +# Updating version file +sed -i "s/VERSION = \".*\"/VERSION = \"$LATEST_VERSION\"/g" "buildSrc/src/main/java/AndroidComponents.kt" + +# Create a branch and commit local changes +git checkout -b $BRANCH +git add buildSrc/src/main/java/AndroidComponents.kt +git commit -m \ + "Update Android Components version to $LATEST_VERSION." \ + --author="MickeyMoz " \ +|| { echo "No new Android Components version ($LATEST_VERSTION) available"; exit 0; } + +# Get token for using GitHub +python automation/taskcluster/helper/get-secret.py \ + -s project/mobile/github \ + -k botAccountToken \ + -f .github_token \ + +# From here on we do not want to print the commands since they contain tokens +set +x + +GITHUB_TOKEN=`cat .github_token` +URL="https://$USER:$GITHUB_TOKEN@github.com/$USER/$REPO/" + +# Push changes to GitHub +echo "Pushing branch to GitHub" +git push -f --no-verify --quiet $URL $BRANCH > /dev/null 2>&1 || echo "Failed ($?)" + +# Open a PR if needed +if [[ $(hub pr list -h $USER:$BRANCH) ]]; then + echo "There's already an open PR." +else + echo "No PR found. Opening new PR." + hub pull-request -b master -h MickeyMoz:ac-update --no-edit -m "Update Android Components version" +fi