mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
gradlew-fdroid: more robust method for handling Windows linefeeds
The bash pattern matching was getting confused by the Windows linefeeds, this strips them before the string hits the bash pattern tricks. * https://github.com/premnirmal/StockTicker/issues/145
This commit is contained in:
parent
10fa912c16
commit
2858c73b87
@ -167,10 +167,10 @@ v_all=${plugin_v[@]}
|
||||
for f in {.,..}/gradle/wrapper/gradle-wrapper.properties; do
|
||||
[[ -f $f ]] || continue
|
||||
while IFS='' read -r line || [ -n "$line" ]; do
|
||||
line=$(printf $line | tr -d '\r') # strip Windows linefeeds
|
||||
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,14 +186,13 @@ fi
|
||||
for f in {.,..}/build.gradle{,.kts}; do
|
||||
[[ -f $f ]] || continue
|
||||
while IFS='' read -r line || [ -n "$line" ]; do
|
||||
line=$(printf $line | tr -d '\r') # strip Windows linefeeds
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user