gradlew-fdroid: fix parsing when files have Windows linefeeds

The new test file should have Windows linefeeds, if I got the git config
correct.
This commit is contained in:
Hans-Christoph Steiner 2020-05-29 21:55:10 +02:00
parent fc885c9b5c
commit 7a84679b0d
3 changed files with 14 additions and 0 deletions

View File

@ -168,6 +168,7 @@ for f in {.,..}/gradle/wrapper/gradle-wrapper.properties; do
if [[ $line == 'distributionUrl='* ]]; then
wrapper_ver=${line#*/gradle-}
wrapper_ver=${wrapper_ver%-*.zip}
wrapper_ver=$(printf $wrapper_ver | tr -d '\r') # strip Windows linefeeds
break 2
fi
done < $f
@ -186,9 +187,11 @@ for f in {.,..}/build.gradle{,.kts}; do
if [[ -z "$plugin_pver" && $line == *'com.android.tools.build:gradle:'* ]]; then
plugin_pver=${line#*[\'\"]com.android.tools.build:gradle:}
plugin_pver=${plugin_pver%[\'\"]*}
plugin_pver=$(printf $plugin_pver | tr -d '\r') # strip Windows linefeeds
elif [[ -z "$wrapper_ver" && $line == *'gradleVersion = '* ]]; then
wrapper_ver=${line#*gradleVersion*=*[\'\"]}
wrapper_ver=${wrapper_ver%[\'\"]*}
wrapper_ver=$(printf $wrapper_ver | tr -d '\r') # strip Windows linefeeds
fi
done < $f
done

View File

@ -0,0 +1,6 @@
#Wed Jan 30 10:59:12 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

View File

@ -19,8 +19,13 @@ exit_value=0
basedir=$(cd $(dirname $0)/..; pwd)
export https_proxy=127.7.7.7:7 # fake proxy to block downloading
# force test file to have Windows linefeeds
sed -i -e $'s/\r$//' -e $'s/$/\r/' \
$basedir/tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties
run_test osmandapp/osmand 2.2.1
run_test com.integreight.onesheeld 3.3
run_test se.manyver/android 5.5
run_test yuriykulikov/AlarmClock 5.1.1
exit $exit_value