[Android] Allow specifying the maven local repository path and use it in the CI

Nicolas Pomepuy git at videolan.org
Mon May 3 06:24:55 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon May  3 07:11:28 2021 +0200| [7a6420283f806f7fe5f41d307db0f5f0106e6092] | committer: Nicolas Pomepuy

Allow specifying the maven local repository path and use it in the CI

> https://code.videolan.org/videolan/vlc-android/commit/7a6420283f806f7fe5f41d307db0f5f0106e6092
---

 buildsystem/compile.sh            | 33 +++++++++++++++++++--------------
 buildsystem/gitlab/.gitlab-ci.yml |  4 ++--
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 787d39bab..0b57a0197 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -60,6 +60,7 @@ while [ $# -gt 0 ]; do
             echo "Use -c to get a ChromeOS build"
             echo "Use -l to build only LibVLC"
             echo "Use -b to bypass libvlc source checks (vlc custom sources)"
+            echo "Use -m2 to set the maven local repository path to use"
             exit 0
             ;;
         a|-a)
@@ -81,6 +82,10 @@ while [ $# -gt 0 ]; do
             PASSWORD_KEYSTORE=$2
             shift
             ;;
+        -m2|--local-maven)
+            M2_REPO=$2
+            shift
+            ;;
         -l)
             BUILD_LIBVLC=1
             NO_ML=1
@@ -100,10 +105,6 @@ while [ $# -gt 0 ]; do
         --no-ml)
             NO_ML=1
             ;;
-        --publish)
-            RELEASE=1
-            PUBLISH=1
-            ;;
         --init)
             GRADLE_SETUP=1
             ;;
@@ -148,6 +149,16 @@ else
     exit 1
 fi
 
+if [ -z "$M2_REPO" ]; then
+  M2_REPO=""
+else
+  if test -d "$M2_REPO"; then
+    echo "Custom local maven repository found"
+  else
+    diagnostic "Invalid local maven repository path: $M2_REPO"
+    exit 1
+  fi
+fi
 ####################
 # Configure gradle #
 ####################
@@ -383,17 +394,11 @@ elif [ "$RELEASE" = 1 ]; then
 fi
 
 if [ "$BUILD_LIBVLC" = 1 ];then
-    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc assemble${BUILDTYPE}
+    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" GRADLE_ABI=$GRADLE_ABI ./gradlew -Dmaven.repo.local=$M2_REPO -p libvlc assemble${BUILDTYPE}
     RUN=0
-    if [ "$PUBLISH" = 1 ];then
-        GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc install bintrayUpload
-    fi
 elif [ "$BUILD_MEDIALIB" = 1 ]; then
-    GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary assemble${BUILDTYPE}
+    GRADLE_ABI=$GRADLE_ABI ./gradlew -Dmaven.repo.local=$M2_REPO -p medialibrary assemble${BUILDTYPE}
     RUN=0
-    if [ "$PUBLISH" = 1 ];then
-        GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary install bintrayUpload
-    fi
 else
     if [ "$TEST" = 1 -o "$RUN" = 1 ]; then
         ACTION="install"
@@ -401,11 +406,11 @@ else
         ACTION="assemble"
     fi
     TARGET="${ACTION}${BUILDTYPE}"
-    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew $TARGET
+    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew -Dmaven.repo.local=$M2_REPO $TARGET
 
     if [ "$TEST" = 1 ]; then
         TARGET="application:vlc-android:install${BUILDTYPE}AndroidTest"
-        GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew $TARGET
+        GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew -Dmaven.repo.local=$M2_REPO $TARGET
 
         echo -e "\n===================================\nRun following for UI tests:"
         echo "adb shell am instrument -w -e package org.videolan.vlc.gui org.videolan.vlc.debug.test/org.videolan.vlc.MultidexTestRunner 1> result_UI_test.txt"
diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index d9e701896..6108c646a 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -157,9 +157,9 @@ publish_libs:
         M2_REPO: "$CI_PROJECT_DIR/aars/repository"
     script:
         - mkdir -p $M2_REPO
-        - ./buildsystem/compile.sh -l -a ${ARCH} release
+        - ./buildsystem/compile.sh -l -a ${ARCH} -m2 $M2_REPO release
         - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p libvlc publishToMavenLocal
-        - ./buildsystem/compile.sh -ml -a ${ARCH} release
+        - ./buildsystem/compile.sh -ml -a ${ARCH} -m2 $M2_REPO release
         - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p medialibrary publishToMavenLocal
     artifacts:
         name: "${CI_COMMIT_TAG}.dbg"



More information about the Android mailing list