jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/368118 )

Change subject: Update testing scripts to accept Android SDK location argument
......................................................................


Update testing scripts to accept Android SDK location argument

Updates our non-periodic testing job scripts to accept an optional
command line argument containing the location of an Android SDK
installation.  This can be configured at the job level in Jenkins.
(The jobs have been updated accordingly in Jenkins via the web UI but
this change should be memorialized in the integration/config repo.)

Bug: T171811
Change-Id: If5801d0556e6d084e236136e9b2957a7cef32538
---
M scripts/apps-android-wikipedia-publish
M scripts/apps-android-wikipedia-test
A scripts/jenkins_sdk_setup
3 files changed, 40 insertions(+), 5 deletions(-)

Approvals:
  Dbrant: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/apps-android-wikipedia-publish 
b/scripts/apps-android-wikipedia-publish
index c2081f0..d4f522c 100755
--- a/scripts/apps-android-wikipedia-publish
+++ b/scripts/apps-android-wikipedia-publish
@@ -1,8 +1,14 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
-export ANDROID_HOME="$PWD/.sdk"
-declare START_TIME="$(date +"%Y-%m-%dT%H:%M:%S.%N")"
+# For use with Jenkins CI, pass the Android SDK location as an argument:
+# $ apps-android-wikipedia-publish /srv/jenkins-workspace/tools/android-sdk
+if [ ! $# -eq 0 ]; then
+  echo "org.gradle.jvmargs=-Xmx1536M" >> gradle.properties
+  export ANDROID_HOME="${1}"
+  scripts/jenkins_sdk_setup "${ANDROID_HOME}"
+fi
 
+declare START_TIME="$(date +"%Y-%m-%dT%H:%M:%S.%N")"
 ./gradlew -q clean assembleAlphaRelease
 echo "{\"commit_hash\": \"$GIT_COMMIT\", \"completed_on\": \"$START_TIME\"}" > 
meta.json
diff --git a/scripts/apps-android-wikipedia-test 
b/scripts/apps-android-wikipedia-test
index 7b741bf..f9957ca 100755
--- a/scripts/apps-android-wikipedia-test
+++ b/scripts/apps-android-wikipedia-test
@@ -1,8 +1,13 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
+# For use with Jenkins CI, pass the Android SDK location as an argument:
+# $ apps-android-wikipedia-test /srv/jenkins-workspace/tools/android-sdk
+if [ ! $# -eq 0 ]; then
+  echo "org.gradle.jvmargs=-Xmx1536M" >> gradle.properties
+  export ANDROID_HOME="${1}"
+  scripts/jenkins_sdk_setup "${ANDROID_HOME}"
+fi
+
 scripts/missing-qq.py
-
-export ANDROID_HOME="$PWD/.sdk"
-
 ./gradlew clean checkstyle assembleAlphaRelease lintAlphaRelease 
testAlphaRelease compileAlphaReleaseAndroidTestSources
diff --git a/scripts/jenkins_sdk_setup b/scripts/jenkins_sdk_setup
new file mode 100755
index 0000000..8db6fb1
--- /dev/null
+++ b/scripts/jenkins_sdk_setup
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+JENKINS_TOOLS_DIR="/srv/jenkins-workspace/tools"
+
+ANDROID_HOME="${1:-$JENKINS_TOOLS_DIR/android-sdk}"
+
+if [ ! -d "${ANDROID_HOME}" ]; then
+  if [ ! -d "${JENKINS_TOOLS_DIR}" ]; then
+    printf "\n$0: Neither ANDROID_HOME nor Jenkins workspace tools directory 
found; aborting." >&2
+    exit 1
+  fi
+  printf "\nCreating ANDROID_HOME at ${ANDROID_HOME}.\n" >&2
+  mkdir "${ANDROID_HOME}"
+fi
+
+LICENSE_DIR="${ANDROID_HOME}/licenses"
+
+if [ ! -d "${LICENSE_DIR}" ]; then
+  printf "\nCreating license directory at ${LICENSE_DIR}.\n" >&2
+  mkdir "${LICENSE_DIR}"
+fi
+
+cp -v .sdk/licenses/* "${LICENSE_DIR}"

-- 
To view, visit https://gerrit.wikimedia.org/r/368118
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If5801d0556e6d084e236136e9b2957a7cef32538
Gerrit-PatchSet: 20
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to