Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

docs: the add-on recipe asks for the .gitignore and the Permissions column its checkers require

xbshengdf97538790c3
diff --git a/docs/workflows/addon.md b/docs/workflows/addon.md
index 22ec66fd5..cab1fb658 100644
--- a/docs/workflows/addon.md
+++ b/docs/workflows/addon.md
@@ -6,17 +6,24 @@
wrappers and an `app` module), with its own package name. Copy the two wrappers from an add-on that is
already here: the add-on build names `./gradlew` on macOS and Linux and `gradlew.bat` in a Command Prompt,
and `tests/test_addons.py` refuses a folder without either one.
-2. It talks to the launcher only through the module-card contract (`docs/modules.md`, `docs/specs/card.md`).
+2. Copy a neighbour's `.gitignore` into the folder as well, so a build leaves nothing to commit: it keeps
+ the Gradle output and the local.properties file Android Studio writes with your own SDK path out of
+ git. `tests/test_addon_local_properties_ignored.py` asks git about each of those.
+3. It talks to the launcher only through the module-card contract (`docs/modules.md`, `docs/specs/card.md`).
Nothing under `launcher/` changes, and `launcher/` never mentions `addons/`. If the idea needs a launcher
change, it is not an add-on: open an issue.
-3. Its `README.md` has a Permissions section listing every permission and why, plus any network access or
+4. Its `README.md` has a Permissions section listing every permission and why, in the names its
+ `AndroidManifest.xml` uses (`RECEIVE_BOOT_COMPLETED`, `SYSTEM_ALERT_WINDOW`), plus any network access or
background service. No telemetry without an opt-in, no ads, your own art.
-4. Add `addons/<name>/screenshot.jpg`: the add-on on a real TV, its card in the grid or its own screen, a
+5. Add `addons/<name>/screenshot.jpg`: the add-on on a real TV, its card in the grid or its own screen, a
JPEG, 16:9 (1280x720 is plenty) and under 300 KB, with Wi-Fi names and anything personal blurred out.
`tests/test_addons.py` fails without it.
-5. Add one row to the table in `addons/README.md` linking `<name>/`, with the TV it was tested on and the
- screenshot in the row's Screenshot column.
-6. No APKs in the repo. `tests/test_addons.py` checks all of this; `.github/workflows/addons.yml` builds the
+6. Add one row to the table in `addons/README.md` linking `<name>/`, with the TV it was tested on, the
+ permissions its manifest asks for in the Permissions column (in the words the table already uses:
+ "start at boot", "overlay"), and the screenshot in the row's Screenshot column. `tests/test_addons.py`
+ checks the row and the folder, and `tests/test_addon_permissions_index.py` holds the add-on's own page
+ and this column to the manifest.
+7. No APKs in the repo. `tests/test_addons.py` checks all of this; `.github/workflows/addons.yml` builds the
add-ons that changed with `./gradlew --no-daemon assembleRelease`.
Then run the tests: `python3 -m unittest discover -s tests -v`.
diff --git a/tests/test_addon_recipe_checklist.py b/tests/test_addon_recipe_checklist.py
index 8a7182470..c6399f1ca 100644
--- a/tests/test_addon_recipe_checklist.py
+++ b/tests/test_addon_recipe_checklist.py
@@ -15,9 +15,26 @@ and once a picture is in place the row is still refused:
The same page left out that a new folder carries its own Gradle wrapper, which the add-on workflow refuses
to build ("addons/x has no gradlew"), so a folder copied from a template without `gradlew` never builds.
-These tests read both requirements out of the checkers themselves (`tests/test_addons.py` and
-`.github/workflows/addons.yml`), so an assertion about the page can only pass while the checker really
-enforces what it asks for: if either stops, the pair fails and the page has to be re-read rather than
+Two rules the checkers gained since are missing from it in the same way, and a folder built from the page
+as it reads now still fails both. Its row is the only place the add-ons table's Permissions column is
+covered, and the page never asks for that column, so an author who follows it writes a row without one -
+or, filling it in from the words the page gives for the add-on's own README, writes "start at boot" where
+the manifest says `RECEIVE_BOOT_COMPLETED`:
+
+ AssertionError: True is not false : recipe-check asks for FOREGROUND_SERVICE,
+ FOREGROUND_SERVICE_SPECIAL_USE, RECEIVE_BOOT_COMPLETED and its row says 'None'
+
+And the folder's `.gitignore` - the one every add-on carries, the fix for the `sdk.dir=/home/...` that
+Android Studio writes into `local.properties` - is nowhere in the recipe, so the folder that follows it
+puts that path in the commit:
+
+ AssertionError: addons/recipe-check/local.properties is not ignored;
+ addons/recipe-check/.gitignore carries: (no .gitignore)
+
+These tests read every requirement out of the checkers themselves (`tests/test_addons.py`,
+`.github/workflows/addons.yml`, `tests/test_addon_local_properties_ignored.py` and
+`tests/test_addon_permissions_index.py`), so an assertion about the page can only pass while the checker
+really enforces what it asks for: if one stops, the pair fails and the page has to be re-read rather than
silently kept in step.
"""
import re
@@ -28,6 +45,8 @@ ROOT = Path(__file__).resolve().parents[1]
PAGE = ROOT / "docs/workflows/addon.md"
ADDON_TESTS = ROOT / "tests/test_addons.py"
ADDON_WORKFLOW = ROOT / ".github/workflows/addons.yml"
+LOCAL_PROPERTIES_TESTS = ROOT / "tests/test_addon_local_properties_ignored.py"
+PERMISSIONS_TESTS = ROOT / "tests/test_addon_permissions_index.py"
def steps(text):
@@ -75,6 +94,31 @@ class RecipeTest(unittest.TestCase):
"the step that creates addons/<name>/ does not ask for its own gradlew wrapper, and\n"
".github/workflows/addons.yml refuses to build a folder without one")
+ def test_the_recipe_asks_for_the_local_properties_ignore(self):
+ ignore = steps_naming(self.text, ".gitignore")
+ self.assertEqual(len(ignore), 1,
+ f"expected one step about the folder's .gitignore, found {len(ignore)}")
+ self.assertIn("local.properties", ignore[0],
+ "the recipe never asks for the folder's .gitignore, and\n"
+ "tests/test_addon_local_properties_ignored.py fails every add-on whose local.properties\n"
+ "git would commit: name the file Android Studio writes, beside the other three lines")
+
+ def test_the_recipe_gives_the_permissions_in_the_manifest_names(self):
+ section = steps_naming(self.text, "Permissions section")
+ self.assertEqual(len(section), 1,
+ f"expected one step about the add-on's README, found {len(section)}")
+ self.assertIn("AndroidManifest.xml", section[0],
+ "the step that asks for the Permissions section does not ask for the names the app's\n"
+ "AndroidManifest.xml uses, which is what tests/test_addon_permissions_index.py matches")
+
+ def test_the_recipe_says_the_row_carries_the_permissions_column(self):
+ rows = steps_naming(self.text, "addons/README.md")
+ self.assertEqual(len(rows), 1, f"expected one step about the row in addons/README.md, found {len(rows)}")
+ self.assertIn("permissions", rows[0].lower(),
+ "the step that adds the row does not ask for the Permissions column, which\n"
+ "tests/test_addon_permissions_index.py holds to the manifest for every add-on; a row\n"
+ "without it is not read as this add-on's row at all")
+
class CheckerTest(unittest.TestCase):
"""The requirements the page is held to are the ones the checkers still enforce."""
@@ -93,6 +137,22 @@ class CheckerTest(unittest.TestCase):
".github/workflows/addons.yml no longer refuses a folder without gradlew; the recipe's\n"
"wrapper step can go")
+ def test_the_local_properties_check_still_asks_git_about_the_file(self):
+ text = LOCAL_PROPERTIES_TESTS.read_text(encoding="utf-8")
+ self.assertIn("check-ignore", text,
+ "tests/test_addon_local_properties_ignored.py no longer asks git whether the file is\n"
+ "ignored; the recipe's .gitignore step can go")
+ self.assertIn('LOCAL_PROPERTIES = "local.properties"', text,
+ "tests/test_addon_local_properties_ignored.py no longer names local.properties; the\n"
+ "recipe's .gitignore step can go")
+
+ def test_the_permissions_check_still_holds_the_row_and_the_section(self):
+ text = PERMISSIONS_TESTS.read_text(encoding="utf-8")
+ for reader in ("manifest_permissions", "permissions_cell", "permissions_section"):
+ self.assertIn(reader, text,
+ f"tests/test_addon_permissions_index.py no longer reads {reader}; the recipe's\n"
+ f"permission steps can go")
+
class StepReaderTest(unittest.TestCase):
def test_a_wrapped_step_is_read_as_one_step(self):