compose-ai-contrib

June 6, 2026 · View on GitHub

Non-Gradle integrations of compose-preview — fixtures and contract tests that exercise the published ee.schimke.composeai:* artifacts from JetBrains Amper and Bazel builds.

The published artifacts (preview-discovery, daemon-launch-builder, render-cli) ship as plain Maven coordinates with java -jar entrypoints. This repo proves they're consumable without AGP or Gradle, and pins the wire formats — previews.json and daemon-launch.json — that downstream build-system integrations key off.

Fixtures

DirectoryBuild systemDemonstrates
amper-android/Amper 0.10Android APK with @Composable @Preview and @NotificationPreview, no Gradle
amper-cmp-desktop/Amper 0.10Compose Desktop module driving a real RenderSession end-to-end
bazel/Bazel (bzlmod)Resources discovery rule producing resources.json
bazel-desktop/Bazel (bzlmod)Compose Desktop kt_jvm_library packed into a portable preview bundle (bundle_preview); bundle published in CI
bazel-apk/Bazel (bzlmod)Compose APK via rules_kotlin + rules_android on Bazel 9
buck2/Buck2 (bundled prelude)Resources discovery rule producing resources.json — byte-identical to the Bazel sample

Each directory is self-contained — see its README for build instructions.

Standalone binaries

ModuleDescription
compose-preview-scripting/compose-preview-scripting <path.composepreview.kts> — Kotlin scripting host that renders previews via gradle-preview-driver and evaluates a user script against the result set. Lifted from upstream's examples/scripting/ reference (yschimke/compose-ai-tools PR #1375). Builds against preview-data-api + gradle-preview-driver, published to Maven Central since composeai 0.11.15.
bundle-producer/Build-system-agnostic portable-bundle producer — the ClassGraph reachability closure, the PNG+ZIP polyglot writer, and Maven-coordinate / maven_install.json recovery the Amper and Bazel drivers use to emit a schema-v4 bundle.json the upstream :bundle-viewer can open. See docs/portable-bundles.md.

Documentation

Repo Gradle build

A thin Gradle project at the root drives one job: the contract test in contract-tests/amper-cmp-desktop/, which resolves the published ee.schimke.composeai:* artifacts from Maven Central, builds a daemon-launch.json descriptor against the Amper fixture's compiled output, and renders the fixture's @Preview through SubprocessRenderSessions. End-to-end proof that the released artifacts work for a non-Gradle consumer.

# build the Amper fixture (produces kotlin-output/)
cd amper-cmp-desktop && ./amper build && cd ..

# run the contract test
./gradlew :contract-tests:amper-cmp-desktop:test

The version of compose-ai-tools under test is pinned in gradle/libs.versions.toml under composeai. Bump in lockstep with upstream releases.

CI

Build / test workflows

Preview / resource publish workflows

Each build system that can produce renders or resource manifests has a matching *-apply.yml workflow that runs on PRs touching that project and on pushes to main. On PRs it posts a sticky comment with changed renders/resources; on main it updates the compose-preview/main baseline branch.

WorkflowPublishesBranch path
amper-apply.yml@Preview renders from Amper Desktop fixturecompose-preview/amper/{main,pr}
scripting-apply.yml@Preview renders from compose-preview-scripting democompose-preview/scripting/{main,pr}
bazel-apply.ymlapp_resources.json from Bazel resources-discoverycompose-preview/bazel/{main,pr}
buck2-apply.ymlapp_resources.json from Buck2 resources-discoverycompose-preview/buck2/{main,pr}

amper-android is excluded — Android preview rendering requires the Gradle plugin + Robolectric, neither of which is available in a pure Amper module.

Versioning

This repo doesn't publish artifacts; it consumes them. The single composeai version in gradle/libs.versions.toml is the only knob — when yschimke/compose-ai-tools cuts a release, bump that line and let CI prove the new version still works for non-Gradle consumers.

License

Apache 2.0.