Browse Source

gradlew-fdroid: fix parsing when files have Windows linefeeds

The new test file should have Windows linefeeds, if I got the git config
correct.
merge-requests/753/head
Hans-Christoph Steiner 6 months ago
parent
commit
7a84679b0d
3 changed files with 14 additions and 0 deletions
  1. +3
    -0
      gradlew-fdroid
  2. +6
    -0
      tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties
  3. +5
    -0
      tests/test-gradlew-fdroid

+ 3
- 0
gradlew-fdroid 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

+ 6
- 0
tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties 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

+ 5
- 0
tests/test-gradlew-fdroid 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

Loading…
Cancel
Save