From 7a84679b0d7afaffd244ff71191443a9b56446c8 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 29 May 2020 21:55:10 +0200 Subject: [PATCH] gradlew-fdroid: fix parsing when files have Windows linefeeds The new test file should have Windows linefeeds, if I got the git config correct. --- gradlew-fdroid | 3 +++ .../AlarmClock/gradle/wrapper/gradle-wrapper.properties | 6 ++++++ tests/test-gradlew-fdroid | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew-fdroid b/gradlew-fdroid index 7664b1aa..97cd5394 100755 --- a/gradlew-fdroid +++ b/gradlew-fdroid @@ -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 diff --git a/tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties b/tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..a7a1a8ca --- /dev/null +++ b/tests/source-files/yuriykulikov/AlarmClock/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/tests/test-gradlew-fdroid b/tests/test-gradlew-fdroid index d7f9884b..2a34f971 100755 --- a/tests/test-gradlew-fdroid +++ b/tests/test-gradlew-fdroid @@ -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