mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-02 09:10:11 +02:00
gradlew-fdroid: use gradle zipballs from local cachedir, if present
This commit is contained in:
parent
4b05854ffc
commit
cc3b88ab30
@ -143,6 +143,20 @@ arch_pip_install:
|
||||
- fdroid readmeta
|
||||
- fdroid update --help
|
||||
|
||||
|
||||
gradlew-fdroid:
|
||||
image: debian:bullseye
|
||||
<<: *apt-template
|
||||
only:
|
||||
changes:
|
||||
- .gitlab-ci.yml
|
||||
- gradlew-fdroid
|
||||
- tests/test-gradlew-fdroid
|
||||
script:
|
||||
- apt-get install ca-certificates curl default-jdk-headless unzip
|
||||
- ./tests/test-gradlew-fdroid
|
||||
|
||||
|
||||
lint_format_safety_bandit_checks:
|
||||
image: alpine:3.10 # cannot upgrade until bandit supports Python 3.8
|
||||
variables:
|
||||
@ -154,7 +168,6 @@ lint_format_safety_bandit_checks:
|
||||
- export EXITVALUE=0
|
||||
- function set_error() { export EXITVALUE=1; printf "\x1b[31mERROR `history|tail -2|head -1|cut -b 6-500`\x1b[0m\n"; }
|
||||
- ./hooks/pre-commit || set_error
|
||||
- ./tests/test-gradlew-fdroid || set_error
|
||||
- bandit
|
||||
-ii
|
||||
-s B110,B322,B404,B408,B410,B603,B607
|
||||
|
@ -8,8 +8,11 @@ if [ -z "$GRADLE_VERSION_DIR" ]; then
|
||||
else
|
||||
gradle_version_dir="$GRADLE_VERSION_DIR"
|
||||
fi
|
||||
BUILDSERVER_CACHEDIR=/vagrant/cache
|
||||
if [ -n "$CACHEDIR" ]; then
|
||||
cachedir="$CACHEDIR"
|
||||
elif [ -d $BUILDSERVER_CACHEDIR ]; then
|
||||
cachedir=$BUILDSERVER_CACHEDIR
|
||||
fi
|
||||
args=("$@")
|
||||
|
||||
@ -34,11 +37,12 @@ download_gradle() {
|
||||
gradle_zip="${cachedir}/gradle-$1-bin.zip"
|
||||
else
|
||||
echo "Downloading missing gradle version $1"
|
||||
if [ -n "${cachedir}" ]; then
|
||||
tmpdir="${cachedir}"
|
||||
if [ ! -d ${tmpdir} ]; then
|
||||
echo cachedir $cachedir
|
||||
if [[ -n "${cachedir}" && ! -d "${cachedir}" ]]; then
|
||||
mkdir -p "${cachedir}"
|
||||
fi
|
||||
if [[ -n "${cachedir}" && -d "${cachedir}" && -w "${cachedir}" ]]; then
|
||||
tmpdir="${cachedir}"
|
||||
else
|
||||
tmpdir=$(mktemp -d)
|
||||
fi
|
||||
|
@ -1,9 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
run_test() {
|
||||
red='\033[0;31m'
|
||||
green='\033[0;32m'
|
||||
nocolor='\033[0m'
|
||||
|
||||
TEST_VALUE='HELLO WORLD!'
|
||||
|
||||
run_test() {
|
||||
cd $source_files/$1
|
||||
printf "\n${1}:\n"
|
||||
if ($basedir/gradlew-fdroid 2>/dev/null || true) | grep -Fo "$2"; then
|
||||
@ -15,6 +18,17 @@ run_test() {
|
||||
printf $nocolor
|
||||
}
|
||||
|
||||
download_cache_test() {
|
||||
if $basedir/gradlew-fdroid helloWorld 2>/dev/null | grep -F "$TEST_VALUE"; then
|
||||
printf "${green}passed: $1\n"
|
||||
else
|
||||
printf "${red}ERROR: \n"
|
||||
$basedir/gradlew-fdroid helloWorld
|
||||
((exit_value++))
|
||||
fi
|
||||
printf $nocolor
|
||||
}
|
||||
|
||||
exit_value=0
|
||||
basedir=$(cd $(dirname $0)/..; pwd)
|
||||
source_files=$basedir/tests/source-files
|
||||
@ -39,4 +53,23 @@ source_files=$tmpdir
|
||||
run_test yuriykulikov/AlarmClock 5.1.1
|
||||
run_test osmandapp/osmand 2.2.1
|
||||
|
||||
cd $tmpdir
|
||||
mkdir -p download_cache_test/gradle/wrapper
|
||||
cd download_cache_test
|
||||
echo 'distributionUrl=https\://services.gradle.org/distributions/gradle-0.7-bin.zip' \
|
||||
> gradle/wrapper/gradle-wrapper.properties
|
||||
printf "task helloWorld {\n\tdoLast {\n\t\tprintln '$TEST_VALUE'\n\t}\n}" > build.gradle
|
||||
|
||||
export GRADLE_VERSION_DIR=$tmpdir/gradle/versions
|
||||
mkdir -p $GRADLE_VERSION_DIR
|
||||
|
||||
unset https_proxy
|
||||
printf "download, unpack, and run: "
|
||||
download_cache_test 0.7
|
||||
printf "unpack and run: "
|
||||
rm -rf $GRADLE_VERSION_DIR/0.7/
|
||||
download_cache_test 0.7
|
||||
printf "just run: "
|
||||
download_cache_test 0.7
|
||||
|
||||
exit $exit_value
|
||||
|
Loading…
Reference in New Issue
Block a user