diff --git a/buildsystem/get-contrib-rebuild.sh b/buildsystem/get-contrib-rebuild.sh new file mode 100755 index 0000000000000000000000000000000000000000..b0fb50a6bd79db7be3824209c35653b772a74268 --- /dev/null +++ b/buildsystem/get-contrib-rebuild.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Returns 0 if the prebuilt contrib can be used +set -e + +# Print error message and terminate script with status 1 +# Arguments: +# Message to print +abort_err() +{ + echo "ERROR: $1" >&2 + exit 1 +} + +command -v "git" >/dev/null 2>&1 || abort_err "Git was not found!" + +# VLC source root directory +LIBVLCJNI_SRC_ROOT_DIR=$(git rev-parse --show-toplevel) + +[ -n "${LIBVLCJNI_SRC_ROOT_DIR}" ] || abort_err "This script must be run in the libvlcjni Git repo and git must be available" +[ -f "${LIBVLCJNI_SRC_ROOT_DIR}/libvlc/jni/Android.mk" ] || abort_err "This script must be run in the libvlcjni Git repository" + +REFERENCE_BRANCH="$1" +[ -n "${REFERENCE_BRANCH}" ] || abort_err "Missing reference branch argument (origin/master ?)" + +# Check if files were changed in the buildsystem +ALL_CHANGES=$(git diff --name-only "${REFERENCE_BRANCH}") +BUILDSYSTEM_CHANGED=$(echo "${ALL_CHANGES}" | grep ^buildsystem/) + +if [ -n "${BUILDSYSTEM_CHANGED}" ]; then + # The buildsystem has been modified, we need to rebuild contribs + exit 1 +fi + +exit 0 diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml index ad566e0df5331d8539d173608fce7dded480ee6a..599fcecc890ef06d99b063fd32be6fdd8cc10a2a 100644 --- a/buildsystem/gitlab/.gitlab-ci.yml +++ b/buildsystem/gitlab/.gitlab-ci.yml @@ -21,9 +21,11 @@ stages: script: | rm -rf vlc ./buildsystem/get-vlc.sh - export VLC_CONTRIB_SHA="$(cd vlc && extras/ci/get-contrib-sha.sh android-${ARCH})" - export VLC_PREBUILT_CONTRIBS_URL="https://artifacts.videolan.org/vlc/android-${ARCH}/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.bz2" - if vlc/extras/ci/check-url.sh "$VLC_PREBUILT_CONTRIBS_URL"; then CONTRIB_FLAGS="--with-prebuilt-contribs"; fi + if [ ! buildsystem/get-contrib-rebuild.sh "${CI_DEFAULT_BRANCH}" ]; then + export VLC_CONTRIB_SHA="$(cd vlc && extras/ci/get-contrib-sha.sh android-${ARCH})" + export VLC_PREBUILT_CONTRIBS_URL="https://artifacts.videolan.org/vlc/android-${ARCH}/vlc-contrib-${TRIPLET}-${VLC_CONTRIB_SHA}.tar.bz2" + if vlc/extras/ci/check-url.sh "$VLC_PREBUILT_CONTRIBS_URL"; then CONTRIB_FLAGS="--with-prebuilt-contribs"; fi + fi ./buildsystem/compile-libvlc.sh -a ${ARCH} $CONTRIB_FLAGS rules: # Explicitely refuse to build anything that would also trigger