8000 Android getting-started: ThicketAndroidPlugin, templates/hello-thicket-android, a verify script by rleibman · Pull Request #164 · rleibman/thicket · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script type="application/json" data-target="react-partial.embeddedData">{"props":{"contextRegion":{"crumbs":[{"crumb_type":"user","label":"rleibman","is_root":false,"href":"/rleibman"},{"crumb_type":"repository","label":"thicket","is_root":false,"href":"/rleibman/thicket"}],"localNavigation":[{"id":"code","icon":"code","label":"Code","href":"/rleibman/thicket","selectedLinks":["repo_source","repo_downloads","repo_commits","repo_releases","repo_tags","repo_branches","repo_packages","repo_deployments","repo_attestations"],"popoverTarget":false,"commandId":"repositories:go-to-code","reactNav":{"appTarget":"code-view","anchor":"code-view-repo-link"},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"issues","icon":"issue-opened","label":"Issues","href":"/rleibman/thicket/issues","selectedLinks":["repo_issues","repo_labels","repo_milestones"],"count":3,"popoverTarget":false,"commandId":"repositories:go-to-issues","reactNav":{"appTarget":"repo","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"pull-requests","icon":"git-pull-request","label":"Pull requests","href":"/rleibman/thicket/pulls","selectedLinks":["repo_pulls","checks"],"count":0,"popoverTarget":false,"commandId":"repositories:go-to-pull-requests","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"actions","icon":"play","label":"Actions","href":"/rleibman/thicket/actions","selectedLinks":["repo_actions"],"popoverTarget":false,"commandId":"repositories:go-to-actions","reactNav":{"appTarget":"repo","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"projects","icon":"table","label":"Projects","href":"/rleibman/thicket/projects","selectedLinks":["repo_projects","new_repo_project","repo_project"],"popoverTarget":false,"commandId":"repositories:go-to-projects","reactNav":{"appTarget":"repo","anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"security-and-quality","icon":"shield","label":"Security and quality","href":"/rleibman/thicket/security","selectedLinks":["security","overview","alerts","policy","token_scanning","code_scanning"],"count":0,"popoverTarget":false,"commandId":"repositories:go-to-security","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}},{"id":"insights","icon":"graph","label":"Insights","href":"/rleibman/thicket/pulse","selectedLinks":["repo_graphs","repo_contributors","dependency_graph","dependabot_updates","pulse","people","community"],"popoverTarget":false,"commandId":"repositories:go-to-insights","reactNav":{"appTarget":null,"anchor":null},"turboNav":{"frame":"repo-content-turbo-frame"}}],"localNavigationUpdateChannel":null,"selectedLink":"repo_pulls"},"owner":null,"headerLogo":{"href":"/","aria-label":"Homepage "},"notifications":{"indicatorMode":"disabled","websocketChannel":null,"fetchIndicatorSrc":"/notifications/indicator","fetchIndicatorEnabled":false},"issues":{"href":"/issues"},"pulls":{"href":"/pulls"},"contributedRepos":{"href":"/repos"},"copilot":{"show":false,"showAgentsButton":false,"showRelaunchAnnouncement":false,"copilotChatUrl":null,"copilotApiUrl":"https://api.githubcopilot.com"},"search":{"show":true,"showCommandPalette":false,"isSearchPage":false,"isJumpToSearch":false,"searchContext":{"scope":"repo:rleibman/thicket","current_repo_name":"thicket","current_repo_nwo":"rleibman/thicket","user_id":"rleibman"}},"commandPalette":null,"enterpriseBar":{"show":false},"globalTransactionalMessage":[],"payloadsUrl":"/_global-navigation/payloads.json?can_toggle_site_admin_and_employee_status=0\u0026is_admin_mode_on=0\u0026is_ui_opted_out=0\u0026show_ui_opt_out=0\u0026v=8","contextRegionUrl":null}}

Android getting-started: ThicketAndroidPlugin, templates/hello-thicket-android, a verify script - #164

Merged
rleibman merged 4 commits into
mainfrom
feat/android-getting-started
Nov 13, 2026
Merged

rleibman merged 4 commits into
mainfrom
feat/android-getting-started

Conversation

@rleibman
Copy link
Copy Markdown
Owner

