mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-11 01:30:30 +03: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
1 changed files with 2 additions and 3 deletions
|
|
@ -167,10 +167,10 @@ v_all=${plugin_v[@]}
|
||||||
for f in {.,..}/gradle/wrapper/gradle-wrapper.properties; do
|
for f in {.,..}/gradle/wrapper/gradle-wrapper.properties; do
|
||||||
[[ -f $f ]] || continue
|
[[ -f $f ]] || continue
|
||||||
while IFS='' read -r line || [ -n "$line" ]; do
|
while IFS='' read -r line || [ -n "$line" ]; do
|
||||||
|
line=$(printf $line | tr -d '\r') # strip Windows linefeeds
|
||||||
if [[ $line == 'distributionUrl='* ]]; then
|
if [[ $line == 'distributionUrl='* ]]; then
|
||||||
wrapper_ver=${line#*/gradle-}
|
wrapper_ver=${line#*/gradle-}
|
||||||
wrapper_ver=${wrapper_ver%-*.zip}
|
wrapper_ver=${wrapper_ver%-*.zip}
|
||||||
wrapper_ver=$(printf $wrapper_ver | tr -d '\r') # strip Windows linefeeds
|
|
||||||
break 2
|
break 2
|
||||||
fi
|
fi
|
||||||
done < $f
|
done < $f
|
||||||
|
|
@ -186,14 +186,13 @@ fi
|
||||||
for f in {.,..}/build.gradle{,.kts}; do
|
for f in {.,..}/build.gradle{,.kts}; do
|
||||||
[[ -f $f ]] || continue
|
[[ -f $f ]] || continue
|
||||||
while IFS='' read -r line || [ -n "$line" ]; do
|
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
|
if [[ -z "$plugin_pver" && $line == *'com.android.tools.build:gradle:'* ]]; then
|
||||||
plugin_pver=${line#*[\'\"]com.android.tools.build:gradle:}
|
plugin_pver=${line#*[\'\"]com.android.tools.build:gradle:}
|
||||||
plugin_pver=${plugin_pver%[\'\"]*}
|
plugin_pver=${plugin_pver%[\'\"]*}
|
||||||
plugin_pver=$(printf $plugin_pver | tr -d '\r') # strip Windows linefeeds
|
|
||||||
elif [[ -z "$wrapper_ver" && $line == *'gradleVersion = '* ]]; then
|
elif [[ -z "$wrapper_ver" && $line == *'gradleVersion = '* ]]; then
|
||||||
wrapper_ver=${line#*gradleVersion*=*[\'\"]}
|
wrapper_ver=${line#*gradleVersion*=*[\'\"]}
|
||||||
wrapper_ver=${wrapper_ver%[\'\"]*}
|
wrapper_ver=${wrapper_ver%[\'\"]*}
|
||||||
wrapper_ver=$(printf $wrapper_ver | tr -d '\r') # strip Windows linefeeds
|
|
||||||
fi
|
fi
|
||||||
done < $f
|
done < $f
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue