feat(plugins): migrate all four plugins to #[derive(UlbConfig)] - #12
Merged
Conversation
…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.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, enablingplugins describeto show typed field descriptions.What changed
hello-plugin—PluginConfigunit struct (schema is empty but structurally correct)jvm-plugin—PluginConfig,Classpath,JvmConfigstructs with full field descriptions;classpath_bucketandoptional_string_listhelpers removedandroid-plugin—AndroidPluginConfig,AndroidBlock,SigningBlock,ClasspathBlockstructs;configure()still reads fromserde_json::Valuebecausecompute_variantsdeeply integrates with the raw valuekmp-plugin—KmpPluginConfigstruct withserde_json::Valuefor dynamickmpblock,classpathSourceSets,android,buildTypes,productFlavors,signingfieldsCommits
Verification
Blocked on
Uliab PR #33 (Phase 16A SDK with UlbConfig/embed_schema) — CI checks out Uliab main which doesn't yet have these types.