This builds option A from docs/18 (#163), as you chose: sbt compiles the Scala, and the app's own Gradle project packages it, with a debug APK by default.

What's added

  • ThicketAndroidPlugin in sbt-thicket. It adds:

    • thicket-renderer-android at the plugin's own version;
    • -release 17;
    • the SDK's android.jar on the compile classpath only, from ANDROID_HOME;
    • exportJars;
    • thicketApk (debug) and thicketApkRelease. Each copies the runtime jars into android/app/libs, deleting old ones first, then runs gradlew assemble<Variant>.
  • templates/hello-thicket-android: the counter app as a ThicketActivity, plus a Gradle project the app owns. It already carries the three settings phase 0 found Scala needs on Android: R8 full mode off, the *$lzy* keep rule, and the **/*.tasty exclusion.

  • bin/verify-getting-started-android.sh. Two modes like the others: local publish, or THICKET_VERSION for Central only.

    1. It builds the template outside the repo and installs it on the emulator.
    2. It reads Clicked 0 times with uiautomator, taps the button, and reads Clicked 1 times.
    3. It checks the process is still alive and no FATAL EXCEPTION was logged.

    VARIANT=release checks the R8 build. ALLOW_NO_DEVICE=1 stops after the APK; CI now runs that in the Linux job.

  • Docs: the README's getting-started, the sbt-thicket README, docs/14 §14.3, and a decision-log entry.

Measured (s2test emulator, API 36)

Check Result
debug PASS, APK 3 320 274 bytes
release (VARIANT=release) PASS, APK 182 026 bytes
without .safeArea() on the template's root FAIL. Android 15+ draws edge to edge, so the title bar (y 166–237) lay over the button (y 130–256) and took the tap
ALLOW_NO_DEVICE=1, no device PASS (build only); without the flag: FAIL, exit 1
sbt --error checkLinux exit 0, 356 passed, 0 failed

Findings, not fixed here

  • Edge to edge on Android. A first screen without .safeArea() is hidden under the system bars and the title bar on Android 15+. On GTK and macOS the same tree is fine. That's a trap for anyone writing one tree for every platform. Options: AppRoot applying the safe area by default, or ThicketActivity placing pages below the action bar. That's a design choice, so I've left it for you.
  • This plugin isn't in 0.2.0. The template defaults to 0.2.0 like the others, but it only works with the next release, or with a local publish as the README says. Released mode can't pass until then.
  • docs/18's status stays "being built" in docs/18: options for an Android app outside this repository (proposed) #163. I'll mark it built once both PRs are in, so this PR doesn't have to sit on top of docs/18: options for an Android app outside this repository (proposed) #163.

🤖 Generated with Claude Code

…t-android, a verify script

docs/18 option A, as the owner chose (2026-11-12): sbt compiles, the app's own
Gradle project packages, a debug APK by default.

- ThicketAndroidPlugin (sbt-thicket): thicket-renderer-android at the plugin's
  version, -release 17, the SDK's android.jar on the compile classpath only
  (ANDROID_HOME / ANDROID_SDK_ROOT / default; android-36), exportJars, and
  thicketAndroidJars / thicketApk / thicketApkRelease: the runtime jars into
  android/app/libs (stale ones deleted), then gradlew assemble<Variant>.
- templates/hello-thicket-android: the counter app as a ThicketActivity, plus an
  app-owned Gradle project carrying S2's three mandatory settings (R8 full mode
  off, the *$lzy* keep rule, the **/*.tasty exclusion). Defaults to 0.2.0 like
  the other templates, though the plugin needs the next release.
- bin/verify-getting-started-android.sh: local-publish or THICKET_VERSION
  (Central-only) mode, as the others; builds outside the repo, installs on the
  emulator, reads "Clicked 0 times" with uiautomator, taps, reads "Clicked 1
  times", checks the process is alive and no FATAL EXCEPTION. VARIANT=release
  checks the R8 build. ALLOW_NO_DEVICE=1 stops after the APK; CI runs that.
- Docs: README getting-started, sbt-thicket README, docs/14 §14.3, decision log.

Measured (s2test emulator, API 36):
- debug: PASS, APK 3 320 274 bytes; release: PASS, APK 182 026 bytes.
- Before `.safeArea()` on the template's root, the check FAILED: Android 15+
  draws edge to edge, the title bar (y 166-237) lay over the button (y 130-256)
  and took the tap; "Clicked 1 times" never appeared.
- ALLOW_NO_DEVICE=1 with no device: PASS (build only); without it: FAIL, exit 1.
- sbt --error checkLinux: exit 0, 356 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.

🟡 Changes recommended

The change still has an unresolved cross-platform bug where the Gradle invocation is hard-coded to use the Unix gradlew wrapper, which will break the Android build tasks on Windows despite including gradlew.bat.

1 open issue
What changed in this PR

Adds an Android getting-started workflow for Thicket using an sbt plugin that compiles Scala and an app-owned Gradle project that packages APKs, plus a template, verification script, CI wiring, and docs updates.

