Personal template for developing apps with the Light SDK.
- Structure
light-sdkis a top-level submodule, and custom application code lives intool/. This template provides custom Gradle wiring to get this architecture to work correctly.- This is to get around the one-fork-per-account problem while also cleanly ensuring tools can easily pull SDK updates.
- Includes a sample tool with my preferred defaults and code style.
- Includes a Nix development shell. It is catered toward headless development and on-device testing.
- Automations
- CI:
:tool:assembleDebug,:tool:teston every push/PR to main - Nightly SDK update check: Dependabot checks the
light-sdksubmodule daily, opening/updating a PR when there's a new commit. - Releases: pushing a
v*tag (e.g.v0.2.0) builds a signed release APK and creates a GitHub Release with it attached. - Template propagation (TODO): Each child repo will keep
light-sdk-templateas a remote; GH action will check it nightly.
- CI:
Add a Github personal access token (PAT) with read:packages scope for resolving the private Github Packages dependency.
- Local development: Put it in
local.propertiesasgpr.user/gpr.key(gitignored). - CI: Add it as repo secrets for Actions and Dependabot:
GH_PACKAGES_USER,GH_PACKAGES_TOKENunder Settings -> Secrets.
git checkout -b refactor/light-sdk-rewrite
# Wipe everything!
# rm -rf *export LIGHT_SDK_TEMPLATE_PATH=~/Github/light/light-sdk-template
# 1. Submodule
git submodule add https://github.com/lightphone/light-sdk.git light-sdk
# 2. Gradle wiring + devshell + gitignore
cp $LIGHT_SDK_TEMPLATE_PATH/settings.gradle.kts .
cp $LIGHT_SDK_TEMPLATE_PATH/build.gradle.kts .
cp $LIGHT_SDK_TEMPLATE_PATH/gradle.properties .
cp -r $LIGHT_SDK_TEMPLATE_PATH/gradle .
cp $LIGHT_SDK_TEMPLATE_PATH/gradlew .
cp $LIGHT_SDK_TEMPLATE_PATH/gradlew.bat .
chmod +x gradlew
cp $LIGHT_SDK_TEMPLATE_PATH/flake.nix .
cp $LIGHT_SDK_TEMPLATE_PATH/.gitignore .
# 3. Demo tool scaffold as a starting point
cp -r $LIGHT_SDK_TEMPLATE_PATH/tool .
# 4. CI + Dependabot + release automation
mkdir -p .github/workflows
cp $LIGHT_SDK_TEMPLATE_PATH/.github/workflows/*.yml .github/workflows/
cp $LIGHT_SDK_TEMPLATE_PATH/.github/dependabot.yml .github/
# 5. Helper script + license
mkdir -p scripts
cp $LIGHT_SDK_TEMPLATE_PATH/scripts/new-project.sh scripts/
chmod +x scripts/new-project.sh
cp $LIGHT_SDK_TEMPLATE_PATH/LICENSE .For updating the flake, custom scripts, or custom gradle wiring (not light-sdk).
# One-time setup
git remote add template git@github.com:garado/light-sdk-template.git
# Pull in template improvements
git fetch template
git merge template/main --allow-unrelated-histories
# This will conflict on files meant to stay project-specific
# TODO Add script to autoresolve# Enter Nix development shell
nix develop
# Run interactive project setup script (auto-renames stuff)
./scripts/new-project.sh
# Build
./gradlew :tool:installDebugFor personal reference
- Components
- Layout/Nav:
LightTopBarLightBottomBar(up to 5 icons, or 3 if mixing in text)LightFullscreenModalLightScrollViewLightGrid(spacing constants)LightModalManager: transient overlays, timeout/dismiss
- Text:
LightText(variants: Title, Subtitle, Heading, Subheading, Copy, Button, Paragraph, ParagraphWide, Detail, Fine, Superfine, Micro)LightFont
- Input:
LightTextField(read-only, opens editor on tap)LightTextInputEditorLightEmbeddedLp3KeyboardLightKeyHandler: hardware key event forwarding (down/up/multiple)
- Icons/media:
LightIcon/LightIcons(full icon set)LightQrCodeScannerLightProgressBar
- Audio:
LightAudio(factory offSealedLightActivity): handles foreground audio focus internallyLightAudioPlayerLightAudioRecorderLightAudioCaptureLightAudioVoice
- Interaction/theming:
lightClickable(no press ripple)LightTheme/LightThemeColors/LightThemeController/LightThemeTokens
- Layout/Nav:
- Permissions
INTERNETACCESS_NETWORK_STATEWAKE_LOCKVIBRATEPOST_NOTIFICATIONSCAMERARECORD_AUDIOREAD_MEDIA_AUDIOACCESS_FINE_LOCATIONACCESS_COARSE_LOCATIONNFC