VERY experimental Nintendo Switch 2 emulator
C++
[ci, tools] working find-unused-strings, android strings CI (#3036)
cruetereb2d9ea57460
diff --git a/.github/workflows/strings.yml b/.github/workflows/strings.ymlnew file mode 100644index 0000000000..614c5c12d0--- /dev/null+++ b/.github/workflows/strings.yml@@ -0,0 +1,22 @@+name: Check Strings++on:+ push:+ branches: [ master ]++jobs:+ check-strings:+ runs-on: source+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Find Unused Strings+ run: ./tools/find-unused-strings.sh++ - name: Find Stale Translations+ run: ./tools/stale-translations.sh++ - name: Diff+ run: git --no-pager diff --exit-code HEADdiff --git a/.github/workflows/translations.yml b/.github/workflows/translations.ymlindex 07037c7f94..92bb1fdf5d 100644--- a/.github/workflows/translations.yml+++ b/.github/workflows/translations.yml@@ -5,6 +5,7 @@ on:schedule:cron:- '0 14 * * 1,3,6'+ workflow_dispatch:jobs:tx-update:diff --git a/tools/find-unused-strings.sh b/tools/find-unused-strings.shold mode 100644new mode 100755index 43e39fbe25..3e26dc9283--- a/tools/find-unused-strings.sh+++ b/tools/find-unused-strings.sh@@ -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"\ No newline at end of filediff --git a/tools/generate-legacy-icons.sh b/tools/generate-legacy-icons.shindex 8dad11470e..3661a75bb8 100755--- a/tools/generate-legacy-icons.sh+++ b/tools/generate-legacy-icons.sh@@ -10,11 +10,11 @@ ROOTDIR=$PWDcd src/android/app/src/main-pushd res/drawable+cd res/drawable# convert vector to svg--needed to generate launcher pngcp ic_yuzu_icon.xml tmp-python3 $ROOTDIR/tools/VectorDrawable2Svg.py tmp+python3 "$ROOTDIR"/tools/VectorDrawable2Svg.py tmpinkscape -w 768 -h 768 tmp.svg -o ic_tmp.pngmagick ic_icon_bg_orig.png -resize 512x512 bg_tmp.png@@ -23,7 +23,8 @@ magick bg_tmp.png -strip -type TrueColor -depth 8 -colorspace sRGB -color-matrixmagick -verbose bg_tmp_rgb.png ic_tmp.png -gravity center -composite -colorspace sRGB ic_launcher.pngecho-rm *tmp*-popd+rm ./*tmp*-# Add legacy here when legacy gets merged+cd "$ROOTDIR"++# TODO: add legacy iconsdiff --git a/tools/optimize-assets.sh b/tools/optimize-assets.shindex 598052b70c..70fa2375a5 100755--- a/tools/optimize-assets.sh+++ b/tools/optimize-assets.sh@@ -1,7 +1,10 @@#!/bin/sh -e+# SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project# SPDX-License-Identifier: GPL-3.0-or-later+which optipng || exit-NPROC=$(nproc)-[ -z "$NPROC" ] && NPROC=8-find . -type f -iname '*.png' | xargs -P $NPROC -I {} optipng -o7 {}+NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)++# shellcheck disable=SC2038+find . -type f -iname '*.png' | xargs -P "$NPROC" -I {} optipng -o7 {}diff --git a/tools/stale-translations.sh b/tools/stale-translations.shindex 791b857a36..3a9362a252 100755--- a/tools/stale-translations.sh+++ b/tools/stale-translations.sh@@ -29,6 +29,6 @@ while IFS= read -r locale; do{ grep -e "string name=\"$unused\"" "$STRINGS" >/dev/null; } || \{ echo "-- Removing unused translation $unused" && sed "/string name=\"$unused\"/d" "$locale" > "$locale.new" && mv "$locale.new" "$locale"; }done < "$COMBINED"+done < "$LOCALES"- echo "-- done"-done < "$LOCALES"\ No newline at end of file+rm -rf "$TMP_DIR"\ No newline at end of file