fix resource name
Build Futon with Niadd patch / Build Futon Niadd debug APK (push) Failing after 12m44s

This commit is contained in:
2026-08-09 22:10:37 +03:00
parent f09a471694
commit 316a53c249
2 changed files with 99 additions and 42 deletions
+32 -13
View File
@@ -113,34 +113,53 @@ jobs:
python3 scripts/patch_futon_niadd.py \
work/Futon
echo "=== Verify Futon build.gradle modification ==="
echo "=== Verify applicationId suffix ==="
grep -F "applicationIdSuffix = '.niadd'" \
work/Futon/app/build.gradle
echo "=== Verify Niadd resource overlay ==="
echo "=== Verify application name ==="
NIADD_RESOURCES="work/Futon/app/src/debug/res/values/niadd.xml"
grep -F '>Futon Niadd</string>' \
work/Futon/app/src/debug/res/values/strings.xml
test -f "${NIADD_RESOURCES}"
echo "=== Verify Niadd sync identifiers ==="
grep -F "Futon Niadd" \
"${NIADD_RESOURCES}"
grep -F 'io.github.landwarderer.futon.niadd.sync' \
work/Futon/app/src/debug/res/values/constants.xml
grep -F "io.github.landwarderer.futon.niadd.sync" \
"${NIADD_RESOURCES}"
grep -F 'io.github.landwarderer.futon.niadd.history' \
work/Futon/app/src/debug/res/values/constants.xml
grep -F "io.github.landwarderer.futon.niadd.history" \
"${NIADD_RESOURCES}"
grep -F 'io.github.landwarderer.futon.niadd.favourites' \
work/Futon/app/src/debug/res/values/constants.xml
grep -F "io.github.landwarderer.futon.niadd.favourites" \
"${NIADD_RESOURCES}"
echo "=== Ensure old debug identifiers are gone ==="
if grep -F 'org.futon.debug.sync' \
work/Futon/app/src/debug/res/values/constants.xml; then
echo "ERROR: old debug sync account type is still present"
exit 1
fi
if grep -F 'org.koitharu.futon.debug.history' \
work/Futon/app/src/debug/res/values/constants.xml; then
echo "ERROR: old debug history authority is still present"
exit 1
fi
if grep -F 'org.koitharu.futon.debug.favourites' \
work/Futon/app/src/debug/res/values/constants.xml; then
echo "ERROR: old debug favourites authority is still present"
exit 1
fi
echo "=== Futon resulting diff ==="
git -C work/Futon diff -- \
app/build.gradle \
app/src/debug/res/values/niadd.xml
app/src/debug/res/values/strings.xml \
app/src/debug/res/values/constants.xml
git -C work/Futon diff --check
+67 -29
View File
@@ -12,36 +12,57 @@ if len(sys.argv) != 2:
repo_dir = Path(sys.argv[1]).resolve()
build_gradle = repo_dir / "app/build.gradle"
if not build_gradle.is_file():
print(f"ERROR: build.gradle not found: {build_gradle}", file=sys.stderr)
sys.exit(1)
debug_strings = repo_dir / "app/src/debug/res/values/strings.xml"
debug_constants = repo_dir / "app/src/debug/res/values/constants.xml"
text = build_gradle.read_text(encoding="utf-8")
for file_path in (
build_gradle,
debug_strings,
debug_constants,
):
if not file_path.is_file():
print(
f"ERROR: required Futon file not found: {file_path}",
file=sys.stderr,
)
sys.exit(1)
def replace_exact(name: str, old: str, new: str) -> None:
global text
def replace_exact(
file_path: Path,
name: str,
old: str,
new: str,
) -> None:
text = file_path.read_text(encoding="utf-8")
count = text.count(old)
if count != 1:
print(
f"ERROR: modification '{name}' expected exactly 1 match, found {count}",
f"ERROR: modification '{name}' expected exactly 1 match "
f"in {file_path}, found {count}",
file=sys.stderr,
)
print(
"Upstream Futon build.gradle has probably changed.",
"Upstream Futon has probably changed.",
file=sys.stderr,
)
sys.exit(1)
text = text.replace(old, new, 1)
file_path.write_text(
text,
encoding="utf-8",
)
print(f"[OK] {name}")
replace_exact(
build_gradle,
"Niadd applicationId suffix",
"""\t\tdebug {
\t\t\tapplicationIdSuffix = '.debug'
@@ -57,34 +78,51 @@ replace_exact(
)
build_gradle.write_text(text, encoding="utf-8")
replace_exact(
debug_strings,
"Niadd application name",
"""\t<string name="app_name" translatable="false">Futon Dev</string>""",
"""\t<string name="app_name" translatable="false">Futon Niadd</string>""",
)
values_dir = repo_dir / "app/src/debug/res/values"
values_dir.mkdir(parents=True, exist_ok=True)
replace_exact(
debug_constants,
"Niadd sync account type",
"""\t<string name="account_type_sync" translatable="false">org.futon.debug.sync</string>""",
"""\t<string name="account_type_sync" translatable="false">io.github.landwarderer.futon.niadd.sync</string>""",
)
niadd_resources = values_dir / "niadd.xml"
niadd_resources.write_text(
"""<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Futon Niadd</string>
replace_exact(
debug_constants,
"Niadd history authority",
"""\t<string name="sync_authority_history" translatable="false">org.koitharu.futon.debug.history</string>""",
"""\t<string name="sync_authority_history" translatable="false">io.github.landwarderer.futon.niadd.history</string>""",
)
<string name="account_type_sync" translatable="false">io.github.landwarderer.futon.niadd.sync</string>
<string name="sync_authority_history" translatable="false">io.github.landwarderer.futon.niadd.history</string>
<string name="sync_authority_favourites" translatable="false">io.github.landwarderer.futon.niadd.favourites</string>
</resources>
""",
encoding="utf-8",
replace_exact(
debug_constants,
"Niadd favourites authority",
"""\t<string name="sync_authority_favourites" translatable="false">org.koitharu.futon.debug.favourites</string>""",
"""\t<string name="sync_authority_favourites" translatable="false">io.github.landwarderer.futon.niadd.favourites</string>""",
)
print()
print("[OK] Futon Niadd application variant configured")
print("[OK] applicationId: io.github.landwarderer.futon.niadd")
print("[OK] app name: Futon Niadd")
print("[OK] account type: io.github.landwarderer.futon.niadd.sync")
print("[OK] history authority: io.github.landwarderer.futon.niadd.history")
print("[OK] favourites authority: io.github.landwarderer.futon.niadd.favourites")
print()
print("Application ID:")
print(" io.github.landwarderer.futon.niadd")
print()
print("Application name:")
print(" Futon Niadd")
print()
print()
print("Sync account type:")
print(" io.github.landwarderer.futon.niadd.sync")
print()
print("Sync authorities:")
print(" io.github.landwarderer.futon.niadd.history")
print(" io.github.landwarderer.futon.niadd.favourites")