Changes:

  • Add ThicketAndroidPlugin to stage runtime jars into android/app/libs and run Gradle assembleDebug/Release.
  • Add templates/hello-thicket-android with a minimal ThicketActivity counter app and Gradle wrapper/project configured for Scala-on-Android packaging/R8 constraints.
  • Add bin/verify-getting-started-android.sh, run its build-only mode in Linux CI, and update README/docs/decision log.
File Description
tools/​sbt-thicket/​src/​main/​scala/​thicket/​sbt/​ThicketAndroidPlugin.scala Introduces a new sbt plugin that wires Android compile-time dependencies, exports/stages jars into an Android Gradle project, and provides tasks to build debug/release APKs via the Gradle wrapper.
tools/​sbt-thicket/​README.md Documents how to use the new Android sbt plugin and the associated getting-started workflow.
templates/​hello-thicket-android/​src/​main/​scala/​hello/​MainActivity.scala Adds the Android template app entrypoint implemented as a ThicketActivity with a minimal counter UI.
templates/​hello-thicket-android/​project/​plugins.sbt Configures the template’s sbt meta-build to use the sbt-thicket plugin (versioned via env/defaults) and relevant resolvers.
templates/​hello-thicket-android/​project/​build.properties Pins the sbt version used by the Android template.
templates/​hello-thicket-android/​build.sbt Defines the template sbt build that enables ThicketAndroidPlugin for compiling/staging artifacts for the Gradle project.
templates/​hello-thicket-android/​android/​settings.gradle.kts Adds Gradle settings for the template’s app-owned Android project.
templates/​hello-thicket-android/​android/​gradlew.bat Adds the Windows Gradle wrapper script for the template Android project.
templates/​hello-thicket-android/​android/​gradlew Adds the Unix Gradle wrapper script for the template Android project.
templates/​hello-thicket-android/​android/​gradle/​wrapper/​gradle-wrapper.properties Pins the Gradle wrapper distribution/version for the template Android project.
templates/​hello-thicket-android/​android/​gradle.properties Adds Gradle properties for the template, including Scala-required build/shrinker settings.
templates/​hello-thicket-android/​android/​build.gradle.kts Adds the root Gradle build configuration for the template Android project.
templates/​hello-thicket-android/​android/​app/​src/​main/​AndroidManifest.xml Adds a minimal Android manifest defining the application and launcher activity for the template.
templates/​hello-thicket-android/​android/​app/​scala3.pro Adds R8/Proguard rules required for Scala 3 runtime behavior on Android.
templates/​hello-thicket-android/​android/​app/​build.gradle.kts Defines the Android app module configuration including SDK levels, packaging exclusions, shrinker settings, and jar dependencies from libs/.
templates/​hello-thicket-android/​.gitignore Updates ignore rules for the Android template, including generated build outputs and staged libs.
README.md Updates the main README with Android getting-started instructions using the new template and plugin.
docs/​decisions.md Records the decision and rationale for the chosen Android getting-started approach.
docs/​14-releasing.md Updates release documentation to note Android-related plugin/template availability and constraints.
bin/​verify-getting-started-android.sh Adds a verification script that builds the Android template outside the repo and optionally installs/runs UI checks (with a CI-friendly build-only mode).
.github/​workflows/​ci.yml Wires the Android getting-started verification script into CI in build-only mode on Linux.

Review effort: Balanced

rleibman and others added 3 commits November 12, 2026 16:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
One conflict: docs/decisions.md, where both sides added a 2026-11-12 entry at
the top of the log. Both kept, the Android entry first.

Statements #162 brought in that this branch makes untrue, corrected in the same
merge: README's "no Android template or plugin yet" and docs/13's phase-5
"Still open: an Android template and plugin". docs/18's status (#163) goes from
"being built" to built.

Measured: sbt --error checkLinux on the merged tree, exit 0, 356 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rleibman
rleibman merged commit 6a3eab6 into main Nov 13, 2026
0 of 2 checks passed
rleibman added a commit that referenced this pull request Nov 13, 2026
One conflict: docs/decisions.md, where main's two 2026-11-12 entries and this
branch's 2026-11-03 camera-preview entry were both added at the top. All kept,
newest first.

Brought in line with rules main gained since this branch:
- thicket-camera-preview-apple sets `description` (#157: every published module
  does; the POM's description is what Central's search shows).
- The Swift-carrying Apple modules are eight with this one, not seven:
  docs/14 §14.5 and bin/release.sh's header. docs/14's 2026-11-09 rehearsal
  record keeps "seven", which was true then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0