diff options
| author | Albin <albin@mullvad.net> | 2024-06-11 23:44:19 +0200 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2024-06-12 00:03:04 +0200 |
| commit | 005c208ed28b8d8655630cdd26c3cf70171b6eb3 (patch) | |
| tree | 62d905e624e43a4504b6dfb2c68331b30022de87 /android/scripts | |
| parent | e3dd3d0fc92c8c7212c6bbe626002acb7d513c0b (diff) | |
| download | mullvadvpn-005c208ed28b8d8655630cdd26c3cf70171b6eb3.tar.xz mullvadvpn-005c208ed28b8d8655630cdd26c3cf70171b6eb3.zip | |
Fix outdated tidy script paths
Diffstat (limited to 'android/scripts')
| -rwxr-xr-x | android/scripts/tidy.sh | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/android/scripts/tidy.sh b/android/scripts/tidy.sh index 173d42d905..85d5630f64 100755 --- a/android/scripts/tidy.sh +++ b/android/scripts/tidy.sh @@ -24,37 +24,43 @@ function main { # Autoformats Android XML files function format { - tidy -xml \ - -m \ - -i \ - -w 100 \ - -utf8 \ - --quiet yes \ - --indent-attributes yes \ - --indent-spaces 4 \ - --literal-attributes yes \ - ../**/src/*/AndroidManifest.xml \ - ../lib/resource/src/main/res/anim*/*.xml \ - ../lib/resource/src/main/res/drawable*/*.xml \ - ../app/src/main/res/layout*/*.xml + non_text_xml_paths=("$(find .. -wholename "*/src/*.xml" ! -name "strings*.xml" ! -name plurals.xml)") + for xml_path in "${non_text_xml_paths[@]}"; do + tidy -xml \ + -m \ + -i \ + -w 100 \ + -utf8 \ + --quiet yes \ + --indent-attributes yes \ + --indent-spaces 4 \ + --literal-attributes yes \ + "$xml_path" + done - tidy -xml \ - -m \ - -i \ - -w 0 \ - -utf8 \ - --quiet yes \ - --indent-spaces 4 \ - --literal-attributes yes \ - --indent-cdata yes \ - ../lib/resource/src/main/res/values/*.xml + # We only format non-translated files since we don't want + # to introduce a mismatch between the xml files and source + # (.po) files. + non_translated_text_xml_paths=("$(find .. -wholename "*/values/strings*.xml" -o -wholename "*/values/plurals.xml")") + for xml_path in "${non_translated_text_xml_paths[@]}"; do + tidy -xml \ + -m \ + -i \ + -w 0 \ + -utf8 \ + --quiet yes \ + --indent-spaces 4 \ + --literal-attributes yes \ + --indent-cdata yes \ + "$xml_path" + done # FIXME - when tidy learns to not leave whitespace around, remove the line below - https://github.com/htacg/tidy-html5/issues/864 find .. -name '*.xml' -exec sed -i -e 's/[ \t]*$//' '{}' ';' } function checkDiff { - if git diff --exit-code -- ../**/AndroidManifest.xml ../**/src/main/res; then + if git diff --exit-code -- ../**/*.xml; then echo "Android XML files are correctly formatted" return 0 else |
