Skip to content

[Collect One 1/90] Build system, CI workflows, and tooling (W01) - #2698

Closed
gino-m wants to merge 2 commits into
c1from
review/c1/w01-build-scaffolding
Closed

gino-m wants to merge 2 commits into
c1from
review/c1/w01-build-scaffolding

Conversation

@gino-m

@gino-m gino-m commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Collect One review series: W01 Build system, CI workflows, and tooling (1/90)

Tracking issue: #2629 · Stacked on: c1 · Reviewer: @rfontanarosa
FYI: @gino-m @shobhitagarwal1612

Context

Collect One is the Kotlin Multiplatform successor to Ground: a single shared codebase for the web
console, the mobile app (Android, iOS, browser), and a Spanner-backed user-data service. Forms use
ProtoForms, a lossless proto3 encoding of ODK XForms. Product and architecture background:
docs/product/prd.md, docs/technical/client/architecture.md (they land in the docs slices D01–D03).

This PR is one slice of the wip/baobab tree. It only adds the files listed below. c1 already holds
the first repo scaffolding (#2630), so nine of the files here show as edits rather than additions.

This is the first slice of a re-cut series: the tree is now one root Gradle build, and the series is
sliced along the code's dependency graph. No Gradle module lands here. The root build includes a
module only when its build.gradle.kts is on disk, so this PR configures as an empty build and every
later slice adds modules to it.

What's in this PR

  • settings.gradle.kts: the one Gradle build of the repository. includeIfPresent(":path") includes
    a module only if its build script exists; collectone.serverOnly (Gradle property or
    local.properties) limits the build to :shared:core and :server.
  • build.gradle.kts: loads every Gradle plugin once with apply false, applies collectone.kover to
    merge coverage, and sets the merged line-coverage minimum checked by :koverVerifyJvmTests.
  • gradle/libs.versions.toml: the single version catalog for plugins and libraries.
  • gradle.properties, gradle/gradle-daemon-jvm.properties, gradle/wrapper/gradle-wrapper.properties,
    gradlew, gradlew.bat: Gradle 8.14.5, daemon on JDK 21 (downloaded through the foojay resolver),
    configuration cache and build cache on. gradle-wrapper.jar is not checked in: gradlew downloads
    it and verifies a pinned SHA-256.
  • build-logic/: an included build with the collectone.* convention plugins:
    • collectone.kmp.library (KmpLibraryConventionPlugin): JVM (Java 17 bytecode, JUnit 5) and
      Wasm browser targets; collectone.kmp.android adds the Android target and SDK levels.
    • collectone.kmp.compose, collectone.android.app, collectone.jvm.server (JDK 21 toolchain).
    • collectone.wasm.app (WasmAppConventionPlugin, WasmSourceMaps.kt): webpack bundle, the
      generated user-data-service-config.js and firebase-config.js, Binaryen modes
      (WASM_OPT=full|fast|none), and source-map hydration for browser dev tools.
    • collectone.detekt and collectone.kover (a jvmTests report variant; generated code excluded).
    • LocalSettings: reads a setting from a Gradle property, then the environment, then
      local.properties. ProjectConfig.kt: Android SDK levels, JDK versions, per-module Maven group.
    • ProtoSchemaDescriptorsFactory: a Wire schema handler that generates a Kotlin table of message
      fields and enum constants, used by the ProtoJSON and textproto codecs in common code.
  • config/detekt/detekt.yml: shared detekt rules on top of the defaults.
  • .github/workflows/check.yml: adds the server Spanner tests and jvm tests, coverage, and detekt
    jobs next to the existing format and license job. .github/workflows/goldens.yml: the Playwright
    golden-screenshot job. Their steps are guarded by hashFiles(...), so they are skipped until the
    module they need lands.
  • scripts/: new spanner-emulator.sh (downloads and runs a pinned emulator), wasm-opt-wrapper.sh
    (caps cores and serializes wasm-opt runs), launchpad.sh. Small edits to ktfmt.sh,
    buf-format.sh (cache directory name) and license-check.sh (also checks .sq/.sqm, skips
    detekt-baseline.xml).
  • README.md, shared/README.md, GEMINI.md: updated for the single build, the module layout, local
    configuration keys, coverage and CI. .dockerignore, .gitignore: server image context and ignored
    local credentials files.

Where it fits

Everything else in the series builds on this: each module's build.gradle.kts applies the
collectone.* plugins and reads versions from the catalog, and CI picks modules up as they appear.
It depends on nothing but c1.

Not in this PR

  • Product and technical docs referenced by the READMEs → D01 Docs: product and UX, D02–D03 Docs: technical
  • .proto schemas → P01–P03 Protos
  • :shared:core sources and its build file → K01–K07 Core
  • :server and its Dockerfile → S01–S04 Server
  • Build files of the app and web module families → A01 App: Gradle module scaffolding, B01 Web: Gradle
    module scaffolding
  • devtools/launchpad/ (what scripts/launchpad.sh starts) → H04 iOS host and local dev launchpad
  • e2eTests/ (what goldens.yml runs) → E01, E02 Playwright E2E

Suggested reading order

  1. README.md ("Building", "Test Coverage", "Continuous Integration"), then shared/README.md
  2. settings.gradle.kts, build.gradle.kts, gradle/libs.versions.toml
  3. build-logic/build.gradle.kts, then ProjectConfig.kt, LocalSettings.kt, the Kmp* and
    AndroidApp/JvmServer plugins, DetektConventionPlugin.kt, KoverConventionPlugin.kt
  4. WasmAppConventionPlugin.kt, WasmSourceMaps.kt, scripts/wasm-opt-wrapper.sh
  5. ProtoSchemaDescriptorsFactory.kt
  6. .github/workflows/check.yml, .github/workflows/goldens.yml, scripts/spanner-emulator.sh

Focus areas

  • includeIfPresent in settings.gradle.kts: is conditional inclusion acceptable as the way to keep
    each slice buildable, and should it stay after the series lands?
  • Plugin loading: the root script loads plugins with apply false and build-logic compiles against
    them as compileOnly, so every module shares one copy at the catalog version.
  • gradlew is modified from the stock script to fetch gradle-wrapper.jar (pinned URL and SHA-256)
    instead of committing the binary. Note the jar's tag (v8.12.1) differs from the distribution (8.14.5).
  • AndroidAppConventionPlugin disables the check*AarMetadata tasks to assemble with compile SDK 35
    and AGP 8.5.2. Worth a second opinion.
  • ProtoSchemaDescriptorsFactory: map fields as synthetic <FieldName>Entry messages, oneof
    members in declaration order, and the hard-coded layouts of well-known types.
  • Coverage gate: minimum of 80% merged line coverage in build.gradle.kts; CI runs
    :koverVerifyJvmTests only once shared/web and server are both present.
  • CI triggers: both workflows run on pull requests and on pushes to c1 and wip/baobab. The README
    says main; that wording describes the final repository.
  • Versions in the catalog include pre-releases (compose-multiplatform 1.13.0-beta02).

Safe to skim

  • gradlew.bat, the stock parts of gradlew, gradle/gradle-daemon-jvm.properties (generated
    toolchain URLs), gradle/wrapper/gradle-wrapper.properties
  • The [libraries] and [plugins] tables of gradle/libs.versions.toml
  • README.md sections that restate the module layout and the configuration key table

Size

Source Tests Data Files
2744 0 0 38

LICENSE and AUTHORS are in the slice but identical to c1, so the diff shows 36 files.

Testing

bash scripts/ktfmt.sh --check: PASS (16 Kotlin files). bash scripts/license-check.sh --check: PASS
(25 files). ./gradlew help: PASS, so the root build and build-logic compile and configure with no
modules present. There are no Gradle modules in this slice, so no jvmTest or detekt tasks ran.
CI: Check (ktfmt, license headers; the buf, JVM test, detekt and Spanner steps are skipped until
their inputs exist) and Goldens (skipped until e2eTests/ lands).
No deviations from the wip/baobab tree, and no currency amounts in the slice.

Root Gradle build (modules are included only when present), build-logic convention plugins, detekt config, scripts, and CI workflows whose steps are skipped until their module lands.

Sliced from wip/baobab @ db237d5. Tracking: #2629.
@gino-m gino-m added the collect-one Tickets related to Collect One label Nov 27, 2026
@gino-m
gino-m requested a review from rfontanarosa November 27, 2026 19:13
@gino-m gino-m self-assigned this Nov 27, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request consolidates the repository into a single Gradle build, introducing shared convention plugins under build-logic/ to manage Kotlin Multiplatform, Android, Compose, Wasm, Detekt, and Kover configurations. It also restructures the shared submodules, updates documentation to reflect the new architecture, and adds local development scripts like a Spanner emulator launcher. The review feedback highlights critical compilation errors in LocalSettings.kt and settings.gradle.kts due to non-existent layout properties, a process management bug in spanner-emulator.sh that leaves detached emulator processes running, and a task isolation violation in WasmAppConventionPlugin.kt when copying files under the WASM_OPT=none configuration.

Comment thread settings.gradle.kts Resolved
Comment thread scripts/spanner-emulator.sh Resolved
gino-m added a commit that referenced this pull request Nov 28, 2026
@gino-m gino-m assigned rfontanarosa and unassigned gino-m Nov 28, 2026
@gino-m

gino-m commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator Author

✦ Closing this PR for now. The review series is being re-cut into smaller PRs, and nothing new opens until the author approves the revised plan in #2629. The branch stays, and the review fixes made here are already in the source branch, so they carry over to the new PRs.

@gino-m gino-m closed this Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

collect-one Tickets related to Collect One

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants