mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-22 11:37:04 +02:00
[ci, tools] working find-unused-strings, android strings CI (#3036)
Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3036
This commit is contained in:
parent
4f389338bd
commit
eb2d9ea574
6 changed files with 56 additions and 13 deletions
22
tools/find-unused-strings.sh
Normal file → Executable file
22
tools/find-unused-strings.sh
Normal file → Executable file
|
|
@ -1,7 +1,23 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
cat src/android/app/src/main/res/values/strings.xml \
|
||||
| grep 'string name="' | awk -F'"' '$0=$2' \
|
||||
| xargs -I {} sh -c 'grep -qirnw R.string.'{}' src/android/app/src || echo '{}
|
||||
ANDROID=src/android/app/src/main
|
||||
STRINGS=$ANDROID/res/values/strings.xml
|
||||
|
||||
SRC=$(mktemp)
|
||||
|
||||
# We start out by getting the list of source strings...
|
||||
grep -e "string name" $STRINGS | cut -d'"' -f2 > "$SRC"
|
||||
|
||||
# ... then search for each string as R.string. or @string/
|
||||
while IFS= read -r str; do
|
||||
grep -qre "R.string.$str\|@string/$str" "$ANDROID" && continue
|
||||
|
||||
echo "-- Removing unused string $str"
|
||||
sed "/string name=\"$str\"/d" "$STRINGS" > "$STRINGS.new"
|
||||
mv "$STRINGS.new" "$STRINGS"
|
||||
done < "$SRC"
|
||||
|
||||
rm -rf "$TMP_DIR"
|
||||
Loading…
Add table
Add a link
Reference in a new issue