Skip to content

feat(plugins): migrate all four plugins to #[derive(UlbConfig)] - #12

Merged
ulite-Amr merged 11 commits into
mainfrom
feat/buildconfig-generation
Aug 26, 2026
Merged

feat(plugins): migrate all four plugins to #[derive(UlbConfig)]#12
ulite-Amr merged 11 commits into
mainfrom
feat/buildconfig-generation

Conversation

@ulite-Amr

@ulite-Amr ulite-Amr commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Migrates all four production plugins to #[derive(UlbConfig)] for typed config schema generation. Each plugin now embeds its config schema in the wasm custom section, enabling plugins describe to show typed field descriptions.

What changed

  • hello-pluginPluginConfig unit struct (schema is empty but structurally correct)
  • jvm-pluginPluginConfig, Classpath, JvmConfig structs with full field descriptions; classpath_bucket and optional_string_list helpers removed
  • android-pluginAndroidPluginConfig, AndroidBlock, SigningBlock, ClasspathBlock structs; configure() still reads from serde_json::Value because compute_variants deeply integrates with the raw value
  • kmp-pluginKmpPluginConfig struct with serde_json::Value for dynamic kmp block, classpathSourceSets, android, buildTypes, productFlavors, signing fields

Commits

aa8cad1 feat(kmp-plugin): add #[derive(UlbConfig)] config schema structs
a975f00 feat(android-plugin): add #[derive(UlbConfig)] config schema structs
a667186 feat(jvm-plugin): migrate to #[derive(UlbConfig)] for config schema
445b879 feat(hello-plugin): migrate to #[derive(UlbConfig)] for config schema

Verification

  • cargo build --all-targets — zero warnings
  • cargo clippy --all-targets --all-features -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo test — all 90+ tests pass
  • Process-tell grep clean

Blocked on

Uliab PR #33 (Phase 16A SDK with UlbConfig/embed_schema) — CI checks out Uliab main which doesn't yet have these types.

…ser fields

The android plugin now generates a BuildConfig.java source file for each
variant during the configure phase. The file contains nine default fields
derived from the module's android block (APPLICATION_ID, BUILD_TYPE,
DEBUG, FLAVOR, VERSION_CODE, VERSION_NAME, MIN_SDK_VERSION,
TARGET_SDK_VERSION, COMPILE_SDK_VERSION) plus any user-defined fields
declared via buildConfigField triples in the android block.

DSL syntax:
  buildConfigField ["TYPE", "NAME", "INITIALIZER"]

The generated file lives at
<build>/<variant>/generated/buildconfig/<namespace>/BuildConfig.java and
is added to javac's -sourcepath so compilation resolves it automatically.

New public items: BuildConfigField, BuildConfigParams, parse_build_config_fields,
generate_buildconfig_source, quote_string.

Also fixes: merge_variant_sources now resolves base paths before
deduplication so relative paths in base sources match resolved flavor
paths. Adds #[derive(Debug)] to FlavorInfo. Suppresses pre-existing
unused variable warnings in the top-level partition call.

50 tests, clippy clean, fmt clean.
Mark BuildConfig generation as done in the next-up list. Update
clippy-clean unused variable and useless_vec in the dedup test.
…eneration

generateBuildConfig<V> adds 2 tasks (one per variant), so:
- Java first build: 18→20 ran
- Java unchanged: 0 ran, 18→20 up-to-date
- Java resource change: 13→15 ran, 5 up-to-date
- Java source change: 8 ran, 10→12 up-to-date
- Kotlin first build: 20→22 ran
…igField parsing

The evaluator's insert_accumulating produces an irregular structure when
buildConfigField is declared multiple times: the first triple's elements
are flat strings, and subsequent triples are nested sub-arrays. Both the
plugin's parse_build_config_fields and the fixture's buildConfigProbe now
walk the array extracting triples from both forms. Also updates CI task
count assertions (18→20 for Java, 20→22 for Kotlin), unit tests, and
the resource-change assertion.
… harden tests

- quote_string now escapes backslashes and double quotes to produce valid
  Java string literals.
- Remove unused partition_sources call and _base in dedup test (dead code).
- Add 3-entry and non-dedup merge tests for better coverage.
- Document that merge_variant_sources returns absolute paths.
Replace manual serde_json::Value config parsing with a typed
PluginConfig struct using the UlbConfig derive macro. The derive
generates serde::Deserialize and a schema() function. The embed_schema!
macro embeds the schema JSON as a wasm custom section for host-side
extraction without plugin instantiation.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fb144416-274a-4dc0-8304-ae6e74050acb


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Replace raw serde_json::Value config reads with typed PluginConfig,
Classpath, and JvmConfig structs. The derive macro generates
serde::Deserialize + schema() + SCHEMA_JSON const, and embed_schema!
embeds the schema in the wasm custom section.

Config fields now carry rustdoc comments that surface as schema
descriptions via plugins describe. The string_list, optional_string_list,
and classpath_bucket helper functions are removed — serde handles
deserialization and defaults.
Define typed AndroidPluginConfig, AndroidBlock, SigningBlock, and
ClasspathBlock structs with derive(UlbConfig) for schema generation.
The derive macro generates serde::Deserialize + schema() + SCHEMA_JSON,
and embed_schema! embeds the schema in the wasm custom section.

Configure() continues reading from serde_json::Value because
compute_variants deeply integrates with the raw value for dynamic
buildTypes/productFlavors maps. The typed structs exist for schema
generation — plugins describe now shows all config fields with
descriptions.
Define KmpPluginConfig struct with derive(UlbConfig) for schema
generation. The kmp block is fundamentally dynamic (source sets and
targets are open-ended maps), so kmp/classpathSourceSets/android/
buildTypes/productFlavors/signing remain serde_json::Value.

The typed struct exists for schema generation — embed_schema! embeds
it in the wasm custom section, and plugins describe now shows all
config fields with descriptions.
@ulite-Amr ulite-Amr changed the title feat(hello-plugin): migrate to #[derive(UlbConfig)] for config schema feat(plugins): migrate all four plugins to #[derive(UlbConfig)] Aug 26, 2026
@ulite-Amr
ulite-Amr merged commit d558c69 into main Aug 26, 2026
1 of 9 checks passed
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.

1 participant