ADFA-4857 | Add project-to-template plugin - #56
Conversation
… .cgt template) Incorporates the standalone templatize-project plugin into the monorepo as project-to-template, conforming to repo conventions and wired into the build and website-deploy pipelines. - Full rename to org.appdevforall.projecttotemplate / "Project to Template". - Uses shared repo-root ../libs/*.jar and ../gradlew (no bundled copies). - Fixes tooltip category to the full plugin.id (plugin_org.appdevforall.projecttotemplate) so the in-IDE tooltip renders real text instead of "n/a". - Sanitizes the user-typed template name before using it as a filesystem path. - Adds Tier 3 offline docs (assets/docs/index.html) + website documentation page. - New icon: solid project card -> arrow -> dashed template card (day/night PNGs + monochrome ic_plugin vector), replacing the 4-square grid glyph. Source SVGs + generator under icon-src/. - Normalizes user-facing text to "Code On The Go". - Adds README Examples row and update-libs.yml website MAP entry. Device-verified on emulator: installs, activates, sidebar + 3-tier tooltip render, and a real conversion of an open project produces a .cgt that installs via IdeTemplateService.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
jatezzz
left a comment
There was a problem hiding this comment.
Review
Reviewed against freshly-fetched origin/main. I did not build or device-test — taking the PR's "builds clean + emulator-verified end-to-end" at face value.
What's right
The repo conventions are all here, including the ones that usually get missed: tooltip category is the full "plugin_org.appdevforall.projecttotemplate" form (not a slug), TOOLTIP_TAG is a shared const wired to the NavigationItem, Tier 3 getTier3DocsAssetPath() + a real assets/docs/index.html (white bg / black text), repo-root ../libs/*.jar + ../gradlew with no bundled copies, Theme.Material3.DayNight + values-night/, AAR metadata checks disabled, permission strings are exact enum values, sanitizeTemplateName genuinely kills traversal, views nulled in onDestroyView, dry run against a disposable temp copy, and both README + update-libs.yml MAP wiring are present.
Summary of findings
Should fix before merge:
- Dark-mode status colors are hardcoded — the
values-nightvariants are dead resources. - Re-running with a different template name zips the previous run into the new
.cgt. skipCleanupsuppresses the personal-info warning too, including keystores.local.propertiesships in the.cgtby default.
Worth fixing (device-level cost):
- The entire
build/tree is copied, then deleted. - Log rendering is O(n^2) on the main thread.
Minor: install button can't be retried after a failed install; the "unit-testable" KDoc claim is contradicted by android.util.Base64 + unitTests.isReturnDefaultValues = true; UI strings hardcoded rather than in strings.xml; duplicate log lines; isIgnoredUnderRoot is redundant with the onEnter prune; compileSdk/targetSdk = 34 will collide with #54.
Details are in the inline comments.
Verdict
Approve once #1 and #2 are fixed — those two produce visibly wrong output. #3/#4 are judgment calls, but both cut against the plugin's purpose (shipping a template someone else installs), so worth folding in here. Everything else is follow-up material.
Fixes from jatezzz's review: Should-fix (produce visibly wrong output): - Dark-mode status colors: use ContextCompat.getColor(status_*_text) instead of hardcoded light hex, so values-night/ is no longer dead. - Re-run isolation: wipe the whole output dir (not just dest/) before a real run, so a previous template name's tree isn't zipped into the new .cgt. - skipCleanup no longer suppresses the personal-info warning: keystores are flagged (not silently shipped) when cleanup is skipped, and flagPersonalInfoFiles always runs. - local.properties is now in COPY_IGNORE (always machine-specific), so it is never bundled. Worth-fixing: - build/ is skipped at copy time when cleaning up, instead of copied then deleted (hundreds of MB of I/O on device). - Log rendering uses TextView.append() (O(1)/line) instead of rebuilding the whole string per line. Minor: - Install button re-enables after a failed install so it can be retried. - Switch android.util.Base64 -> java.util.Base64 (minSdk 26) and add JVM unit tests for sanitizeTemplateName + a dry-run substitution path. - Move user-facing UI strings into strings.xml. - Remove duplicate per-file [OK] log lines (writePeb already logs). - Drop redundant isIgnoredUnderRoot (onEnter prune + name filter cover it). Verified: testDebugUnitTest + assemblePlugin green; a JVM harness runs the real createTemplateBundle twice (Foo then Bar) and confirms no stale-tree / local.properties / build/ / keystore leakage into the .cgt.
|
Thanks for the thorough review, @jatezzz — addressed everything in 2957e4e. Should-fix
Worth-fixing Minor
Note (12) — left Verification — |
Device verification (emulator, Code On The Go)Installed the debug
|
…-plugin # Conflicts: # .github/workflows/update-libs.yml # README.md
Summary
Incorporates the standalone
templatize-projectplugin into the monorepo asproject-to-template/, conforming to repo conventions and wired into the build + website-deploy pipelines.The plugin adds a Project to Template sidebar item that converts the currently-open Android project into a Code On The Go
.cgttemplate bundle (original untouched — it copies then tokenizes with Pebble${{TOKEN}}s) and can install it straight into the New Project template picker viaIdeTemplateService.What changed on the way in
org.appdevforall.projecttotemplate/ "Project to Template".../libs/*.jarand../gradlew— no bundled jars or wrapper.getTooltipCategory()now returns the fullplugin_org.appdevforall.projecttotemplateid, so the in-IDE tooltip renders real text instead of the literaln/a.assets/docs/index.html) + top-level websiteproject-to-template-documentation.html.ic_pluginvector), replacing the 4-square grid glyph. Source SVGs + generator undericon-src/.update-libs.ymlwebsite MAP entry.Verification
../gradlew assemblePluginandassemblePluginDebugboth build clean.plugin-reviewrubric (green-light; 6.1 min-only IDE version is the repo norm).n/a), and a real conversion of an open project (15 modified) produces a.cgtthat installs viaIdeTemplateService([OK] Installed template).🤖 Generated with Claude Code