Modern Apps git

← Modern-Apps.git

calendar: move holidaygen from gradle module to scripts/calendar python

Commit
217bb479eb5e0600a44a67a3d2cb86ce3250834f
Author
vayun-mathur <[email protected]>
When
2026-10-14 20:11 UTC (1 month ago)
Parents
e0ad01b

Diff

.github/ISSUE_TEMPLATE/bug_report.yml
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex ea487c1296..971a242def 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -62,7 +62,6 @@ body:         - taxi         - things         - todo-        - tools:holidaygen         - translate         - travel         - tuner
.github/ISSUE_TEMPLATE/feature_request.yml
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.ymlindex 111785c1a9..583e480c5d 100644--- a/.github/ISSUE_TEMPLATE/feature_request.yml+++ b/.github/ISSUE_TEMPLATE/feature_request.yml@@ -62,7 +62,6 @@ body:         - taxi         - things         - todo-        - tools:holidaygen         - translate         - travel         - tuner
.github/workflows/issue_labeler.yml
diff --git a/.github/workflows/issue_labeler.yml b/.github/workflows/issue_labeler.ymlindex 4186c76567..07962842ae 100644--- a/.github/workflows/issue_labeler.yml+++ b/.github/workflows/issue_labeler.yml@@ -21,7 +21,7 @@ jobs:              if (match && match[1]) {               const selectedApp = match[1].trim().toLowerCase();-              const validApps = ['appstore', 'arrows', 'astronomy', 'auto', 'backup', 'calculator', 'calendar', 'camera', 'cast', 'chess', 'clock', 'code', 'communicate', 'contacts', 'education', 'email', 'emergency', 'euicc', 'everysync', 'files', 'findfamily', 'flashcards', 'fooddelivery', 'health', 'hub', 'keyboard', 'launcher', 'logicgate', 'logviewer', 'maps', 'measure', 'minesweeper', 'music', 'musicbrainz', 'networklocation', 'nonogram', 'notes', 'office', 'openassistant', 'passwords', 'pdf', 'photos', 'pipes', 'parentalcontrols', 'screentime', 'setupwizard', 'share', 'solitaire', 'speech', 'sudoku', 'taxi', 'things', 'todo', 'tools:holidaygen', 'translate', 'travel', 'tuner', 'unblockjam', 'updater', 'vpn', 'watch', 'voxels', 'weather', 'web', 'wordmaker', 'youpipe'];+              const validApps = ['appstore', 'arrows', 'astronomy', 'auto', 'backup', 'calculator', 'calendar', 'camera', 'cast', 'chess', 'clock', 'code', 'communicate', 'contacts', 'education', 'email', 'emergency', 'euicc', 'everysync', 'files', 'findfamily', 'flashcards', 'fooddelivery', 'health', 'hub', 'keyboard', 'launcher', 'logicgate', 'logviewer', 'maps', 'measure', 'minesweeper', 'music', 'musicbrainz', 'networklocation', 'nonogram', 'notes', 'office', 'openassistant', 'passwords', 'pdf', 'photos', 'pipes', 'parentalcontrols', 'screentime', 'setupwizard', 'share', 'solitaire', 'speech', 'sudoku', 'taxi', 'things', 'todo', 'translate', 'travel', 'tuner', 'unblockjam', 'updater', 'vpn', 'watch', 'voxels', 'weather', 'web', 'wordmaker', 'youpipe'];                if (validApps.includes(selectedApp)) {                 await github.rest.issues.addLabels({
AGENTS.md
diff --git a/AGENTS.md b/AGENTS.mdindex e27980d7db..86a1ecdb6f 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -45,7 +45,7 @@ Monorepo: ~100 Gradle modules + Rust workspace. Do scoped work only.  ### Apps (Gradle key → dir) Reference: `backup/` satisfies every rule; `notes/` second + `intents/` demo. `camera` + `games/voxels` hand-commit screenshots.-`appstore→appstore/` `astronomy→astronomy/` `auto→auto/,auto/protocol/` `backup→backup/` `calculator→calculator/` `calendar→calendar/` `camera→camera/` `cast→cast/,cast/protocol/,cast/tv/` `clock→clock/` `code→code/` `communicate→communicate/` `contacts→contacts/` `education→education/` `email→email/` `emergency→emergency/` `euicc→euicc/` `everysync→everysync/` `files→files/` `findfamily→findfamily/` `flashcards→flashcards/` `fooddelivery→fooddelivery/` `health→health/` `keyboard→keyboard/` `launcher→launcher/` `logviewer→logviewer/` `maps→maps/` `measure→measure/` `music→music/` `musicbrainz→musicbrainz/` `networklocation→networklocation/` `notes→notes/` `office→office/` `openassistant→openassistant/` `passwords→passwords/` `pdf→pdf/` `photos→photos/` `parentalcontrols→parentalcontrols/` `screentime→screentime/` `setupwizard→setupwizard/` `share→share/` `speech→speech/` `taxi→taxi/` `things→things/` `translate→translate/` `travel→travel/` `tuner→tuner/` `updater→updater/` `vpn→vpn/` `weather→weather/` `web→web/` `youpipe→youpipe/,youpipe/extractor/` `tools-holidaygen→tools/holidaygen/` `games-hub→games/hub/` `games-arrows→games/arrows/` `games-chess→games/chess/` `games-logicgate→games/logicgate/` `games-minesweeper→games/minesweeper/` `games-nonogram→games/nonogram/` `games-pipes→games/pipes/` `games-solitaire→games/solitaire/` `games-sudoku→games/sudoku/` `games-unblockjam→games/unblockjam/` `games-voxels→games/voxels/` `games-wordmaker→games/wordmaker/`+`appstore→appstore/` `astronomy→astronomy/` `auto→auto/,auto/protocol/` `backup→backup/` `calculator→calculator/` `calendar→calendar/` `camera→camera/` `cast→cast/,cast/protocol/,cast/tv/` `clock→clock/` `code→code/` `communicate→communicate/` `contacts→contacts/` `education→education/` `email→email/` `emergency→emergency/` `euicc→euicc/` `everysync→everysync/` `files→files/` `findfamily→findfamily/` `flashcards→flashcards/` `fooddelivery→fooddelivery/` `health→health/` `keyboard→keyboard/` `launcher→launcher/` `logviewer→logviewer/` `maps→maps/` `measure→measure/` `music→music/` `musicbrainz→musicbrainz/` `networklocation→networklocation/` `notes→notes/` `office→office/` `openassistant→openassistant/` `passwords→passwords/` `pdf→pdf/` `photos→photos/` `parentalcontrols→parentalcontrols/` `screentime→screentime/` `setupwizard→setupwizard/` `share→share/` `speech→speech/` `taxi→taxi/` `things→things/` `translate→translate/` `travel→travel/` `tuner→tuner/` `updater→updater/` `vpn→vpn/` `weather→weather/` `web→web/` `youpipe→youpipe/,youpipe/extractor/` `games-hub→games/hub/` `games-arrows→games/arrows/` `games-chess→games/chess/` `games-logicgate→games/logicgate/` `games-minesweeper→games/minesweeper/` `games-nonogram→games/nonogram/` `games-pipes→games/pipes/` `games-solitaire→games/solitaire/` `games-sudoku→games/sudoku/` `games-unblockjam→games/unblockjam/` `games-voxels→games/voxels/` `games-wordmaker→games/wordmaker/` Slash == colon for Gradle (`games/voxels` == `games:voxels`).  ### Never scan
SUPPLY_CHAIN_RISKS.md
diff --git a/SUPPLY_CHAIN_RISKS.md b/SUPPLY_CHAIN_RISKS.mdindex 71982816bf..e2ad56942d 100644--- a/SUPPLY_CHAIN_RISKS.md+++ b/SUPPLY_CHAIN_RISKS.md@@ -944,9 +944,9 @@ revision-pinned and digest-verified (§8). The LFS CDN behind it is dynamic. - `unicode.org` — emoji data. - The Brave filter-list catalog — **a second unbounded host set**, since the list of lists is read   from upstream rather than hardcoded.-- `calendar.google.com` — `tools/holidaygen/HolidayGen.kt` issues roughly **13,700 sequential,-  unthrottled GETs** with a spoofed `Mozilla/5.0 (holidaygen)` UA. The build file's "Thunderbird"-  comment describes a different source and is wrong.+- `calendar.google.com` — `scripts/calendar/generate_holidays.py` issues roughly **13,700 sequential,+  unthrottled GETs** with a spoofed `Mozilla/5.0 (holidaygen)` UA. Run with+  `python scripts/calendar/generate_holidays.py` (stdlib only, no Gradle).  **Cleared.** `wikidesc` reads a local dump and deliberately avoids the API. `scripts/networklocation` is an OSM geocoder, not a Wi-Fi harvester. Also clear: the other three
calendar/src/main/java/com/vayunmathur/calendar/util/HolidayData.kt
diff --git a/calendar/src/main/java/com/vayunmathur/calendar/util/HolidayData.kt b/calendar/src/main/java/com/vayunmathur/calendar/util/HolidayData.ktindex b7dbdf30e0..17268dbf0f 100644--- a/calendar/src/main/java/com/vayunmathur/calendar/util/HolidayData.kt+++ b/calendar/src/main/java/com/vayunmathur/calendar/util/HolidayData.kt@@ -17,7 +17,7 @@ data class HolidayLanguage(val code: String, val name: String) /**  * Reads the offline holiday data bundled under `assets/holidays/`  * (`index.json` = country list, `<CODE>.json` = that country's holidays).- * Generated by the host-only `:tools:holidaygen` module — no network needed.+ * Generated by the host-only `scripts/calendar/generate_holidays.py` — no network needed.  */ object HolidayData {     private val json = Json { ignoreUnknownKeys = true }
scripts/calendar/generate_holidays.py
diff --git a/scripts/calendar/generate_holidays.py b/scripts/calendar/generate_holidays.pynew file mode 100644index 0000000000..36cfd3dd33--- /dev/null+++ b/scripts/calendar/generate_holidays.py@@ -0,0 +1,361 @@+#!/usr/bin/env python3+"""Generates the calendar app's bundled holiday data from Google's public+iCal holiday feeds (en.<slug>#[email protected]).++Python port of the former :tools:holidaygen HolidayGen.kt — identical+runtime behavior and output layout.++Usage:+    python generate_holidays.py [start-slug]++Writes to calendar/src/main/assets/holidays/ (relative to the repo root):+- languages.json           67 supported language prefixes+- index.json               canonical country list (code + English name)+- en/<CODE>.json           English holidays per country+- <lang>/<CODE>.json       localized holidays, only where they differ from English+- <lang>/index.json        per-language country index+- <CODE>.json              flat English copies (backward compat)+- country_languages.json   map of country code -> available language codes++If a start slug is given and the output dir already exists, resumes from+that slug instead of wiping the output. Stdlib only.+"""++import json+import pathlib+import re+import shutil+import sys+import urllib.request++URL_TEMPLATE = (+    "https://calendar.google.com/calendar/ical/%s.%s%%23holiday%%40group.v.calendar.google.com/public/basic.ics"+)+USER_AGENT = "Mozilla/5.0 (holidaygen)"+TIMEOUT_S = 60++# 67 Google-supported language prefixes with display names+LANGS = [+    ("en", "English"), ("es", "Spanish"), ("fr", "French"),+    ("de", "German"), ("it", "Italian"), ("pt", "Portuguese"),+    ("ru", "Russian"), ("zh", "Chinese"), ("ja", "Japanese"),+    ("ko", "Korean"), ("ar", "Arabic"), ("hi", "Hindi"),+    ("nl", "Dutch"), ("pl", "Polish"), ("tr", "Turkish"),+    ("sv", "Swedish"), ("da", "Danish"), ("no", "Norwegian"),+    ("fi", "Finnish"), ("cs", "Czech"), ("hu", "Hungarian"),+    ("el", "Greek"), ("he", "Hebrew"), ("th", "Thai"),+    ("vi", "Vietnamese"), ("id", "Indonesian"), ("ms", "Malay"),+    ("uk", "Ukrainian"), ("ro", "Romanian"), ("bg", "Bulgarian"),+    ("hr", "Croatian"), ("sk", "Slovak"), ("sl", "Slovenian"),+    ("lt", "Lithuanian"), ("lv", "Latvian"), ("et", "Estonian"),+    ("sr", "Serbian"), ("ca", "Catalan"), ("eu", "Basque"),+    ("gl", "Galician"), ("is", "Icelandic"), ("ga", "Irish"),+    ("mt", "Maltese"), ("cy", "Welsh"), ("af", "Afrikaans"),+    ("sq", "Albanian"), ("hy", "Armenian"), ("az", "Azerbaijani"),+    ("be", "Belarusian"), ("bn", "Bengali"), ("bs", "Bosnian"),+    ("ka", "Georgian"), ("km", "Khmer"), ("kn", "Kannada"),+    ("ky", "Kyrgyz"), ("lo", "Lao"), ("mk", "Macedonian"),+    ("ml", "Malayalam"), ("mn", "Mongolian"), ("my", "Burmese"),+    ("ne", "Nepali"), ("pa", "Punjabi"), ("si", "Sinhala"),+    ("ta", "Tamil"), ("te", "Telugu"), ("ur", "Urdu"),+    ("uz", "Uzbek"),+]++# Verified Google holiday-feed slugs+SLUGS = [+    "usa", "uk", "canadian", "australian", "indian", "irish", "french", "german",+    "italian", "spain", "portuguese", "dutch", "danish", "finnish", "norwegian", "swedish",+    "polish", "russian", "ukrainian", "austrian", "bulgarian", "croatian", "czech", "greek",+    "hungarian", "latvian", "lithuanian", "romanian", "slovak", "slovenian", "turkish", "japanese",+    "china", "taiwan", "hong_kong", "south_korea", "singapore", "indonesian", "malaysia", "philippines",+    "vietnamese", "brazilian", "mexican", "new_zealand", "jewish", "christian", "islamic", "judaism",+    "hinduism", "orthodox_christianity", "sa", "ar", "cl", "co", "pe", "th",+    "be", "ch", "lu", "is", "rs", "eg", "pk", "bd",+    "af", "al", "dz", "ad", "ao", "ag", "am", "az",+    "bs", "bh", "bb", "by", "bz", "bj", "bt", "bo",+    "ba", "bw", "bn", "bf", "bi", "cv", "kh", "cm",+    "cf", "td", "km", "cg", "cd", "cr", "ci", "cu",+    "cy", "dj", "dm", "do", "ec", "sv", "gq", "er",+    "ee", "sz", "et", "fj", "ga", "gm", "ge", "gh",+    "gd", "gt", "gn", "gw", "gy", "ht", "hn", "ir",+    "iq", "jm", "jo", "kz", "ke", "ki", "kw", "kg",+    "la", "lb", "ls", "lr", "ly", "li", "mg", "mw",+    "mv", "ml", "mt", "mh", "mr", "mu", "fm", "md",+    "mc", "mn", "me", "ma", "mz", "mm", "na", "nr",+    "np", "ni", "ne", "ng", "mk", "om", "pw", "pa",+    "pg", "py", "qa", "rw", "kn", "lc", "vc", "ws",+    "sm", "st", "sn", "sc", "sl", "sb", "so", "ss",+    "lk", "sd", "sr", "sy", "tj", "tz", "tl", "tg",+    "to", "tt", "tn", "tm", "tv", "ug", "ae", "uy",+    "uz", "vu", "ve", "ye", "zm", "zw", "mo", "pr",+    "gu", "vi",+]++BASE_DIR = pathlib.Path(__file__).resolve().parents[2] / "calendar/src/main/assets/holidays"+++def print_progress(label, current, total):+    width = 30+    filled = int(current / total * width)+    bar = "\r%s [%s] %d/%d (%d%%)" % (+        label, "\u2588" * filled + "\u2591" * (width - filled),+        current, total, round(current / total * 100),+    )+    print(bar, end="", flush=True)+    if current == total:+        print()+++def holidays_equal(a, b):+    return a == b+++def write_json(path, obj):+    path.write_text(json.dumps(obj, ensure_ascii=False, separators=(",", ":")), encoding="utf-8")+++def get(url):+    req = urllib.request.Request(url, headers={"User-Agent": USER_AGENT})+    with urllib.request.urlopen(req, timeout=TIMEOUT_S) as resp:+        if resp.status // 100 != 2:+            raise RuntimeError("HTTP %d" % resp.status)+        return resp.read().decode("utf-8")+++def unfold(ics):+    out = []+    for raw in re.split(r"\r?\n", ics):+        if (raw.startswith(" ") or raw.startswith("\t")) and out:+            out[-1] = out[-1] + raw[1:]+        else:+            out.append(raw)+    return out+++def unescape(s):+    b = []+    i = 0+    while i < len(s):+        c = s[i]+        if c == "\\" and i + 1 < len(s):+            i += 1+            n = s[i]+            if n in ("n", "N"):+                b.append(" ")+            elif n == ",":+                b.append(",")+            elif n == ";":+                b.append(";")+            elif n == "\\":+                b.append("\\")+            else:+                b.append(n)+        else:+            b.append(c)+        i += 1+    return "".join(b).strip()+++def calendar_name(lines):+    for line in lines:+        if line.startswith("X-WR-CALNAME:"):+            name = line[len("X-WR-CALNAME:"):]+            name = re.sub(r"^Holidays and Observances in ", "", name)+            name = re.sub(r"^Holidays in ", "", name)+            return name.strip()+    return None+++def country_code(name):+    return re.sub(r"[^A-Za-z0-9]", "", name)+++def parse_events(lines):+    out = []+    in_event = False+    summary = None+    date = None+    for line in lines:+        if line == "BEGIN:VEVENT":+            in_event = True+            summary = None+            date = None+        elif line == "END:VEVENT":+            if summary is not None and date is not None:+                out.append((date, summary))+            in_event = False+        elif not in_event:+            continue+        else:+            colon = line.find(":")+            if colon <= 0:+                continue+            left = line[:colon].upper()+            value = line[colon + 1:]+            if left == "SUMMARY":+                summary = unescape(value)+            elif left.startswith("DTSTART"):+                m = re.search(r"([0-9]{4})([0-9]{2})([0-9]{2})", value)+                if m:+                    date = "%s-%s-%s" % m.groups()+    return out+++def sort_holidays(holidays):+    return sorted(holidays, key=lambda h: (h[0], h[1].casefold()))+++def load_country_languages(path):+    """Parses an existing country_languages.json into {code: [langs]} (ordered)."""+    country_langs = {}+    try:+        text = path.read_text(encoding="utf-8")+        for m in re.finditer(r'"([^"]+)":\[([^\]]*)\]', text):+            langs = [lang.strip().strip('"') for lang in m.group(2).split(",")]+            langs = [lang for lang in langs if lang]+            if langs:+                country_langs[m.group(1)] = langs+    except OSError:+        pass+    return country_langs+++def main(argv):+    start_slug = argv[0] if argv else None+    base_dir = BASE_DIR+    resume = start_slug is not None and base_dir.exists()++    if not resume and base_dir.exists():+        shutil.rmtree(base_dir)+    base_dir.mkdir(parents=True, exist_ok=True)+    if resume:+        print("Resuming from slug: %s" % start_slug)++    # Write languages.json at top level+    write_json(+        base_dir / "languages.json",+        [{"code": code, "name": name} for code, name in LANGS],+    )++    # Phase 1: Build canonical slug -> code mapping from English feed+    print("Phase 1/2: Building canonical index from English...")+    slug_to_code = {}+    canonical_index = []++    for i, slug in enumerate(SLUGS):+        print_progress("  Fetching English", i + 1, len(SLUGS))+        try:+            ics = get(URL_TEMPLATE % ("en", slug))+            name = calendar_name(unfold(ics))+            if name is None:+                continue+            code = country_code(name)+            slug_to_code[slug] = code+            canonical_index.append({"code": code, "name": name})+        except Exception as ex:+            print("\n  [en] Skipping %s: %s" % (slug, ex), file=sys.stderr)+    print()+    canonical_index.sort(key=lambda e: e["name"].casefold())+    print("  \u2713 Canonical: %d countries found\n" % len(canonical_index))++    # Write top-level index.json+    write_json(base_dir / "index.json", canonical_index)++    # Phase 2: For each slug, fetch English first, then other langs+    print("Phase 2/2: Fetching localized holidays (comparing to English, only saving differences)...")+    country_langs = {}+    if resume:+        country_langs = load_country_languages(base_dir / "country_languages.json")+        if country_langs:+            print("  Loaded existing progress for %d countries" % len(country_langs))++    total_written = 0+    total_countries = len(slug_to_code)+    country_idx = 0+    total_langs = len(LANGS) - 1+    started = start_slug is None++    for slug in SLUGS:+        if not started:+            if slug == start_slug:+                started = True+            else:+                continue+        code = slug_to_code.get(slug)+        if code is None:+            continue+        country_idx += 1++        # Fetch English baseline+        try:+            en_ics = get(URL_TEMPLATE % ("en", slug))+            en_holidays = sort_holidays(parse_events(unfold(en_ics)))+            if not en_holidays:+                continue+        except Exception as ex:+            print("\n  [en] Skipping %s: %s" % (slug, ex), file=sys.stderr)+            continue++        # Write English+        en_dir = base_dir / "en"+        en_dir.mkdir(parents=True, exist_ok=True)+        write_json(en_dir / ("%s.json" % code), [{"d": d, "n": n} for d, n in en_holidays])+        country_langs.setdefault(code, [])+        if "en" not in country_langs[code]:+            country_langs[code].append("en")+        total_written += 1++        # Fetch other languages, compare to English+        lang_idx = 0+        distinct_count = 1+        for lang, _lang_name in LANGS:+            if lang == "en":+                continue+            lang_idx += 1+            print_progress(+                "  [%d/%d] %s (%d langs)" % (country_idx, total_countries, code, distinct_count),+                lang_idx, total_langs,+            )+            try:+                ics = get(URL_TEMPLATE % (lang, slug))+                holidays = sort_holidays(parse_events(unfold(ics)))+                if not holidays:+                    continue+                if holidays_equal(en_holidays, holidays):+                    continue+                lang_dir = base_dir / lang+                lang_dir.mkdir(parents=True, exist_ok=True)+                write_json(lang_dir / ("%s.json" % code), [{"d": d, "n": n} for d, n in holidays])+                country_langs.setdefault(code, [])+                if lang not in country_langs[code]:+                    country_langs[code].append(lang)+                distinct_count += 1+                total_written += 1+            except Exception:+                # skip silently+                pass+    print()++    # Write per-language index.json+    for lang, _lang_name in LANGS:+        lang_dir = base_dir / lang+        if not lang_dir.exists():+            continue+        index = [e for e in canonical_index if (lang_dir / ("%s.json" % e["code"])).exists()]+        index.sort(key=lambda e: e["name"].casefold())+        write_json(lang_dir / "index.json", index)++    # Copy English to flat structure for backward compat+    en_dir = base_dir / "en"+    for src in sorted(en_dir.glob("*.json")):+        if src.name != "index.json":+            shutil.copyfile(src, base_dir / src.name)++    # Write country_languages.json+    write_json(base_dir / "country_languages.json", country_langs)++    print("  \u2713 Wrote %d files across %d languages to %s" % (total_written, len(LANGS), base_dir))+++if __name__ == "__main__":+    main(sys.argv[1:])
settings.gradle.kts
diff --git a/settings.gradle.kts b/settings.gradle.ktsindex af1766f0bd..22e2a20bed 100644--- a/settings.gradle.kts+++ b/settings.gradle.kts@@ -82,8 +82,7 @@ include(":sdk:games") include(":sdk:cast") include(":things") include(":todo")-include(":office")-include(":tools:holidaygen")+include(":todo") include(":education") include(":everysync") include(":travel")
tools/holidaygen/AGENTS.md
diff --git a/tools/holidaygen/AGENTS.md b/tools/holidaygen/AGENTS.mddeleted file mode 100644index 8f7bf55d59..0000000000--- a/tools/holidaygen/AGENTS.md+++ /dev/null@@ -1,20 +0,0 @@-# AGENTS.md — tools/holidaygen/ (':tools:holidaygen')--> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `tools/holidaygen/` + allowed shared modules. Do not root-scan.--- Gradle: :tools:holidaygen / dir: tools/holidaygen/-- Package roots present: -- Entry files: -- Deps: -- Metadata: metadata_data/tools-holidaygen.md (MISSING)-- Rust: no / screenshotTest: no--## Key files--## Verify (this module only)-```-./gradlew :tools:holidaygen:compileDevKotlin-./gradlew :tools:holidaygen:lint-```--
tools/holidaygen/build.gradle.kts
diff --git a/tools/holidaygen/build.gradle.kts b/tools/holidaygen/build.gradle.ktsdeleted file mode 100644index e975c1f39e..0000000000--- a/tools/holidaygen/build.gradle.kts+++ /dev/null@@ -1,16 +0,0 @@-// Host-only JVM tool (NOT shipped in any app). Downloads Thunderbird's public-// holiday .ics files and converts them to the calendar app's bundled JSON-// assets. Run: ./gradlew :tools:holidaygen:run-plugins {-    id("common-conventions-jvm")-    application-}--application {-    mainClass.set("HolidayGenKt")-}--// Emit assets relative to the repo root.-tasks.named<JavaExec>("run") {-    workingDir = rootProject.projectDir-}
tools/holidaygen/calendar/src/main/assets/holidays/languages.json
diff --git a/tools/holidaygen/calendar/src/main/assets/holidays/languages.json b/tools/holidaygen/calendar/src/main/assets/holidays/languages.jsondeleted file mode 100644index 9e67e20099..0000000000--- a/tools/holidaygen/calendar/src/main/assets/holidays/languages.json+++ /dev/null@@ -1 +0,0 @@-[{"code":"en","name":"English"},{"code":"es","name":"Spanish"},{"code":"fr","name":"French"},{"code":"de","name":"German"},{"code":"it","name":"Italian"},{"code":"pt","name":"Portuguese"},{"code":"ru","name":"Russian"},{"code":"zh","name":"Chinese"},{"code":"ja","name":"Japanese"},{"code":"ko","name":"Korean"},{"code":"ar","name":"Arabic"},{"code":"hi","name":"Hindi"},{"code":"nl","name":"Dutch"},{"code":"pl","name":"Polish"},{"code":"tr","name":"Turkish"},{"code":"sv","name":"Swedish"},{"code":"da","name":"Danish"},{"code":"no","name":"Norwegian"},{"code":"fi","name":"Finnish"},{"code":"cs","name":"Czech"},{"code":"hu","name":"Hungarian"},{"code":"el","name":"Greek"},{"code":"he","name":"Hebrew"},{"code":"th","name":"Thai"},{"code":"vi","name":"Vietnamese"},{"code":"id","name":"Indonesian"},{"code":"ms","name":"Malay"},{"code":"uk","name":"Ukrainian"},{"code":"ro","name":"Romanian"},{"code":"bg","name":"Bulgarian"},{"code":"hr","name":"Croatian"},{"code":"sk","name":"Slovak"},{"code":"sl","name":"Slovenian"},{"code":"lt","name":"Lithuanian"},{"code":"lv","name":"Latvian"},{"code":"et","name":"Estonian"},{"code":"sr","name":"Serbian"},{"code":"ca","name":"Catalan"},{"code":"eu","name":"Basque"},{"code":"gl","name":"Galician"},{"code":"is","name":"Icelandic"},{"code":"ga","name":"Irish"},{"code":"mt","name":"Maltese"},{"code":"cy","name":"Welsh"},{"code":"af","name":"Afrikaans"},{"code":"sq","name":"Albanian"},{"code":"hy","name":"Armenian"},{"code":"az","name":"Azerbaijani"},{"code":"be","name":"Belarusian"},{"code":"bn","name":"Bengali"},{"code":"bs","name":"Bosnian"},{"code":"ka","name":"Georgian"},{"code":"km","name":"Khmer"},{"code":"kn","name":"Kannada"},{"code":"ky","name":"Kyrgyz"},{"code":"lo","name":"Lao"},{"code":"mk","name":"Macedonian"},{"code":"ml","name":"Malayalam"},{"code":"mn","name":"Mongolian"},{"code":"my","name":"Burmese"},{"code":"ne","name":"Nepali"},{"code":"pa","name":"Punjabi"},{"code":"si","name":"Sinhala"},{"code":"ta","name":"Tamil"},{"code":"te","name":"Telugu"},{"code":"ur","name":"Urdu"},{"code":"uz","name":"Uzbek"}]\ No newline at end of file
tools/holidaygen/src/main/kotlin/HolidayGen.kt
diff --git a/tools/holidaygen/src/main/kotlin/HolidayGen.kt b/tools/holidaygen/src/main/kotlin/HolidayGen.ktdeleted file mode 100644index c0d77733f8..0000000000--- a/tools/holidaygen/src/main/kotlin/HolidayGen.kt+++ /dev/null@@ -1,436 +0,0 @@-import java.io.File-import java.net.URI-import java.net.http.HttpClient-import java.net.http.HttpRequest-import java.net.http.HttpResponse-import java.nio.file.Files-import java.time.Duration--/**- * Generates the calendar app's bundled holiday data from Google's public- * iCal holiday feeds (en.<slug>#[email protected]).- *- * Kotlin port of HolidayGen.java — identical runtime behavior.- */-private const val URL_TEMPLATE =-    "https://calendar.google.com/calendar/ical/%s.%s%%23holiday%%40group.v.calendar.google.com/public/basic.ics"--// 67 Google-supported language prefixes with display names-private val LANGS = arrayOf(-    arrayOf("en", "English"), arrayOf("es", "Spanish"), arrayOf("fr", "French"),-    arrayOf("de", "German"), arrayOf("it", "Italian"), arrayOf("pt", "Portuguese"),-    arrayOf("ru", "Russian"), arrayOf("zh", "Chinese"), arrayOf("ja", "Japanese"),-    arrayOf("ko", "Korean"), arrayOf("ar", "Arabic"), arrayOf("hi", "Hindi"),-    arrayOf("nl", "Dutch"), arrayOf("pl", "Polish"), arrayOf("tr", "Turkish"),-    arrayOf("sv", "Swedish"), arrayOf("da", "Danish"), arrayOf("no", "Norwegian"),-    arrayOf("fi", "Finnish"), arrayOf("cs", "Czech"), arrayOf("hu", "Hungarian"),-    arrayOf("el", "Greek"), arrayOf("he", "Hebrew"), arrayOf("th", "Thai"),-    arrayOf("vi", "Vietnamese"), arrayOf("id", "Indonesian"), arrayOf("ms", "Malay"),-    arrayOf("uk", "Ukrainian"), arrayOf("ro", "Romanian"), arrayOf("bg", "Bulgarian"),-    arrayOf("hr", "Croatian"), arrayOf("sk", "Slovak"), arrayOf("sl", "Slovenian"),-    arrayOf("lt", "Lithuanian"), arrayOf("lv", "Latvian"), arrayOf("et", "Estonian"),-    arrayOf("sr", "Serbian"), arrayOf("ca", "Catalan"), arrayOf("eu", "Basque"),-    arrayOf("gl", "Galician"), arrayOf("is", "Icelandic"), arrayOf("ga", "Irish"),-    arrayOf("mt", "Maltese"), arrayOf("cy", "Welsh"), arrayOf("af", "Afrikaans"),-    arrayOf("sq", "Albanian"), arrayOf("hy", "Armenian"), arrayOf("az", "Azerbaijani"),-    arrayOf("be", "Belarusian"), arrayOf("bn", "Bengali"), arrayOf("bs", "Bosnian"),-    arrayOf("ka", "Georgian"), arrayOf("km", "Khmer"), arrayOf("kn", "Kannada"),-    arrayOf("ky", "Kyrgyz"), arrayOf("lo", "Lao"), arrayOf("mk", "Macedonian"),-    arrayOf("ml", "Malayalam"), arrayOf("mn", "Mongolian"), arrayOf("my", "Burmese"),-    arrayOf("ne", "Nepali"), arrayOf("pa", "Punjabi"), arrayOf("si", "Sinhala"),-    arrayOf("ta", "Tamil"), arrayOf("te", "Telugu"), arrayOf("ur", "Urdu"),-    arrayOf("uz", "Uzbek"),-)--// Verified Google holiday-feed slugs-private val SLUGS = arrayOf(-    "usa", "uk", "canadian", "australian", "indian", "irish", "french", "german",-    "italian", "spain", "portuguese", "dutch", "danish", "finnish", "norwegian", "swedish",-    "polish", "russian", "ukrainian", "austrian", "bulgarian", "croatian", "czech", "greek",-    "hungarian", "latvian", "lithuanian", "romanian", "slovak", "slovenian", "turkish", "japanese",-    "china", "taiwan", "hong_kong", "south_korea", "singapore", "indonesian", "malaysia", "philippines",-    "vietnamese", "brazilian", "mexican", "new_zealand", "jewish", "christian", "islamic", "judaism",-    "hinduism", "orthodox_christianity", "sa", "ar", "cl", "co", "pe", "th",-    "be", "ch", "lu", "is", "rs", "eg", "pk", "bd",-    "af", "al", "dz", "ad", "ao", "ag", "am", "az",-    "bs", "bh", "bb", "by", "bz", "bj", "bt", "bo",-    "ba", "bw", "bn", "bf", "bi", "cv", "kh", "cm",-    "cf", "td", "km", "cg", "cd", "cr", "ci", "cu",-    "cy", "dj", "dm", "do", "ec", "sv", "gq", "er",-    "ee", "sz", "et", "fj", "ga", "gm", "ge", "gh",-    "gd", "gt", "gn", "gw", "gy", "ht", "hn", "ir",-    "iq", "jm", "jo", "kz", "ke", "ki", "kw", "kg",-    "la", "lb", "ls", "lr", "ly", "li", "mg", "mw",-    "mv", "ml", "mt", "mh", "mr", "mu", "fm", "md",-    "mc", "mn", "me", "ma", "mz", "mm", "na", "nr",-    "np", "ni", "ne", "ng", "mk", "om", "pw", "pa",-    "pg", "py", "qa", "rw", "kn", "lc", "vc", "ws",-    "sm", "st", "sn", "sc", "sl", "sb", "so", "ss",-    "lk", "sd", "sr", "sy", "tj", "tz", "tl", "tg",-    "to", "tt", "tn", "tm", "tv", "ug", "ae", "uy",-    "uz", "vu", "ve", "ye", "zm", "zw", "mo", "pr",-    "gu", "vi",-)--private val HTTP = HttpClient.newBuilder()-    .followRedirects(HttpClient.Redirect.NORMAL)-    .connectTimeout(Duration.ofSeconds(30))-    .build()--fun main(args: Array<String>) {-    val startSlug = args.firstOrNull()-    val baseDir = File("calendar/src/main/assets/holidays")-    val resume = startSlug != null && baseDir.exists()--    if (!resume) {-        baseDir.deleteRecursively()-    }-    if (!baseDir.exists() && !baseDir.mkdirs()) {-        throw IllegalStateException("Could not create ${baseDir.absolutePath}")-    }-    if (resume) {-        println("Resuming from slug: $startSlug")-    }--    // Write languages.json at top level-    val langsJson = buildString {-        append("[")-        LANGS.forEachIndexed { i, pair ->-            if (i > 0) append(',')-            append("{\"code\":\"${pair[0]}\",\"name\":${jsonString(pair[1])}}")-        }-        append("]")-    }-    Files.write(-        File(baseDir, "languages.json").toPath(),-        langsJson.toByteArray(Charsets.UTF_8)-    )--    // Phase 1: Build canonical slug -> code mapping from English feed-    println("Phase 1/2: Building canonical index from English...")-    val slugToCode = mutableMapOf<String, String>()-    val codeToName = mutableMapOf<String, String>()-    val canonicalIndex = mutableListOf<Array<String>>()--    for (i in SLUGS.indices) {-        val slug = SLUGS[i]-        printProgress("  Fetching English", i + 1, SLUGS.size)-        try {-            val ics = get(String.format(URL_TEMPLATE, "en", slug))-            val lines = unfold(ics)-            val name = calendarName(lines) ?: continue-            val code = name.replace(Regex("[^A-Za-z0-9]"), "")-            slugToCode[slug] = code-            codeToName[code] = name-            canonicalIndex.add(arrayOf(code, name))-        } catch (ex: Exception) {-            System.err.println("\n  [en] Skipping $slug: ${ex.message}")-        }-    }-    println()-    canonicalIndex.sortWith { a, b -> a[1].compareTo(b[1], ignoreCase = true) }-    println("  \u2713 Canonical: ${canonicalIndex.size} countries found\n")--    // Write top-level index.json-    val topIdx = buildString {-        append("[")-        canonicalIndex.forEachIndexed { i, entry ->-            if (i > 0) append(',')-            append("{\"code\":\"${entry[0]}\",\"name\":${jsonString(entry[1])}}")-        }-        append("]")-    }-    Files.write(-        File(baseDir, "index.json").toPath(),-        topIdx.toByteArray(Charsets.UTF_8)-    )--    // Phase 2: For each slug, fetch English first, then other langs-    println("Phase 2/2: Fetching localized holidays (comparing to English, only saving differences)...")-    val countryLangs = mutableMapOf<String, MutableSet<String>>()--    if (resume) {-        val clFile = File(baseDir, "country_languages.json")-        if (clFile.exists()) {-            try {-                val clText = String(Files.readAllBytes(clFile.toPath()), Charsets.UTF_8)-                val re = Regex("\"([^\"]+)\":\\[([^\\]]*)\\]")-                for (m in re.findAll(clText)) {-                    val c = m.groupValues[1]-                    val langs = m.groupValues[2].replace("\"", "").split(",")-                    val set = mutableSetOf<String>()-                    for (lang in langs) if (lang.trim().isNotEmpty()) set.add(lang.trim())-                    if (set.isNotEmpty()) countryLangs[c] = set-                }-                println("  Loaded existing progress for ${countryLangs.size} countries")-            } catch (_: Exception) { /* ignore */ }-        }-    }--    var totalWritten = 0-    val totalCountries = slugToCode.size-    var countryIdx = 0-    val totalLangs = LANGS.size - 1-    var started = (startSlug == null)--    for (slug in SLUGS) {-        if (!started) {-            if (slug == startSlug) started = true-            else continue-        }-        val code = slugToCode[slug] ?: continue-        countryIdx++--        // Fetch English baseline-        val enHolidays: List<Array<String>>-        try {-            val enIcs = get(String.format(URL_TEMPLATE, "en", slug))-            enHolidays = parseEvents(unfold(enIcs))-            if (enHolidays.isEmpty()) continue-            (enHolidays as MutableList).sortWith { a, b ->-                val c = a[0].compareTo(b[0])-                if (c != 0) c else a[1].compareTo(b[1], ignoreCase = true)-            }-        } catch (ex: Exception) {-            System.err.println("\n  [en] Skipping $slug: ${ex.message}")-            continue-        }--        // Write English-        val enDir = File(baseDir, "en")-        enDir.mkdirs()-        writeHolidays(File(enDir, "$code.json"), enHolidays)-        countryLangs.getOrPut(code) { mutableSetOf() }.add("en")-        totalWritten++--        // Fetch other languages, compare to English-        var langIdx = 0-        var distinctCount = 1-        for (langPair in LANGS) {-            val lang = langPair[0]-            if (lang == "en") continue-            langIdx++-            printProgress(-                "  [$countryIdx/$totalCountries] $code ($distinctCount langs)",-                langIdx, totalLangs-            )-            try {-                val ics = get(String.format(URL_TEMPLATE, lang, slug))-                val holidays = parseEvents(unfold(ics))-                if (holidays.isEmpty()) continue-                (holidays as MutableList).sortWith { a, b ->-                    val c = a[0].compareTo(b[0])-                    if (c != 0) c else a[1].compareTo(b[1], ignoreCase = true)-                }--                if (holidaysEqual(enHolidays, holidays)) continue--                val langDir = File(baseDir, lang)-                langDir.mkdirs()-                writeHolidays(File(langDir, "$code.json"), holidays)-                countryLangs.getOrPut(code) { mutableSetOf() }.add(lang)-                distinctCount++-                totalWritten++-            } catch (_: Exception) {-                // skip silently-            }-        }-    }-    println()--    // Write per-language index.json-    for (langPair in LANGS) {-        val lang = langPair[0]-        val langDir = File(baseDir, lang)-        if (!langDir.exists()) continue-        val index = mutableListOf<Array<String>>()-        for (entry in canonicalIndex) {-            if (File(langDir, "${entry[0]}.json").exists()) {-                index.add(arrayOf(entry[0], entry[1]))-            }-        }-        index.sortWith { a, b -> a[1].compareTo(b[1], ignoreCase = true) }-        val idx = buildString {-            append("[")-            index.forEachIndexed { i, e ->-                if (i > 0) append(',')-                append("{\"code\":\"${e[0]}\",\"name\":${jsonString(e[1])}}")-            }-            append("]")-        }-        Files.write(-            File(langDir, "index.json").toPath(),-            idx.toByteArray(Charsets.UTF_8)-        )-    }--    // Copy English to flat structure for backward compat-    val enDir = File(baseDir, "en")-    val enFiles = enDir.listFiles { _, n -> n.endsWith(".json") && n != "index.json" }-    enFiles?.forEach { src ->-        Files.copy(src.toPath(), File(baseDir, src.name).toPath())-    }--    // Write country_languages.json-    val cl = buildString {-        append("{")-        var first = true-        for ((key, langs) in countryLangs) {-            if (!first) append(',')-            first = false-            append("\"$key\":[")-            var firstLang = true-            for (lc in langs) {-                if (!firstLang) append(',')-                firstLang = false-                append("\"$lc\"")-            }-            append("]")-        }-        append("}")-    }-    Files.write(-        File(baseDir, "country_languages.json").toPath(),-        cl.toByteArray(Charsets.UTF_8)-    )--    println("  \u2713 Wrote $totalWritten files across ${LANGS.size} languages to ${baseDir.absolutePath}")-}--private fun printProgress(label: String, current: Int, total: Int) {-    val width = 30-    val filled = (current.toDouble() / total * width).toInt()-    val bar = buildString {-        append("\r$label [")-        for (i in 0 until width) append(if (i < filled) "\u2588" else "\u2591")-        append("] $current/$total (${"%.0f".format(current.toDouble() / total * 100)}%)")-    }-    print(bar)-    if (current == total) println()-    System.out.flush()-}--private fun holidaysEqual(a: List<Array<String>>, b: List<Array<String>>): Boolean {-    if (a.size != b.size) return false-    for (i in a.indices) {-        if (a[i][0] != b[i][0] || a[i][1] != b[i][1]) return false-    }-    return true-}--private fun writeHolidays(out: File, holidays: List<Array<String>>) {-    val sb = buildString {-        append("[")-        holidays.forEachIndexed { i, h ->-            if (i > 0) append(',')-            append("{\"d\":\"${h[0]}\",\"n\":${jsonString(h[1])}}")-        }-        append("]")-    }-    Files.write(out.toPath(), sb.toByteArray(Charsets.UTF_8))-}--private fun calendarName(lines: List<String>): String? {-    for (line in lines) {-        if (line.startsWith("X-WR-CALNAME:")) {-            return line.substring("X-WR-CALNAME:".length)-                .replace(Regex("^Holidays and Observances in "), "")-                .replace(Regex("^Holidays in "), "")-                .trim()-        }-    }-    return null-}--private fun parseEvents(lines: List<String>): List<Array<String>> {-    val out = mutableListOf<Array<String>>()-    var inEvent = false-    var summary: String? = null-    var date: String? = null-    for (line in lines) {-        when {-            line == "BEGIN:VEVENT" -> { inEvent = true; summary = null; date = null }-            line == "END:VEVENT" -> {-                if (summary != null && date != null) out.add(arrayOf(date!!, summary!!))-                inEvent = false-            }-            !inEvent -> continue-            else -> {-                val colon = line.indexOf(':')-                if (colon <= 0) continue-                val left = line.substring(0, colon).uppercase()-                val value = line.substring(colon + 1)-                when {-                    left == "SUMMARY" -> summary = unescape(value)-                    left.startsWith("DTSTART") -> {-                        val d = Regex("(\\d{4})(\\d{2})(\\d{2})").find(value)-                        if (d != null) date = "${d.groupValues[1]}-${d.groupValues[2]}-${d.groupValues[3]}"-                    }-                }-            }-        }-    }-    return out-}--private fun unfold(ics: String): List<String> {-    val out = mutableListOf<String>()-    for (raw in ics.split(Regex("\\r?\\n"))) {-        if ((raw.startsWith(" ") || raw.startsWith("\t")) && out.isNotEmpty()) {-            out[out.lastIndex] = out.last() + raw.substring(1)-        } else {-            out.add(raw)-        }-    }-    return out-}--private fun unescape(s: String): String {-    val b = StringBuilder()-    var i = 0-    while (i < s.length) {-        val c = s[i]-        if (c == '\\' && i + 1 < s.length) {-            val n = s[++i]-            when (n) {-                'n', 'N' -> b.append(' ')-                ',' -> b.append(',')-                ';' -> b.append(';')-                '\\' -> b.append('\\')-                else -> b.append(n)-            }-        } else {-            b.append(c)-        }-        i++-    }-    return b.toString().trim()-}--private fun get(url: String): String {-    val req = HttpRequest.newBuilder(URI.create(url))-        .header("User-Agent", "Mozilla/5.0 (holidaygen)")-        .timeout(Duration.ofSeconds(60))-        .GET().build()-    val resp = HTTP.send(req, HttpResponse.BodyHandlers.ofString(Charsets.UTF_8))-    if (resp.statusCode() / 100 != 2) {-        throw IllegalStateException("HTTP ${resp.statusCode()}")-    }-    return resp.body()-}--private fun jsonString(s: String): String {-    val b = StringBuilder("\"")-    for (c in s) {-        when (c) {-            '"' -> b.append("\\\"")-            '\\' -> b.append("\\\\")-            '\n' -> b.append("\\n")-            '\r' -> b.append("\\r")-            '\t' -> b.append("\\t")-            else -> if (c.code < 0x20) b.append("\\u%04x".format(c.code))-            else b.append(c)-        }-    }-    return b.append('"').toString()-}